<div dir="ltr">Grrr, I'm trying to fix <a href="https://trac.osgeo.org/postgis/ticket/5754">https://trac.osgeo.org/postgis/ticket/5754</a> which on the surface is quite simple, but it actually exposes a bit of a rats nest of bad logic. <div><br></div><div>I have a good fix that mostly works, but now I have a "big" regression: the old function returned "true" when handed non-polygonal inputs.</div><div><br></div><div><a href="https://github.com/postgis/postgis/blob/master/regress/core/orientation.sql#L3-L11">https://github.com/postgis/postgis/blob/master/regress/core/orientation.sql#L3-L11</a><br></div><div><br></div><div>Also for empty polygon inputs.</div><div><br></div><div>My feeling is that a geometry is "clockwise" if it is (a) a polygon or polygonal and (b) the outer ring is clockwise and (c) the inner rings are anti-clockwise. Otherwise it's not oriented. (My changes for this work mostly centered around the fact that a geometry can have one of three orientations: clockwise, anticlockwise, and none. That made the logic, I think, more straightforward to understand.)</div><div><br></div><div>So, this change is for 3.7 and I'd like to change the behaviour for non-polygonal inputs to the ST_IsPolygonCCW and ST_IsPolygonCW functions.</div><div><br></div><div>P. </div></div>