PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwpoly_segmentize2d()

LWPOLY* lwpoly_segmentize2d ( LWPOLY poly,
double  dist 
)

Definition at line 283 of file lwpoly.c.

References lwalloc(), lwfree(), lwpoly_construct(), LWPOLY::nrings, ptarray_free(), ptarray_segmentize2d(), LWPOLY::rings, and LWPOLY::srid.

Referenced by lwgeom_segmentize2d().

284 {
285  POINTARRAY **newrings;
286  uint32_t i;
287 
288  newrings = lwalloc(sizeof(POINTARRAY *)*poly->nrings);
289  for (i=0; i<poly->nrings; i++)
290  {
291  newrings[i] = ptarray_segmentize2d(poly->rings[i], dist);
292  if ( ! newrings[i] ) {
293  while (i--) ptarray_free(newrings[i]);
294  lwfree(newrings);
295  return NULL;
296  }
297  }
298  return lwpoly_construct(poly->srid, NULL,
299  poly->nrings, newrings);
300 }
void lwfree(void *mem)
Definition: lwutil.c:242
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:330
POINTARRAY * ptarray_segmentize2d(const POINTARRAY *ipa, double dist)
Returns a modified POINTARRAY so that no segment is longer than the given distance (computed using 2d...
Definition: ptarray.c:420
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
int32_t srid
Definition: liblwgeom.h:453
void * lwalloc(size_t size)
Definition: lwutil.c:227
Here is the call graph for this function:
Here is the caller graph for this function: