Returns a modified POINTARRAY so that no segment is longer than the given distance (computed using 2d).
Every input point is kept. Z and M values for added points (if needed) are set proportionally.
Definition at line 405 of file ptarray.c.
415 pbuf.
x = pbuf.
y = pbuf.
z = pbuf.
m = 0;
425 for (i = 1; i < ipa->
npoints; i++)
436 POINT4D *p1ptr=&p1, *p2ptr=&p2;
443 segments = ceil(segdist / dist);
448 lwnotice(
"%s:%d - %s: Too many segments required (%e)",
449 __FILE__, __LINE__,__func__, segments);
455 for (j = 1; j < nseg; j++)
457 pbuf.
x = p1.
x + (p2.
x - p1.
x) * j / nseg;
458 pbuf.
y = p1.
y + (p2.
y - p1.
y) * j / nseg;
460 pbuf.
z = p1.
z + (p2.
z - p1.
z) * j / nseg;
462 pbuf.
m = p1.
m + (p2.
m - p1.
m) * j / nseg;
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
#define FLAGS_GET_Z(flags)
#define FLAGS_GET_M(flags)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
#define LW_TRUE
Return types for functions with status returns.
#define LW_ON_INTERRUPT(x)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
void ptarray_free(POINTARRAY *pa)
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int repeated_points)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
References distance2d_pt_pt(), POINTARRAY::flags, FLAGS_GET_M, FLAGS_GET_Z, getPoint4d_p(), INT32_MAX, LW_FALSE, LW_ON_INTERRUPT, LW_TRUE, lwnotice(), POINT4D::m, POINTARRAY::npoints, ptarray_append_point(), ptarray_construct_empty(), ptarray_free(), POINT4D::x, POINT4D::y, and POINT4D::z.
Referenced by lwline_segmentize2d(), and lwpoly_segmentize2d().