Page 1 of 1

Point3D to cloudIndex

Posted: Tue Jan 08, 2019 11:07 am
by Tolier
Hi Daniel,

I haven't found a function that allows me to get the index of a point in the cloud when I give it 3D coordinates
For example, with this you can obtain approximate coordinates of the point you are aiming at:

Code: Select all

CCVector3d P;
pGLView->getClick3DPos(mouseEvent->pos().x(), mouseEvent->pos().y(), P)
But once the X, Y, Z has been stored, it is mandatory to go through the entire sizecloud and test each getpoint(index, Point) to obtain an index .

thanks

Re: Point3D to cloudIndex

Posted: Tue Jan 08, 2019 10:19 pm
by daniel
In this case it would be more efficient to use the octree and find the 'nearest point' to the given coordinates (of course this point should actually be the input one). But of course computing the octree has a cost, so it has to be compared to looking through all the points. It's generally worth it if this operation is made several times.