Interpolate one point along a line in 3D.
606{
607 double length, slength, tlength;
610 int nsegs, i;
615
616
618 {
620 }
621
622
623
624
626 {
629 else
631
633 }
634
635
638 tlength = 0;
639 for (i = 0; i < nsegs; i++)
640 {
642 POINT4D *p1ptr = &p1, *p2ptr = &p2;
643
644
645
648
649
651
652
653
654
655
657 {
658 double dseg = (
distance - tlength) / slength;
661 }
662 tlength += slength;
663 }
664
665
666
669}
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)