Perpendicular distance from p to the (infinite) line through a and b. Falls back to Euclidean point-to-point distance when a and b coincide (degenerate segment), so the caller doesn't need to filter those out before measuring.
p
a
b
Perpendicular distance from
pto the (infinite) line throughaandb. Falls back to Euclidean point-to-point distance whenaandbcoincide (degenerate segment), so the caller doesn't need to filter those out before measuring.