Calculation of point to plane distance

Feel free to ask any question here
Post Reply
bingyu1413
Posts: 19
Joined: Tue Oct 28, 2014 5:53 am

Calculation of point to plane distance

Post by bingyu1413 »

How can I use CC to do some calculation of point to plane distance?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Calculation of point to plane distance

Post 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).
Daniel, CloudCompare admin
bingyu1413
Posts: 19
Joined: Tue Oct 28, 2014 5:53 am

Re: Calculation of point to plane distance

Post 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;
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Calculation of point to plane distance

Post 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)
Daniel, CloudCompare admin
Post Reply