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

◆ lwtriangle_from_lwline()

LWTRIANGLE * lwtriangle_from_lwline ( const LWLINE shell)

Definition at line 153 of file lwtriangle.c.

154{
155 LWTRIANGLE *ret;
156 POINTARRAY *pa;
157
158 if ( shell->points->npoints != 4 )
159 lwerror("lwtriangle_from_lwline: shell must have exactly 4 points");
160
161 if ( (!FLAGS_GET_Z(shell->flags) && !ptarray_is_closed_2d(shell->points)) ||
162 (FLAGS_GET_Z(shell->flags) && !ptarray_is_closed_3d(shell->points)) )
163 lwerror("lwtriangle_from_lwline: shell must be closed");
164
165 pa = ptarray_clone_deep(shell->points);
166 ret = lwtriangle_construct(shell->srid, NULL, pa);
167
169 lwerror("lwtriangle_from_lwline: some points are repeated in triangle");
170
171 return ret;
172}
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition ptarray.c:723
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition ptarray.c:710
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition ptarray.c:643
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static char lwtriangle_is_repeated_points(LWTRIANGLE *triangle)
Definition lwtriangle.c:134
LWTRIANGLE * lwtriangle_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition lwtriangle.c:40
lwflags_t flags
Definition liblwgeom.h:485
POINTARRAY * points
Definition liblwgeom.h:483
int32_t srid
Definition liblwgeom.h:484
uint32_t npoints
Definition liblwgeom.h:427

References LWLINE::flags, FLAGS_GET_Z, lwerror(), lwtriangle_construct(), lwtriangle_is_repeated_points(), POINTARRAY::npoints, LWLINE::points, ptarray_clone_deep(), ptarray_is_closed_2d(), ptarray_is_closed_3d(), and LWLINE::srid.

Here is the call graph for this function: