PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoly_force_clockwise()

void lwpoly_force_clockwise ( LWPOLY poly)

Definition at line 270 of file lwpoly.c.

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

Referenced by lwgeom_force_clockwise().

271 {
272  int i;
273 
274  /* No-op empties */
275  if ( lwpoly_is_empty(poly) )
276  return;
277 
278  /* External ring */
279  if ( ptarray_isccw(poly->rings[0]) )
280  ptarray_reverse(poly->rings[0]);
281 
282  /* Internal rings */
283  for (i=1; i<poly->nrings; i++)
284  if ( ! ptarray_isccw(poly->rings[i]) )
285  ptarray_reverse(poly->rings[i]);
286 
287 }
int ptarray_isccw(const POINTARRAY *pa)
Definition: ptarray.c:1029
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
void ptarray_reverse(POINTARRAY *pa)
Definition: ptarray.c:343
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:445
Here is the call graph for this function:
Here is the caller graph for this function: