PostGIS 3.6.2dev-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 66 of file lwgeom.c.

67{
68 switch (lwgeom->type)
69 {
70 case POLYGONTYPE:
71 return lwpoly_is_clockwise((LWPOLY *)lwgeom);
72
73 case TRIANGLETYPE:
74 return lwtriangle_is_clockwise((LWTRIANGLE *)lwgeom);
75
77 case COLLECTIONTYPE:
78 {
79 uint32_t i;
80 LWCOLLECTION* coll = (LWCOLLECTION *)lwgeom;
81
82 for (i=0; i < coll->ngeoms; i++)
83 if (!lwgeom_is_clockwise(coll->geoms[i]))
84 return LW_FALSE;
85 return LW_TRUE;
86 }
87 default:
88 return LW_TRUE;
89 return LW_FALSE;
90 }
91}
#define LW_FALSE
Definition liblwgeom.h:94
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
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:66
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

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: