Fitting point to plane??

285 Views Asked by At

As explained here, given a plane:

ax + by + cz + d = 0

and a point x0=( x0 , y0, z0 ), the normal vector to the plane is given by:

v = [ a ; b ; c ]

and a vector from the plane to the point is given by:

w = -[ x-x0 ; y-y0 ; z-z0 ]

Projecting w onto v gives the (shortest) distance D from the point to the plane as:

D = ( ax0 + by0 + cz0 + d ) / ( sqrt( a2 + b2 + c2 ) )

The question is simple: how to fit the point x0 to the plane, i.e. how to move it to ( x , y, z ) position, which is the closest point lying on the plane to x0.

2

There are 2 best solutions below

1
On BEST ANSWER

The equation of the line is:

x = x0 + at

y = y0 + bt

z = z0 + ct

And the intersection of the line with the plane is given by:

a(x0 + at) + b(y0 + bt) + c(z0 + ct) + d = 0

Just need to find t and substitute it in the line equation to find the point ( x , y, z ).

1
On

Everything you need to solve this is already in your question. The shortest distance to the plane is, as you say, in a direction parallel to the normal, so if you move that distance along that direction toward the plane, you end up at the nearest point on the plane to the given one. I.e., $$\mathbf x = \mathbf x_0-D{\mathbf v\over\|\mathbf v\|} = \mathbf x_0 - {\mathbf v\cdot\mathbf x_0+d\over\mathbf v\cdot\mathbf v}\mathbf v.$$ Note that $D$ is signed, which we want because that encodes which side of the plane $\mathbf x_0$ is on relative to $\mathbf v$. I’ll leave it to you to verify that $\mathbf x$ is indeed on the given plane.