235{
238 double distance = PG_GETARG_FLOAT8(1);
242
243 if (distance < 0 || distance > 1)
244 {
245 elog(ERROR, "line_interpolate_point: 2nd arg isn't within [0,1]");
246 PG_RETURN_NULL();
247 }
248
250 {
251 elog(ERROR, "line_interpolate_point: 1st arg isn't a line");
252 PG_RETURN_NULL();
253 }
254
257
259
261 PG_FREE_IF_COPY(gser, 0);
262
265
266 PG_RETURN_POINTER(result);
267}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
LWPOINT * lwline_interpolate_point_3d(const LWLINE *line, double distance)
Interpolate one point along a line in 3D.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void lwpoint_free(LWPOINT *pt)
void lwgeom_free(LWGEOM *geom)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
static double distance(double x1, double y1, double x2, double y2)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)