# Calculate distance from plane to parallel plane in O using vector and normal

I'm trying to figure out what's the best method to get the distance between two planes where i have the normalized vector of the plane and a point in the plane. What I want to do is to create a parallel plane where 0,0,0 is in and then calculate the distance between the two planes. My thought was that it's actually the same like the distance between the plane and 0,0,0 which I tried just to calculate as the dot product between the normalized vector and the given point.

e.g.: (The values are that strange because they are from a 3D camera system)

{ 0.00102464424908972; -1.5806471007608384E-4; -0.0014898099362794807} // normalized vector (plane normal)
{ 1.2168973210867913; -0.2862541104934054; -0.39146720489920095} //given point
0.0018753452463538794  //calculated distance  ?


I'm not sure but this looks not like the result I expected. Is it the right formula? I tried to use the Hessesche Normalform

Update: somehow I droped my normalize function and the normal was not normalized. now my results look much better. Thankf for all answers.

-

Computing the dot product between the plane normal and the position vector of the given point strikes me as the right solution.

If you imagine the plane and the position vector $x$ from the origin to the given point of the plane, you can drop an orthogonal projection of the origin onto the plane to form a triangle (with the given point and the origin.) The length of the side perpendicular to the plane (=parallel to the plane normal $n$) is exactly $|(x\cdot n)|$.

-
Call $\pi$ the plane, $p$ a point in $\pi$, and $n$ a vector normal to the plane. Let $\pi'$ be the plane through $(0,0,0)$ parallel to $\pi$. Then the distance between $\pi$ and $\pi'$ is indeed given by $\frac{\lvert n\cdot p\rvert}{\lVert n\rVert}$.
To see this, recall that the distance between two parallel planes is given by the length of the segment between any couple of points (one for each plane) lying on a line orthogonal to both. To get the Cartesian equations of $\pi$, let $d=-n\cdot p$ and $n=(a,b,c)$, so that $$\pi\colon\; ax+by+cz+d=0$$ and the line through $(0,0,0)$ orthogonal to $\pi$ has parametric equations $$r\colon \; \begin{cases} x=at\\ y=bt\\ z=ct \end{cases}$$ Intersecting $\pi$ and $r$ gives $$(a^2+b^2+c^2)\bar{t}+d = 0 \;\Rightarrow\; \bar{t}=\frac{-d}{a^2+b^2+c^2} = \frac{\lvert n\cdot p\rvert}{\lVert n\rVert^2}$$ Finally, the distance between $\pi$ and $\pi'$ is the norm of the vector $(a\bar{t},b\bar{t},c\bar{t})$, i.e. $$\sqrt{(a\bar t)^2+(b\bar t)^2+(c\bar t)^2}=\lvert \bar{t}\rvert\sqrt{a^2+b^2+c^2}=\frac{\lvert n\cdot p\rvert}{\lVert n\rVert^2}\lVert n\rVert=\frac{\lvert n\cdot p\rvert}{\lVert n\rVert}$$