<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>+1 from me<br><br>P.</div><div><br>On Feb 7, 2017, at 4:55 PM, Daniel Baston <<a href="mailto:dbaston@gmail.com">dbaston@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>Hi All,</div><div><br></div><div>I put together a pull request a couple of weeks ago that introduces four functions for checking and forcing geometry orientation.  The intent is to provide a less-ambiguous alternative to ST_ForceRHR, and an alternative to ST_Orientation that does not depend on SFCGAL.  Strk asked that I bring this up on the devel list for a review of the semantics.</div><div><br></div><div>The four proposed functions are.</div><div><br></div><div>ST_ForceCW</div><div>ST_ForceCCW</div><div>ST_IsCW</div><div>ST_IsCCW</div><div><br></div><div>The semantics are straightforward, in my opinion:</div><div><br></div><div>1.  ST_ForceCW is a synonym for ST_ForceRHR, which gives all exterior rings a clockwise orientation and all interior rings a counterclockwise orientation.  Non-polygonal geometries, including closed LineStrings, are simply passed through.</div><div>2.  ST_ForceCCW is simply a shorthand for ST_Reverse(ST_ForceCW)</div><div>3.  ST_IsCW returns true if a geometry would not be modified by ST_ForceCW.  It is essentially a synonym for ST_OrderingEquals(geom, ST_ForceCW(geom)).</div><div>4.  ST_IsCCW returns true if a geometry would not be modified by ST_ForceCCW.</div><div><br></div><div>A few notes:</div><div><br></div><div>ST_IsCW and ST_IsCCW both return false if a polygon has invalid ring orientation (i.e., exterior and interior rings are all clockwise)</div><div>ST_IsCW and ST_IsCCW both return true for geometries that have no non-empty polygonal components.</div><div><br></div><div><div>Relevant links: </div><div>PR: <a href="https://github.com/postgis/postgis/pull/122">https://github.com/postgis/postgis/pull/122</a></div><div>Trac: <a href="https://trac.osgeo.org/postgis/ticket/3689">https://trac.osgeo.org/postgis/ticket/3689</a>, <a href="https://trac.osgeo.org/postgis/ticket/3651">https://trac.osgeo.org/postgis/ticket/3651</a></div></div><div><br></div><div>Dan</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>postgis-devel mailing list</span><br><span><a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a></span><br><span><a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></span></div></blockquote></body></html>