Point-to-line distance in 3D
About this app
Move a point and explore the perpendicular foot, right-angle marker and distance to a line. Check the result using the cross-product formula.
The idea
A line in space is given by g: x = A + t·u with base point A and direction vector u. The shortest path from a point P to the line meets it at the foot of the perpendicular F, at a right angle. The orthogonality condition PF·u = 0 gives t₀ = (AP·u)/(u·u) and hence F = A + t₀·u. The distance is d = |PF|. Alternatively d = |AP × u|/|u|: the magnitude of the cross product is the area of the parallelogram spanned by AP and u, divided by its base |u|.
What the app shows
The 3D scene shows the line g, its direction vector u, the point P, the foot point F and the perpendicular segment PF with a right-angle marker. In the control panel you set P, A and u via number fields; P can also be dragged with the mouse on the ground plane. The values panel computes t₀, F and d live and shows the condition PF·u, which is zero when everything is right. Both distance formulas are listed side by side as a cross-check.
Try it yourself
Drag P parallel to the line and watch F move along while d stays the same. Place P on the line itself: P and F coincide and d drops to zero. Change the direction vector u, for instance by doubling it, and check that t₀ changes while F and d do not. This makes clear that the distance does not depend on how the line is parametrised.
Frequently asked questions
- How do you calculate the distance from a point to a line in 3D?
- Find the foot point F via t₀ = (AP·u)/(u·u) and F = A + t₀·u, then compute d = |PF|. A shortcut is d = |AP × u|/|u|. Both give the same result.
- What is the foot of the perpendicular?
- It is the point on the line closest to the given point. The segment from the point to the foot is perpendicular to the line. Its length is the distance.
- Why does the cross product formula give the distance?
- |AP × u| is the area of the parallelogram spanned by AP and u. Dividing by the base |u| gives the height of that parallelogram. This height is exactly the perpendicular distance from P to the line.
- How do I use the app?
- Set P, the base point A and the direction u in number fields, or drag P on the ground plane. The height of P is set in the Py field. The foot point, the parameter t₀ and the distance update live.
Subject: Analytic geometry
More from Analytic geometry
- Distance between skew lines in 3D
- Planes in space
- Cross and scalar triple products in 3D
- Angles between vectors in 3D
- Angles between lines and planes in 3D
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps