Interpolate one point along a line in 3D.
616{
617 double length, slength, tlength;
620 int nsegs, i;
625
626
628 {
630 }
631
632
633
634
636 {
639 else
641
643 }
644
645
648 tlength = 0;
649 for (i = 0; i < nsegs; i++)
650 {
652 POINT4D *p1ptr = &p1, *p2ptr = &p2;
653
654
655
658
659
661
662
663
664
665
667 {
668 double dseg = (
distance - tlength) / slength;
671 }
672 tlength += slength;
673 }
674
675
676
679}
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)