Projection of Point on a Line

The following 3 methods can be used to find the Projection of a Point on a Line

  1. Projection of a point C having position vector \(\vec{C}\) on any line having direction ratio \(\vec{A}\) making a vector \(\vec{B}\) with any point on the line is given by the following formula

    \( \vec{P}= \vec{C} - (\frac{\vec{A} \times (\vec{B} \times \vec{A})}{\vert \vec{A} \vert ^2})\)

    In the above formula \(\vec{P}\) is the point of projection. The length of the projection D (i.e. the distance of the point from the line) is given by the following formula

    \(D = \frac{\vert\vec{A}\times\vec{B}\vert}{\vert \vec{A} \vert} \)

    The above formulae is applicable for both 2D and 3D Lines. Also distance value obtained by above formula is always positive
  2. Projection of a point C having position vector \(\vec{C}\) on any line joining two points A and B having position vector \(\vec{A}\) and \(\vec{B}\) respectively is given by the following formula

    \( \vec{P}= \vec{A} + (\frac{(\vec{AB} \cdot \vec{AC}) \vec{AB} }{\vert \vec{AB} \vert ^2})\)

    In the above formula \(\vec{P}\) is the point of projection. The length of the projection D (i.e. the distance of the point from the line) is given by the following formula

    \(D = \frac{\vert\vec{AB}\times\vec{AC}\vert}{\vert \vec{AB} \vert} \)

    The above formulae is also applicable for both 2D and 3D Lines. Also distance value obtained by above formula is always positive
  3. For 2D only, projection of a point C having position vector \(\vec{C}\) on any line having normal vector \(\vec{A}\) making a vector \(\vec{B}\) with any point on the line is given by following formula

    \( \vec{P}= \vec{C} - (\frac{(\vec{A} \cdot \vec{B}) \vec{A} }{\vert \vec{A} \vert ^2})\)

    In the above formula \(\vec{P}\) is the point of projection. The length of the projection D (i.e. the distance of the point from the line) is given by the following formula

    \(D = \frac{\vec{A}\cdot\vec{B}}{\vert \vec{A} \vert} \)

    The above formula gives a signed distance values (i.e. the distance values can be negative or positive).