Skip to content

False positive answer from GEOSCoordSeq_isCCW #1425

@strk

Description

@strk

This closed coordinate sequence is reported to go counterclockwise by GEOSCoordSeq_isCCW (which returns true) when instead it goes clockwise:

010200000004000000FD613B270D6C314031AA543619475140890205230D6C31408177583619475140A4613B270D6C31402FAA543619475140FD613B270D6C314031AA543619475140

It's known to be a robustness problem, which is known to be fixed by using larger foating point numbers on 64bit platform, see https://trac.osgeo.org/postgis/ticket/6065

In that PostGIS ticket you'll see that SFCGAL can give a correct answer.

The problem seems to be the presence of long outgoing spikes.

The documentation for the function (comment above the function signature in geos_c.h) say:

Invalid (collapsed) or short (fewer than 4 points) sequences return false.

I guess this is a case of "collapsed", but the JTS description ( of CGAlgorithms::isCCW, on which this function is based ) has a slightly different wording:

If the ring is invalid (e.g. self-crosses or touches), the computed result may not be correct.

Is this a case of "touches" ?

@dr-jts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions