MobilityDB  1.0
Functions
tpoint_distance.c File Reference

Distance functions for temporal points. More...

#include "point/tpoint_distance.h"
#include <assert.h>
#include <float.h>
#include <math.h>
#include <utils/builtins.h>
#include <utils/timestamp.h>
#include "general/period.h"
#include "general/timeops.h"
#include "general/temporaltypes.h"
#include "point/postgis.h"
#include "point/geography_funcs.h"
#include "point/tpoint.h"
#include "point/tpoint_boxops.h"
#include "point/tpoint_spatialrels.h"
#include "point/tpoint_spatialfuncs.h"
Include dependency graph for tpoint_distance.c:

Functions

static double lw_dist2d_point_dist (const LWGEOM *lw1, const LWGEOM *lw2, int mode, long double *fraction)
 Compute the projected point and the distance between the closest point (2D version). More...
 
static double lw_dist3d_point_dist (const LWGEOM *lw1, const LWGEOM *lw2, int mode, long double *fraction)
 Compute the projected point and the distance between the closest point (3D version). More...
 
double lw_dist_sphere_point_dist (const LWGEOM *lw1, const LWGEOM *lw2, int mode, long double *fraction)
 Compute the projected point and the distance between the closest point (geodetic version). More...
 
static bool tpoint_geo_min_dist_at_timestamp (const TInstant *start, const TInstant *end, Datum point, Oid basetypid, Datum *value, TimestampTz *t)
 Returns the value and timestamp at which the a temporal point segment and a point are at the minimum distance. More...
 
static bool tgeompoint_min_dist_at_timestamp (const TInstant *start1, const TInstant *end1, const TInstant *start2, const TInstant *end2, Datum *value, TimestampTz *t)
 Returns the value and timestamp at which the two temporal geometric point segments are at the minimum distance. More...
 
static bool tgeogpoint_min_dist_at_timestamp (const TInstant *start1, const TInstant *end1, const TInstant *start2, const TInstant *end2, Datum *mindist, TimestampTz *t)
 Returns the single timestamp at which the two temporal geographic point segments are at the minimum distance. More...
 
bool tpoint_min_dist_at_timestamp (const TInstant *start1, const TInstant *end1, bool linear1, const TInstant *start2, const TInstant *end2, bool linear2, Datum *value, TimestampTz *t)
 Returns the value and timestamp at which the two temporal point segments are at the minimum distance (dispatch function). More...
 
Temporaldistance_tpoint_geo_internal (const Temporal *temp, Datum geo)
 Returns the temporal distance between the temporal point and the geometry/geography point (distpatch function) More...
 
PGDLLEXPORT Datum distance_geo_tpoint (PG_FUNCTION_ARGS)
 Returns the temporal distance between the geometry/geography point and the temporal point. More...
 
PGDLLEXPORT Datum distance_tpoint_geo (PG_FUNCTION_ARGS)
 Returns the temporal distance between the temporal point and the geometry/geography point. More...
 
Temporaldistance_tpoint_tpoint_internal (const Temporal *temp1, const Temporal *temp2)
 Returns the temporal distance between the two temporal points (dispatch function) More...
 
PGDLLEXPORT Datum distance_tpoint_tpoint (PG_FUNCTION_ARGS)
 Returns the temporal distance between the two temporal points. More...
 
static TInstantNAI_tpointinstset_geo (const TInstantSet *ti, Datum geo, datum_func2 func)
 Returns the nearest approach instant between the temporal instant set point and the geometry/geography. More...
 
static double NAI_tpointseq_step_geo1 (const TSequence *seq, Datum geo, double mindist, datum_func2 func, const TInstant **mininst)
 Returns the new current nearest approach instant between the temporal sequence point with stepwise interpolation and the geometry/geography. More...
 
static TInstantNAI_tpointseq_step_geo (const TSequence *seq, Datum geo, datum_func2 func)
 Returns the nearest approach instant between the temporal sequence point with stepwise interpolation and the geometry/geography. More...
 
static TInstantNAI_tpointseqset_step_geo (const TSequenceSet *ts, Datum geo, datum_func2 func)
 Returns the nearest approach instant between the temporal sequence set point with stepwise interpolation and the geometry/geography. More...
 
static double NAI_tpointseq_linear_geo1 (const TInstant *inst1, const TInstant *inst2, LWGEOM *lwgeom, Datum *closest, TimestampTz *t, bool *tofree)
 Returns the nearest approach instant between the segment of a temporal sequence point with linear interpolation and the geometry. More...
 
static double NAI_tpointseq_linear_geo2 (const TSequence *seq, Datum geo, double mindist, datum_func2 func, Datum *closest, TimestampTz *t, bool *tofree)
 Returns the nearest approach instant between the temporal sequence point with linear interpolation and the geometry. More...
 
static TInstantNAI_tpointseq_linear_geo (const TSequence *seq, Datum geo, datum_func2 func)
 Returns the nearest approach instant between the temporal sequence point with linear interpolation and the geometry. More...
 
static TInstantNAI_tpointseqset_linear_geo (const TSequenceSet *ts, Datum geo, datum_func2 func)
 Returns the nearest approach instant between the temporal sequence set point with linear interpolation and the geometry. More...
 
TInstantNAI_tpoint_geo_internal (FunctionCallInfo fcinfo, const Temporal *temp, GSERIALIZED *gs)
 Returns the nearest approach instant between the temporal point and the geometry (dispatch function) More...
 
PGDLLEXPORT Datum NAI_geo_tpoint (PG_FUNCTION_ARGS)
 Returns the nearest approach instant between the geometry and the temporal point. More...
 
PGDLLEXPORT Datum NAI_tpoint_geo (PG_FUNCTION_ARGS)
 Returns the nearest approach instant between the temporal point and the geometry. More...
 
PGDLLEXPORT Datum NAI_tpoint_tpoint (PG_FUNCTION_ARGS)
 Returns the nearest approach instant between the temporal points. More...
 
Datum NAD_tpoint_geo_internal (FunctionCallInfo fcinfo, Temporal *temp, GSERIALIZED *gs)
 Returns the nearest approach distance between the temporal point and the geometry (internal function) More...
 
PGDLLEXPORT Datum NAD_geo_tpoint (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the geometry and the temporal point. More...
 
PGDLLEXPORT Datum NAD_tpoint_geo (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the temporal point and the geometry. More...
 
Datum NAD_stbox_geo_internal (FunctionCallInfo fcinfo, STBOX *box, GSERIALIZED *gs)
 Returns the nearest approach distance between the spatiotemporal box and the geometry (internal function) More...
 
PGDLLEXPORT Datum NAD_geo_stbox (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the geometry and the spatiotemporal box. More...
 
PGDLLEXPORT Datum NAD_stbox_geo (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the spatiotemporal box and the geometry. More...
 
double NAD_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns the nearest approach distance between the spatio-temporal boxes (internal function) More...
 
PGDLLEXPORT Datum NAD_stbox_stbox (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the spatio-temporal boxes. More...
 
double NAD_tpoint_stbox_internal (const Temporal *temp, STBOX *box)
 Returns the nearest approach distance between the temporal point and the spatio-temporal box (internal function) More...
 
PGDLLEXPORT Datum NAD_stbox_tpoint (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the spatio-temporal box and the temporal point. More...
 
PGDLLEXPORT Datum NAD_tpoint_stbox (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the temporal point and the spatio-temporal box. More...
 
PGDLLEXPORT Datum NAD_tpoint_tpoint (PG_FUNCTION_ARGS)
 Returns the nearest approach distance between the temporal points. More...
 
Datum shortestline_tpoint_geo_internal (Temporal *temp, GSERIALIZED *gs)
 Returns the line connecting the nearest approach point between the temporal instant point and the geometry (internal function) More...
 
PGDLLEXPORT Datum shortestline_geo_tpoint (PG_FUNCTION_ARGS)
 Returns the line connecting the nearest approach point between the geometry and the temporal instant point. More...
 
PGDLLEXPORT Datum shortestline_tpoint_geo (PG_FUNCTION_ARGS)
 Returns the line connecting the nearest approach point between the temporal instant point and the geometry/geography. More...
 
bool shortestline_tpoint_tpoint_internal (const Temporal *temp1, const Temporal *temp2, Datum *line)
 Returns the line connecting the nearest approach point between the temporal points. More...
 
PGDLLEXPORT Datum shortestline_tpoint_tpoint (PG_FUNCTION_ARGS)
 Returns the line connecting the nearest approach point between the temporal points. More...
 

Detailed Description

Distance functions for temporal points.