PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwpoly_force_clockwise()

void lwpoly_force_clockwise ( LWPOLY poly)

Definition at line 248 of file lwpoly.c.

References lwpoly_is_empty(), LWPOLY::nrings, ptarray_isccw(), ptarray_reverse(), and LWPOLY::rings.

Referenced by lwgeom_force_clockwise().

249 {
250  int i;
251 
252  /* No-op empties */
253  if ( lwpoly_is_empty(poly) )
254  return;
255 
256  /* External ring */
257  if ( ptarray_isccw(poly->rings[0]) )
258  ptarray_reverse(poly->rings[0]);
259 
260  /* Internal rings */
261  for (i=1; i<poly->nrings; i++)
262  if ( ! ptarray_isccw(poly->rings[i]) )
263  ptarray_reverse(poly->rings[i]);
264 
265 }
int ptarray_isccw(const POINTARRAY *pa)
Definition: ptarray.c:1033
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
void ptarray_reverse(POINTARRAY *pa)
Definition: ptarray.c:343
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:405
Here is the call graph for this function:
Here is the caller graph for this function: