#1000: behavior of GEOSCoordSeq_isCCW() is unclear when input is not a simple closed curve ------------------------+-------------------------- Reporter: sirsigurd | Owner: geos-devel@… Type: defect | Status: new Priority: major | Milestone: Component: Default | Version: 3.7.0 Severity: Unassigned | Keywords: ------------------------+-------------------------- Here's GEOSCoordSeq_isCCW() doc from C API header:
{{{ /* * Check orientation of a CoordinateSequence and set 'is_ccw' to 1 * if it has counter-clockwise orientation, 0 otherwise. * Return 0 on exception, 1 on success. */ extern int GEOS_DLL GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle, const GEOSCoordSequence* s, char* is_ccw); }}} As I understand from [https://en.wikipedia.org/wiki/Curve_orientation Wikipedia], 'orientation' is defined only for simple closed curves (hereafter referred to as SCC). So from my perspective GEOSCoordSeq_isCCW() could follow one these approaches for input which is not SCC: 1. Orientation is defined only for SCC, so if input is not SCC, it can't be CCW-oriented curve (is_ccw = 0). 2. Orientation is defined only for SCC, so if input is not SCC, it's invalid (error code is returned) Currently GEOSCoordSeq_isCCW() doesn't follow any of these approaches consistently. If coordinate sequence has less than 4 points error code is returned. At later stage if it turns out that there are less than 3 distinctive points is_ccw is set to 0. -- Ticket URL: <https://trac.osgeo.org/geos/ticket/1000> 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