Fix an ancient error in dist_ps (distance from point to line segment), which
commit493b71a8f087166f4845d6a2410558dc75b776da
authortgl <tgl>
Tue, 23 Jun 2009 16:25:02 +0000 (23 16:25 +0000)
committertgl <tgl>
Tue, 23 Jun 2009 16:25:02 +0000 (23 16:25 +0000)
treeb585e443e55998f7a0dff42f8a287babd77fb344
parent904075bf86b34be5e5446afd92e558b0b45ce7a6
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