Opened 5 years ago
Closed 3 years ago
#1000 closed defect (fixed)
behavior of GEOSCoordSeq_isCCW() is unclear when input is not a simple closed curve
Reported by: | sirsigurd | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 3.10.0 |
Component: | Default | Version: | 3.7.0 |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
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.
Note:
See TracTickets
for help on using tickets.
No, checking this back against JTS, apparently JTS always returns false on invalid input. So we could ape that, which would be a slight change.