Interpolate one point along a line in 3D.
603{
604 double length, slength, tlength;
607 int nsegs, i;
612
613
615 {
617 }
618
619
620
621
623 {
626 else
628
630 }
631
632
635 tlength = 0;
636 for (i = 0; i < nsegs; i++)
637 {
639 POINT4D *p1ptr = &p1, *p2ptr = &p2;
640
641
642
645
646
648
649
650
651
652
654 {
655 double dseg = (
distance - tlength) / slength;
658 }
659 tlength += slength;
660 }
661
662
663
666}
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...
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
double distance3d_pt_pt(const POINT3D *p1, const POINT3D *p2)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
LWPOINT * lwpoint_construct_empty(int32_t srid, char hasz, char hasm)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
LWPOINT * lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
int lwline_is_empty(const LWLINE *line)
double ptarray_length(const POINTARRAY *pts)
Find the 3d/2d length of the given POINTARRAY (depending on its dimensionality)
static double distance(double x1, double y1, double x2, double y2)