#1056: GEOSClipByRect: Incorrect line clipping
------------------------+--------------------------
 Reporter:  Algunenano  |      Owner:  geos-devel@…
     Type:  defect      |     Status:  new
 Priority:  major       |  Milestone:  3.8.2
Component:  Default     |    Version:  3.8.0
 Severity:  Unassigned  |   Keywords:
------------------------+--------------------------
 Comes from Postgis' https://trac.osgeo.org/postgis/ticket/4765

 There are some situations where parts of a line that matches the box
 boundaries are not included in the final intersection.

 Example in GEOS itself:
 {{{
 diff --git a/tests/unit/capi/GEOSClipByRectTest.cpp
 b/tests/unit/capi/GEOSClipByRectTest.cpp
 index e5358436..364c6649 100644
 --- a/tests/unit/capi/GEOSClipByRectTest.cpp
 +++ b/tests/unit/capi/GEOSClipByRectTest.cpp
 @@ -200,5 +200,19 @@ template<> template<> void object::test<13>
      isEqual(geom2_, "POLYGON ((5 5, 5 15, 10 15, 10 10, 15 10, 15 5, 5
 5))");
  }

 +/// Comes from https://trac.osgeo.org/postgis/ticket/4765
 +template<> template<> void object::test<14>
 +()
 +{
 +    const char* wkt = "LINESTRING(0 0, 0 15, 15 15, 1 1)";
 +    geom1_ = GEOSGeomFromWKT(wkt);
 +    geom2_ = GEOSClipByRect(geom1_, 0, 0, 10, 10);
 +    /*
 +     * EXP: MULTILINESTRING((0 0,0 10),(10 10,1 1))
 +     * OBT: LINESTRING (10 10, 1 1)
 +     */
 +    isEqual(geom2_, "MULTILINESTRING((0 0,0 10),(10 10,1 1))");
 +}
 +
  } // namespace tut

 }}}


 Broken in at least GEOS 3.8 and master (I haven't tested it in older
 releases).

 Attaching an image showcasing the issue.

-- 
Ticket URL: <https://trac.osgeo.org/geos/ticket/1056>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
_______________________________________________
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Reply via email to