Having problem in figuring out the logic (c++)
-
Hi...i have a small problem and im finding difficult to figure proper algorithm for it, plse help me out.The probelm is explained below: I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array (each point has x,y,z cordinates) and I also have a new point data (x1,y1,z1).My problem is i have to find out if this new point falls with in the boundary of set of points. I am not able to figure out proper logic for this.Can somebody help me out? Plse do help me. Thnx in advance.
-
Hi...i have a small problem and im finding difficult to figure proper algorithm for it, plse help me out.The probelm is explained below: I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array (each point has x,y,z cordinates) and I also have a new point data (x1,y1,z1).My problem is i have to find out if this new point falls with in the boundary of set of points. I am not able to figure out proper logic for this.Can somebody help me out? Plse do help me. Thnx in advance.
raesa wrote:
I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array
Does it have any specific shape ? Because if not, this will probably be very difficult because if you have a 'random'cloud of points, it is quite impossible to make a boundary out of that.
Cédric Moonen Software developer
Charting control [v1.5 - Updated] OpenGL game tutorial in C++ -
raesa wrote:
I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array
Does it have any specific shape ? Because if not, this will probably be very difficult because if you have a 'random'cloud of points, it is quite impossible to make a boundary out of that.
Cédric Moonen Software developer
Charting control [v1.5 - Updated] OpenGL game tutorial in C++ -
Well it depends a lot of your requirements. You can maybe simply check the min/max values for the X, Y and Z axis and so have a 3D rectangle which is the boundary of your points cloud. That should be easy to do (walk over all the points and take the min/max for the 3 dimensions). Then checking if a new point is inside that is quite easy. But does that work with your requirement ? What do you need to do exactly ?
Cédric Moonen Software developer
Charting control [v1.5 - Updated] OpenGL game tutorial in C++ -
Well it depends a lot of your requirements. You can maybe simply check the min/max values for the X, Y and Z axis and so have a 3D rectangle which is the boundary of your points cloud. That should be easy to do (walk over all the points and take the min/max for the 3 dimensions). Then checking if a new point is inside that is quite easy. But does that work with your requirement ? What do you need to do exactly ?
Cédric Moonen Software developer
Charting control [v1.5 - Updated] OpenGL game tutorial in C++I thank you very much, once again.Well, i need to find out if my point lies inside or outside the boundary (or point cloud) formed by the availables set of points. If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud. Plse do tell me if i my understanding of the method you suggested is right. Thank You.
-
I thank you very much, once again.Well, i need to find out if my point lies inside or outside the boundary (or point cloud) formed by the availables set of points. If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud. Plse do tell me if i my understanding of the method you suggested is right. Thank You.
raesa wrote:
If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.
What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing
if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX))
. So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms. my intuition: linear programming problemmodified on Thursday, August 28, 2008 1:56 PM
-
raesa wrote:
If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.
What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing
if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX))
. So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms. my intuition: linear programming problemmodified on Thursday, August 28, 2008 1:56 PM