[geos-devel] [GEOS] #841: Regression in prepared polygons contains

GEOS geos-trac at osgeo.org
Wed Sep 6 11:54:33 PDT 2017


#841: Regression in prepared polygons contains
-------------------------------+---------------------------
 Reporter:  sgillies           |       Owner:  geos-devel@…
     Type:  defect             |      Status:  new
 Priority:  major              |   Milestone:  3.6.3
Component:  Default            |     Version:  3.6.2
 Severity:  Unassigned         |  Resolution:
 Keywords:  prepared contains  |
-------------------------------+---------------------------

Comment (by mdavis):

 I can't comment on why there is a regression in GEOS, but I will note
 something "interesting" about this case.  Mathematically, the value of
 contains for this case should be FALSE.  This is because of the
 consequence of the OGC contains semantics that "Polygons do not contain
 their boundary".  That said, in JTS (all versions) the value of contains
 is TRUE (for both PreparedGeometry and Geometry)!  This is because of
 numerical precision issues.  While mathematically the point (0.95, 0.05)
 lies exactly on the line (1,0)-(0,1), slight discrepancies in the
 floating-point representation result in a non-zero determinant being
 computed in the CGAlgorithms.orientationIndex test, which in turn results
 in the point being computed as NOT on the line segment.

 Unfortunately for JTS, even the new extended-precision arithmetic approach
 still computes a non-zero determinant, due to the mathematical 0.05 being
 represented as 0.050000000000000002775557561562891 (and similarly for
 0.95).  Not sure at the moment how this can be resolved, or even whether
 it should be.

--
Ticket URL: <https://trac.osgeo.org/geos/ticket/841#comment:1>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list