PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwpoly_force_clockwise()

void lwpoly_force_clockwise ( LWPOLY poly)

Definition at line 175 of file lwpoly.c.

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

Referenced by lwgeom_force_clockwise().

176 {
177  int i;
178 
179  /* No-op empties */
180  if ( lwpoly_is_empty(poly) )
181  return;
182 
183  /* External ring */
184  if ( ptarray_isccw(poly->rings[0]) )
185  ptarray_reverse(poly->rings[0]);
186 
187  /* Internal rings */
188  for (i=1; i<poly->nrings; i++)
189  if ( ! ptarray_isccw(poly->rings[i]) )
190  ptarray_reverse(poly->rings[i]);
191 
192 }
int ptarray_isccw(const POINTARRAY *pa)
Definition: ptarray.c:1026
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
void ptarray_reverse(POINTARRAY *pa)
Definition: ptarray.c:343
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:332
Here is the call graph for this function:
Here is the caller graph for this function: