Page 1 of 1

Calculation of point to plane distance

Posted: Mon Mar 30, 2015 7:45 am
by bingyu1413
How can I use CC to do some calculation of point to plane distance?

Re: Calculation of point to plane distance

Posted: Mon Mar 30, 2015 8:49 am
by daniel
In CC a plane is in fact a mesh. So you can use the 'Cloud to Mesh' distances computation tool (http://www.cloudcompare.org/doc/wiki/in ... h_Distance).

And programatically you can also use internal methods to comptute real point/plane distances (in CC_CORE_LIB, see the DistanceComputationTools class).

Re: Calculation of point to plane distance

Posted: Wed Apr 01, 2015 12:48 am
by bingyu1413
I have checked the DistanceComputationTool.
In my application,I use ccPlane::Fit(cloud, &rms) to get an average plane.How can I use this plane to caculante the distance from one point to this plane.I couldn't find the ax+by+cz+d=0;[a,b,c,d] in the ccplane;

Re: Calculation of point to plane distance

Posted: Wed Apr 01, 2015 7:14 am
by daniel
The coefficients of the plane equation are rather easy to retrieve:
- the 3 first coefficients (a,b and c) are simply the plane normal (a=N.x, etc.)
- the last coefficient (d) is equal to the dot product of any point belonging to the plane with the plane normal vector. In effect you can use the cloud gravity center (you can use the CCLib::Neighborhood class to easily determine it):

Code: Select all

d = G.dot(N)