[postgis-devel] RFC - Orientation checking and forcing functions

Sandro Santilli strk at kbt.io
Wed Feb 8 06:22:42 PST 2017


On Wed, Feb 08, 2017 at 08:29:56AM -0500, Daniel Baston wrote:
> OK, so some alternatives I see are:
> 
> 1) rename the functions to more clearly indicate that they only consider
> polygons (ST_ForcePolygonCW, ST_IsPolygonCW ? )

The fact that Clockwise state is different in shell and holes makes
"right hand rule" less ambiguous to me. As the ambiguity is in the
"rule" term, we could find a name making it clearer that you want
to find the polygon interior on the right while walking on its
edges. ST_ForceAreaRight / ST_ForceAreaLeft ?

> 2) modify new functions and ST_ForceRHR to also consider orientation of
> closed LineStrings

The "right hand rule" is specifically about polygons, so I don't
see a problem there to leave LineStrings untouched.

> 3) modify new functions to also consider closed LineStrings, without
> modifying ST_ForceRHR
> 
> I don't like the idea of modifying ST_ForceRHR, since it has existed
> forever, and modifying this would also suggest changes to ST_ForceLHR,
> whose implementation is contained within SFCGAL.

What does ST_ForceLHR do ? Documentation doesn't say.
Is it the reverse of ST_ForceRHR or does it use the other
semantic ?

> I'm inclined towards #1.  Do people have any thoughts on these
> alternatives, or maybe a different solution?

At least for topology, it would be useful to have an ST_IsCW or
ST_IsCCW function accepting a closed linestring in input
(sounds like #3)

--strk;



More information about the postgis-devel mailing list