behavior of GEOSCoordSeq_isCCW() is unclear when input is not a simple closed curve
|Reported by:||sirsigurd||Owned by:|
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 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:
- Orientation is defined only for SCC, so if input is not SCC, it can't be CCW-oriented curve (is_ccw = 0).
- 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.