Add a measure dimension to a line, interpolating linearly from the start to the end value.
Add a measure dimension to a line, interpolating linearly from the start to the end value.
Definition at line 388 of file lwline.c.
391 int hasm = 0, hasz = 0;
394 double length_so_far = 0.0;
395 double m_range = m_end - m_start;
402 lwerror(
"lwline_construct_from_lwline: only line types supported");
419 for ( i = 0; i < npoints; i++ )
430 m = m_start + m_range * length_so_far / length;
432 else if ( length == 0.0 && npoints > 1 )
433 m = m_start + m_range * i / (npoints-1);
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
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)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
References distance2d_pt_pt(), LWLINE::flags, FLAGS_GET_Z, getPoint3dz_p(), LINETYPE, lwerror(), lwline_construct(), POINT4D::m, POINTARRAY::npoints, LWLINE::points, ptarray_construct(), ptarray_length_2d(), ptarray_set_point4d(), LWLINE::srid, LWLINE::type, POINT2D::x, POINT3DZ::x, POINT4D::x, POINT2D::y, POINT3DZ::y, POINT4D::y, POINT3DZ::z, and POINT4D::z.
Referenced by lwline_locate_along(), lwmline_measured_from_lwmline(), and ST_AddMeasure().