PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwpoly_segmentize2d()

LWPOLY* lwpoly_segmentize2d ( LWPOLY poly,
double  dist 
)

Definition at line 210 of file lwpoly.c.

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

Referenced by lwgeom_segmentize2d().

211 {
212  POINTARRAY **newrings;
213  uint32_t i;
214 
215  newrings = lwalloc(sizeof(POINTARRAY *)*poly->nrings);
216  for (i=0; i<poly->nrings; i++)
217  {
218  newrings[i] = ptarray_segmentize2d(poly->rings[i], dist);
219  if ( ! newrings[i] ) {
220  while (i--) ptarray_free(newrings[i]);
221  lwfree(newrings);
222  return NULL;
223  }
224  }
225  return lwpoly_construct(poly->srid, NULL,
226  poly->nrings, newrings);
227 }
void lwfree(void *mem)
Definition: lwutil.c:214
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:29
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
int32_t srid
Definition: liblwgeom.h:438
void * lwalloc(size_t size)
Definition: lwutil.c:199
Here is the call graph for this function:
Here is the caller graph for this function: