PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_is_clockwise()

int lwgeom_is_clockwise ( LWGEOM lwgeom)

Check clockwise orientation on LWGEOM polygons.

Ensure the outer ring is clockwise oriented and all inner rings are counter-clockwise.

Definition at line 65 of file lwgeom.c.

66{
67 switch (lwgeom->type)
68 {
69 case POLYGONTYPE:
70 return lwpoly_is_clockwise((LWPOLY *)lwgeom);
71
72 case TRIANGLETYPE:
73 return lwtriangle_is_clockwise((LWTRIANGLE *)lwgeom);
74
76 case COLLECTIONTYPE:
77 {
78 uint32_t i;
79 LWCOLLECTION* coll = (LWCOLLECTION *)lwgeom;
80
81 for (i=0; i < coll->ngeoms; i++)
82 if (!lwgeom_is_clockwise(coll->geoms[i]))
83 return LW_FALSE;
84 return LW_TRUE;
85 }
86 default:
87 return LW_TRUE;
88 return LW_FALSE;
89 }
90}
#define LW_FALSE
Definition liblwgeom.h:108
#define COLLECTIONTYPE
Definition liblwgeom.h:122
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:121
#define POLYGONTYPE
Definition liblwgeom.h:118
#define TRIANGLETYPE
Definition liblwgeom.h:129
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:107
int lwpoly_is_clockwise(LWPOLY *poly)
Definition lwpoly.c:288
int lwtriangle_is_clockwise(LWTRIANGLE *triangle)
Definition lwtriangle.c:113
int lwgeom_is_clockwise(LWGEOM *lwgeom)
Check clockwise orientation on LWGEOM polygons.
Definition lwgeom.c:65
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
uint8_t type
Definition liblwgeom.h:448

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

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

Here is the call graph for this function:
Here is the caller graph for this function: