mail  mail@stemandmusic.in
    
call  +91-9818088802
Donate

Distance of a Point from a Line/Plane/Hyper-Plane

  1. Distance \(D\) of a Point \(C\) having Position Vector \(\vec{C}\) from any Line in 2D, 3D or Higher Dimensions having Direction Ratio \(\vec{A}\) containing a Point \(B\) having Position Vector \(\vec{B}\) is calculated as the Length of Rejection of Vector \(\vec{CB}\) from Vector \(\vec{A}\) as follows

    \(D=|{\vec{CB}}_{\perp}|=|\vec{CB} - {\vec{CB}}_{||}|=|\vec{CB} - \frac{(\vec{A} \cdot \vec{CB})\vec{A}}{{|\vec{A}|}^2}|\)   (In 2D, 3D and Higher Dimensions)   ...(1)

    \(D = |\vec{CB}| \sin (\theta) = \frac{|\vec{A}||\vec{CB}| sin (\theta)}{|\vec{A}|} = \frac{|\vec{A}\times\vec{CB}|}{|\vec{A}|}\)   (In 2D and 3D only)   ...(2)

    where \(\theta=\)Angle Between the Vectors \(\vec{CB}\) and \(\vec{A}\)

    The Distance of a Origin from the Line (i.e. when Position Vector \(\vec{C}=\vec{0}\) or NULL Vector ) is given as

    \(D=|{\vec{B}}_{\perp}|=|\vec{B} - {\vec{B}}_{||}|=|\vec{B} - \frac{(\vec{A} \cdot \vec{B})\vec{A}}{{|\vec{A}|}^2}|\)   (In 2D, 3D and Higher Dimensions)   ...(3)

    \(D = |\vec{B}| \sin (\theta) = \frac{|\vec{A}||\vec{B}| sin (\theta)}{|\vec{A}|} = \frac{|\vec{A}\times\vec{B}|}{|\vec{A}|}\)   (In 2D and 3D only)   ...(4)

    where \(\theta=\)Angle Between the Vectors \(\vec{B}\) and \(\vec{A}\)

    The Distance \(D\) can also be calculated by First finding the Vector \(\vec{CB_\perp}\) (or \(\vec{B_\perp}\)) and then calculating their Length. Please note that Distance \(D\) calculated using this method or any of the methods given in equations (1), (2), (3) and (4) is always a Positive Value (i.e. they always calculate an Unsigned Distance Value).
  2. Distance \(D\) of a Point \(C\) having Position Vector \(\vec{C}\) from any Line in 2D (or on any Plane in 3D or on any Hyper-Plane in Higher Dimensions) having Direction Ratio of Normal \(\vec{A}\) containing a Point \(B\) having Position Vector \(\vec{B}\) is calculated as the Length of Projection of Vector \(\vec{CB}\) on Vector \(\vec{A}\) as follows

    \(D = |\vec{CB_{||}}|= |\vec{CB}| \cos (\theta) = \frac{|\vec{A}||\vec{CB}| cos (\theta)}{|\vec{A}|} = \frac{\vec{A}\cdot\vec{CB}}{|\vec{A}|}\)   ...(5)

    where \(\vec{CB}=\vec{C}-\vec{B}\), \(\theta=\)Angle Between the Vectors \(\vec{CB}\) and \(\vec{A}\)

    The Distance of a Origin from the Line (i.e. when Position Vector \(\vec{C}=\vec{0}\) or NULL Vector ) is given as

    \(D=|\vec{B_{||}}|= |\vec{B}| \cos (\theta) = \frac{|\vec{A}||\vec{B}| cos (\theta)}{|\vec{A}|} = \frac{\vec{A}\cdot\vec{B}}{|\vec{A}|}\)   ...(6)

    Please note that the Distance \(D\) calculated using methods given in equations (5) and (6) can be either Positive or Negative (i.e. they always calculate a Signed Distance Value). The value of Distance is Positive if Angle Between Vector \(\vec{A}\) and \(\vec{CB}\) (or Angle Between Vector \(\vec{A}\) and \(\vec{B}\)) is less than 90\(^\circ\). The value of Distance is Negative if Angle Between Vector \(\vec{A}\) and \(\vec{CB}\) (or Angle Between Vector \(\vec{A}\) and \(\vec{B}\)) is greater than 90\(^\circ\).

    The Distance \(D\) can also be calculated by First finding the Vector \(\vec{CB_{||}}\) (or \(\vec{B_{||}}\)) and then calculating their Length. However, the Distance \(D\) calculated using this method is always a Positive Value (i.e. they always calculate an Unsigned Distance Value).
  3. The Signed Distance Value of a Point from any Line in 2D (or on any Plane in 3D or on any Hyper-Plane in Higher Dimensions) can also be calculated from the Coordinate Equations of the Line / Plane / Hyperplane.

    For example, in 2 Dimensions the Signed Distance Value \(D\) of a Point having Coordinates (\(x_c,y_c\)) from Line having Coordinate Equation \(ax + by + c=0\) is given as

    \(D=\frac{ax_c + by_c + c}{\sqrt{a^2 + b^2}}\hspace{6mm}\Rightarrow D=\frac{c}{\sqrt{a^2 + b^2}}\)   (Distance from the Origin when \(x_c=0\) and \(y_c=0\))   ...(7)

    Similarly, in 3 Dimensions the Signed Distance Value \(D\) of a Point having Coordinates (\(x_c,y_c,z_c\)) from Plane having Coordinate Equation \(ax + by + cz +d =0\) is given as

    \(D=\frac{ax_c + by_c + cz_c + d}{\sqrt{a^2 + b^2 + c^2}}\hspace{6mm}\Rightarrow D=\frac{d}{\sqrt{a^2 + b^2 + c^2}}\)   (Distance from the Origin when \(x_c=0\), \(y_c=0\) and \(z_c=0\))   ...(8)

    Likewise, in Any Arbirary N Dimensions (where \(N \geq 2\)) the Signed Distance Value \(D\) of a Point having Coordinates (\(x_{1c},x_{2c},x_{3c},\cdots,x_{nc}\)) from Line / Plane / Hyper Plane having Coordinate Equation \(a_1x_1 + a_2x_2 + a_3x_3 + \cdots + a_nx_n + a_{n+1}=0\) is given as

    \(D=\frac{a_1x_{1c}\hspace{1mm}+\hspace{1mm}a_2x_{2c}\hspace{1mm}+\hspace{1mm}a_3x_{3c}\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}a_nx_{nc}\hspace{1mm}+\hspace{1mm}a_{n+1}}{\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\hspace{6mm}\Rightarrow D=\frac{a_{n+1}}{\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\)   (Distance from the Origin when \(x_{1c}=x_{2c}=x_{3c}=\cdots=x_{nc}=0\))   ...(9)

    The formula for calculating Signed Distance Value \(D\) can be derived as follows

    We know that in any Any Arbirary N Dimensions (where \(N \geq 2\)), the Coordinate Equation of Line / Plane / Hyper Plane is given as

    \(a_1x_1 + a_2x_2 + a_3x_3 + \cdots + a_nx_n + a_{n+1}=0\)

    \(\Rightarrow a_{n+1}= - a_1x_1 - a_2x_2 - a_3x_3 - \cdots - a_nx_n\)   ...(10)

    Also from equation (5) we know that the Signed Distance \(D\) of a Point \(C\) having Position Vector \(\vec{C}\) from any Line in 2D (or on any Plane in 3D or on any Hyper-Plane in Higher Dimensions) having Direction Ratio of Normal \(\vec{A}\) containing a Point \(B\) having Position Vector \(\vec{B}\) is given as

    \(D = \frac{\vec{A}\cdot\vec{CB}}{|\vec{A}|}\)   ...(From equation 5)

    Now, the values of Vectors \(\vec{A}\), \(\vec{B}\), \(\vec{C}\) and \(\vec{CB}\) corresponding to Coordinate Equation of Line / Plane / Hyper Plane in Any Arbirary N Dimensions is given as

    \(\vec{A}=\begin{bmatrix}a_1 \\ a_2 \\ a_3 \\ \vdots \\ a_n\end{bmatrix}\)     \(\vec{B}=\begin{bmatrix}x_1 \\ x_2 \\ x_3 \\ \vdots \\ x_n\end{bmatrix}\)     \(\vec{C}=\begin{bmatrix}x_{1c} \\ x_{2c} \\ x_{3c} \\ \vdots \\ x_{nc}\end{bmatrix}\)     \(\vec{CB}=\vec{C}-\vec{B}=\begin{bmatrix}x_{1c} - x_1 \\ x_{2c} - x_2 \\ x_{3c} - x_3 \\ \vdots \\ x_{nc} - x_n\end{bmatrix}\)

    Now putting values of Vectors \(\vec{A}\), \(\vec{B}\), \(\vec{C}\) and \(\vec{CB}\) from above in equation (5) we get

    \(D = \frac{\begin{bmatrix}a_1 \\ a_2 \\ a_3 \\ \vdots \\ a_n\end{bmatrix} \cdot \begin{bmatrix}x_{1c} - x_1 \\ x_{2c} - x_2 \\ x_{3c} - x_3 \\ \vdots \\ x_{nc} - x_n\end{bmatrix}}{\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\)

    \(\Rightarrow D = \frac{a_1 (x_{1c} - x_1)\hspace{1mm}+\hspace{1mm}a_2 (x_{2c}-x_2)\hspace{1mm}+\hspace{1mm}a_3(x_{3c}-x_3)\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}a_n(x_{nc}-x_n)} {\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\)

    \(\Rightarrow D = \frac{a_1x_{1c}\hspace{1mm}+\hspace{1mm}a_2x_{2c}\hspace{1mm}+\hspace{1mm}a_3x_{3c}\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}a_nx_{nc}\hspace{1mm}-\hspace{1mm} a_1x_1\hspace{1mm}-\hspace{1mm}a_2x_2\hspace{1mm}-\hspace{1mm}a_3x_3\hspace{1mm}-\hspace{1mm}\cdots\hspace{1mm}-\hspace{1mm}a_nx_n} {\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\)   ...(11)

    Now, putting the value of \(- a_1x_1 - a_2x_2 - a_3x_3 - \cdots - a_nx_n\) from equation (10) in equation (11) we get

    \(D=\frac{a_1x_{1c}\hspace{1mm}+\hspace{1mm}a_2x_{2c}\hspace{1mm}+\hspace{1mm}a_3x_{3c}\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}a_nx_{nc}\hspace{1mm}+\hspace{1mm}a_{n+1}}{\sqrt{{a_1}^2\hspace{1mm}+\hspace{1mm}{a_2}^2\hspace{1mm}+\hspace{1mm}{a_3}^2\hspace{1mm}+\hspace{1mm}\cdots\hspace{1mm}+\hspace{1mm}{a_n}^2}}\)   ...(12)

    which is the formula for calculating Signed Distance in Any Arbitrary Dimension given the Coordinate Equation.
Related Topics
Projection of Point on a Line/Plane/Hyper-Plane,    Distance, Projection, Reflection of a Point from/on/across a Line Calculator Distance, Projection, Reflection of a Point from/on/across a Line/Plane/Hyper-Plane Calculator
© Invincible IDeAS. All Rights Reserved