Can you point me to a formula of finding a distance between a point and a plane defined by three other points please

geometry

I've finished my math at the Uni more than 10 years ago and now I have to code a formula for finding subj.
I've done a couple of searches and people there suggest solutions like "find a normal vector", "solve the system of equations" or "derive a formula form the determinant of this matrix".

Yes I could do it, but I terribly don't want to loose a sign somewhere and spend another day debugging.

I just can't believe there isn't somewhere some simple formula which I could simply code.

Thanks in advance.

EDIT: Ok, let's define it more strict.
Let's say there is a point $P=(x0,y0,z0)$ and a plane $m$, defined by three other points (i.e. which it contains): $M1=(x1,y1,z1), M2=(x2,y2,z2), M3=(x3,y3,z3)$

I would like to find a distance between the point $P$ and a plane $m$.

Best Answer

The distance between a point and a plane is defined as: $$ d(P,\pi) = \frac {|Ax_0 +By_0+Cz_0+D|}{\sqrt{A^2+B^2+C^2}}, $$ where $\pi : Ax +By+Cz+D=0 $ and $P(x_0,y_0,z_0)$.

Being given three non collinear points, my suggestion is to write a function to calculate the distance and a function that outputs the coefficients of the plane (with the input: the coordinates of the known points).

Let $M_1(x_1,y_1,z_1), \; M_2(x_2,y_2,z_2), \; M_3(x_3,y_3,z_3)$. Then you can find the coefficients in the plane equation (Ax+By+Cz+D= 0) by: $$ \begin{bmatrix} x_1\;\; y_1 \;\; z_1 \;\;1 \\ x_2\;\; y_2 \;\; z_2 \;\;1 \\ x_3\;\; y_3 \;\; z_3 \;\;1 \end{bmatrix} \begin{bmatrix} A \\ B \\ C \\ D \end{bmatrix} =0 $$

Related Question