Interpolate one or more points along a line.
548 double length_fraction_increment = length_fraction;
549 double length_fraction_consumed = 0;
564 if ( length_fraction == 0.0 || length_fraction == 1.0 )
566 if ( length_fraction == 0.0 )
579 points_to_interpolate = repeat ? (
uint32_t) floor(1 / length_fraction) : 1;
583 for ( i = 0; i < ipa->
npoints - 1 && points_found < points_to_interpolate; i++ )
592 while ( length_fraction < length_fraction_consumed + segment_length_frac && points_found < points_to_interpolate )
597 double segment_fraction = (length_fraction - length_fraction_consumed) / segment_length_frac;
600 length_fraction += length_fraction_increment;
603 length_fraction_consumed += segment_length_frac;
610 if (points_found < points_to_interpolate) {
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
void interpolate_point4d(const POINT4D *A, const POINT4D *B, POINT4D *I, double F)
Find interpolation point I between point A and point B so that the len(AI) == len(AB)*F and I falls o...
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
int lwline_is_empty(const LWLINE *line)