we need to fit a set of points (x,y,z) to plane and get fitted value of Z - Zi at a point (Xi,Yi).
We have used Eigen Library for plane fitting. https://gist.github.com/ialhashim/0a2554076a6cf32831ca
Now we have the normal to the plane and centroid of all points.
How can I can calculate the value of Z axis at a point (xi, yi) with the following information?
- Centroid of all points
- Normal to the fitted plane
Thanks!
You want the distance
d
to the plane of a pointr=(xi,yi,zi)
.You have the plane normal
n=(nx,ny,nz)
that should be a unit vector, and a single point on the planep=(px,py,pz)
.which is the dot product between the normal
n
and the relative positionr-p
.Or, if you want the equation of the surface of the plane, then solve the equation below for
zi