So which is the usual convention, because I can make it work either way - is d the distance along the normal to the plane, or is it the distance FROM the plane TO the origin?
NOTE: I really tried hard but didnt get LaTeX equations to work in this post. Apparently eqn is broken
and services like codecogs.com forbidden. So I posted the LaTeX code verbatim, sorry.
Hi!
I think this has nothing to do with conventions, but derives from the plane equation:
Let N be the normal vector of your plane and P an arbitrary point in your plane. The plane is then described by the equation
p = \{ Q | N(Q - P) = 0 \} = \{ Q | N^TQ + D = 0 \}, where D = -(N^T)P So my D is your dist, in this case.
So let's compute the distance of this plane to the origin. First we calculate the closest point Q on the plane to the origin,
by shooting a line l through the origin in direction N. The intersection of line l and plane p is the point Q.
The equation for l is simply l = \{ N \lambda + 0 | \lambda \in \mathbb{R} \}
Let's compute Q by intersecting l and p:
\begin{align*}
& N(\lambda N - P) = 0 \\
\Leftrightarrow & \lambda N^TN - NP = 0 \\
\Leftrightarrow & \lambda = \frac{NP}{||N||^2} = -\frac{D}{||N||^2}
\end{align*}
So Q = -\frac{D}{||N||^2} N
When normalizing N, we get Q = -DN.
There you see the distance of the plane to the origin is |D|.
You are free to interpret the sign of D in this equation, but it's not a matter of
convention I think