R – Minimum perpendicular Distance of a point to a line in 3D plane algorithm


How to find the minimum perpendicular distance of point from a line in 3D plane?

Please give me the logic and I will try to code on myself.

Please let me know how to do it in terms of x,y,z that is in terms of coordinate systems.

I am finding it a bit difficult to find the right solution which will be easy from a coding point of view. Online solutions are little bit rusty to understand. So please help me.

Please note line is given in terms of 3D space equation.

Best Solution

Given point A and a line, pick two different points on the line (B and C). Calculate the area of the triangle ABC with use of Heron's formula. Multiply the area by 2 and divide it by length of [BC]. You have the result you needed.

Related Question