PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_is_clockwise()

int lwgeom_is_clockwise ( LWGEOM lwgeom)

Check clockwise orientation on LWGEOM polygons.

Definition at line 64 of file lwgeom.c.

References COLLECTIONTYPE, LWCOLLECTION::geoms, LW_FALSE, LW_TRUE, lwpoly_is_clockwise(), lwtriangle_is_clockwise(), MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by ST_IsPolygonCCW(), ST_IsPolygonCW(), and test_lwgeom_force_clockwise().

65 {
66  switch (lwgeom->type)
67  {
68  case POLYGONTYPE:
69  return lwpoly_is_clockwise((LWPOLY *)lwgeom);
70 
71  case TRIANGLETYPE:
72  return lwtriangle_is_clockwise((LWTRIANGLE *)lwgeom);
73 
74  case MULTIPOLYGONTYPE:
75  case COLLECTIONTYPE:
76  {
77  int i;
78  LWCOLLECTION* coll = (LWCOLLECTION *)lwgeom;
79 
80  for (i=0; i < coll->ngeoms; i++)
81  if (!lwgeom_is_clockwise(coll->geoms[i]))
82  return LW_FALSE;
83  return LW_TRUE;
84  }
85  default:
86  return LW_TRUE;
87  return LW_FALSE;
88  }
89 }
int lwtriangle_is_clockwise(LWTRIANGLE *triangle)
Definition: lwtriangle.c:113
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:98
int lwpoly_is_clockwise(LWPOLY *poly)
Definition: lwpoly.c:290
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
LWGEOM ** geoms
Definition: liblwgeom.h:509
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
uint8_t type
Definition: liblwgeom.h:396
int lwgeom_is_clockwise(LWGEOM *lwgeom)
Check clockwise orientation on LWGEOM polygons.
Definition: lwgeom.c:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: