Fix an ancient error in dist_ps (distance from point to line segment), which
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 23 Jun 2009 16:25:35 +0000 (16:25 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 23 Jun 2009 16:25:35 +0000 (16:25 +0000)
commit34f662dd65141990508ecb9e482cc4c9db50db4f
tree0d5666d19568df3c174b5424f5d526de0a54e0f8
parentb99bb3b21888a66a64a9d23e128995e021123709
Fix an ancient error in dist_ps (distance from point to line segment), which
a number of other geometric operators also depend on.  It miscalculated the
slope of the perpendicular to the given line segment anytime that slope was
other than 0, infinite, or +/-1.  In some cases the error would be masked
because the true closest point on the line segment was one of its endpoints
rather than the intersection point, but in other cases it could give an
arbitrarily bad answer.  Per bug #4872 from Nick Roosevelt.

Bug goes clear back to Berkeley days, so patch all supported branches.
Make a couple of cosmetic adjustments while at it.
src/backend/utils/adt/geo_ops.c