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

◆ lwgeom_perimeter_2d()

double lwgeom_perimeter_2d ( const LWGEOM geom)

Definition at line 2044 of file lwgeom.c.

2045{
2046 int type = geom->type;
2047 if ( type == POLYGONTYPE )
2048 return lwpoly_perimeter_2d((LWPOLY*)geom);
2049 else if ( type == CURVEPOLYTYPE )
2051 else if ( type == TRIANGLETYPE )
2052 return lwtriangle_perimeter_2d((LWTRIANGLE*)geom);
2053 else if ( lwgeom_is_collection(geom) )
2054 {
2055 double perimeter = 0.0;
2056 uint32_t i;
2057 LWCOLLECTION *col = (LWCOLLECTION*)geom;
2058 for ( i = 0; i < col->ngeoms; i++ )
2059 perimeter += lwgeom_perimeter_2d(col->geoms[i]);
2060 return perimeter;
2061 }
2062 else
2063 return 0.0;
2064}
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
double lwtriangle_perimeter_2d(const LWTRIANGLE *triangle)
Definition lwtriangle.c:210
double lwpoly_perimeter_2d(const LWPOLY *poly)
Compute the sum of polygon rings length (forcing 2d computation).
Definition lwpoly.c:484
double lwcurvepoly_perimeter_2d(const LWCURVEPOLY *poly)
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
double lwgeom_perimeter_2d(const LWGEOM *geom)
Definition lwgeom.c:2044
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

References CURVEPOLYTYPE, LWCOLLECTION::geoms, lwcurvepoly_perimeter_2d(), lwgeom_is_collection(), lwgeom_perimeter_2d(), lwpoly_perimeter_2d(), lwtriangle_perimeter_2d(), LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by LWGEOM_perimeter2d_poly(), and lwgeom_perimeter_2d().

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