Code for searching neighborhood

Feel free to ask any question here
Post Reply
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Code for searching neighborhood

Post by fblue »

Hi,
I want to search the nearest point from a given point in a cloud. I've tried the code as following:
ccPointCloud* cloud = ccHObjectCaster::ToPointCloud(entity);
CCLib::ReferenceCloud* ref_cloud = new CCLib::ReferenceCloud(cloud);
CCVector3 point(200,100,100);
double distance_ = 0.01;
int test_index = cloud->getOctree()->findPointNeighbourhood(&point,ref_cloud,1,8,distance_);

Is that the correct way for searching the index of the nearest point ? I can't find out the document so I code it just by imagination. The code can be compiled but generates problem when running.
If it's wrong, so what's the method for searching nearest point index?
Thanks
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: Code for searching neighborhood

Post by fblue »

I think I've figured it out.
In fact the return value is the number of nearest point and its index is stored in referenc Cloud.
Post Reply