MobilityDB 1.3
Loading...
Searching...
No Matches
Functions
trgeo_distance.c File Reference

Distance functions for temporal rigid geometries. More...

#include "rgeo/trgeo_distance.h"
#include <assert.h>
#include <c.h>
#include <float.h>
#include <math.h>
#include <postgres.h>
#include <stdio.h>
#include <utils/timestamp.h>
#include <liblwgeom.h>
#include <measures.h>
#include <measures3d.h>
#include <meos.h>
#include <meos_rgeo.h>
#include <meos_internal.h>
#include "temporal/meos_catalog.h"
#include "temporal/temporal.h"
#include "temporal/type_util.h"
#include "geo/postgis_funcs.h"
#include "geo/tgeo.h"
#include "geo/tgeo_spatialfuncs.h"
#include "pose/pose.h"
#include "rgeo/trgeo_all.h"
#include "rgeo/trgeo_vclip.h"

Functions

static void append_cfp_elem (cfp_array *cfpa, cfp_elem cfp)
 
static void append_tdist_elem (tdist_array *tda, tdist_elem td)
 
static cfp_elem cfp_make (LWGEOM *geom_1, LWGEOM *geom_2, Pose *pose_1, Pose *pose_2, uint32_t cf_1, uint32_t cf_2, TimestampTz t, bool store)
 
static cfp_elem cfp_make_zero (LWGEOM *geom_1, LWGEOM *geom_2, Pose *pose_1, Pose *pose_2, TimestampTz t, bool store)
 
static double compute_angle (POINT4D p, POINT4D vs, POINT4D ve)
 Computes the signed length of the cross product of the vectors (vs, p) and (vs, ve) More...
 
static double compute_dist2 (POINT4D p, POINT4D vs, POINT4D ve)
 Computes the distance between point p and segment v(vs, ve) More...
 
static void compute_dist_tpoly_point (cfp_elem *cfp, tdist_array *tda)
 
static void compute_dist_tpoly_poly (cfp_elem *cfp, tdist_array *tda)
 
static double compute_s (POINT4D p, POINT4D vs, POINT4D ve)
 Computes the relative position of point on segment v(vs, ve) More...
 
static void compute_turnpoints_tpoly_point (cfp_elem *cfp_s, cfp_elem *cfp_e, tdist_array *tda)
 
TInstantdist2d_trgeoinst_geo (const TInstant *inst, const GSERIALIZED *gs)
 
TSequencedist2d_trgeoseq_geo (const TSequence *seq, const GSERIALIZED *gs)
 
TSequencedist2d_trgeoseq_point (const TSequence *seq, const GSERIALIZED *gs)
 
TSequencedist2d_trgeoseq_poly (const TSequence *seq, const GSERIALIZED *gs)
 
TSequenceSetdist2d_trgeoseqset_geo (const TSequenceSet *ss, const GSERIALIZED *gs)
 
Temporaldistance_trgeo_geo (const Temporal *temp, const GSERIALIZED *gs)
 Return the temporal distance between a temporal rigid geometry and a geometry/geography point. More...
 
Temporaldistance_trgeo_tpoint (const Temporal *temp1 UNUSED, const Temporal *temp2 UNUSED)
 Return the temporal distance between two temporal rigid geometries. More...
 
Temporaldistance_trgeo_trgeo (const Temporal *temp1 UNUSED, const Temporal *temp2 UNUSED)
 Return the temporal distance between two temporal rigid geometries. More...
 
static int edge_vertex_tpoly_point (LWPOLY *poly, Pose *pose_start, Pose *pose_end, LWPOINT *point, uint32_t *poly_feature, int *direction, double *ratio)
 Find the next change in closest feature. More...
 
static int edge_vertex_tpoly_poly (LWPOLY *poly1, Pose *pose_start, Pose *pose_end, LWPOLY *poly2, uint32_t *poly1_feature, uint32_t *poly2_feature, int *dir1, int *dir2 UNUSED, double *ratio)
 Find the next change in closest feature. More...
 
static double f_parallel_edges_tpoly_poly (LWPOLY *poly1, Pose *poly_pose_s, Pose *poly_pose_e, LWPOLY *poly2, uint32_t poly1_v, uint32_t poly2_v, double ratio)
 
static double f_poly_tpoly (POINT4D p, POINT4D q, POINT4D r, Pose *poly_pose_s, Pose *poly_pose_e, double ratio, bool solution_kind)
 
static double f_tpoint_poly (POINT4D p, POINT4D q, POINT4D r, Pose *poly_pose_s, Pose *poly_pose_e, double ratio, bool solution_kind)
 
static double f_tpoly_poly (POINT4D p, POINT4D q, POINT4D r, Pose *poly_pose_s, Pose *poly_pose_e, double ratio, bool solution_kind)
 
static double f_turnpoints_v_e_tpoint_poly (POINT4D p, POINT4D q, POINT4D r, Pose *poly_pose_s, Pose *poly_pose_e, double ratio)
 
static double f_turnpoints_v_v_tpoint_poly (POINT4D p, POINT4D q, Pose *poly_pose_s, Pose *poly_pose_e, double ratio)
 
static void free_cfp_array (cfp_array *cfpa)
 
static void free_tdist_array (tdist_array *tda)
 
static void init_cfp_array (cfp_array *cfpa, size_t n)
 
static void init_tdist_array (tdist_array *tda, size_t n)
 
double nad_trgeo_geo (const Temporal *temp, const GSERIALIZED *gs)
 Return the nearest approach distance between a temporal rigid geometry and a geometry. More...
 
double nad_trgeo_stbox (const Temporal *temp, const STBox *box)
 Return the nearest approach distance between a temporal rigid geometry and a spatiotemporal box. More...
 
double nad_trgeo_tpoint (const Temporal *temp1, const Temporal *temp2)
 Return the nearest approach distance between two temporal rigid geometries. More...
 
double nad_trgeo_trgeo (const Temporal *temp1, const Temporal *temp2)
 Return the nearest approach distance between two temporal rigid geometries. More...
 
TInstantnai_trgeo_geo (const Temporal *temp, const GSERIALIZED *gs)
 Return the nearest approach instant between a temporal rigid geometry and a geometry @sqlfn nearestApproachInstant() More...
 
TInstantnai_trgeo_tpoint (const Temporal *temp1, const Temporal *temp2)
 Return the nearest approach instant between a temporal rigid geometry and a temporal point @sqlfn nearestApproachInstant() More...
 
TInstantnai_trgeo_trgeo (const Temporal *temp1, const Temporal *temp2)
 Return the nearest approach instant between two temporal rigid geometries @sqlfn nearestApproachInstant() More...
 
static void pose_diff_2d (Pose *pose1, Pose *pose2, double *x, double *y, double *theta)
 
static void pose_interpolate_2d (Pose *pose1, Pose *pose2, double ratio, double *x, double *y, double *theta)
 
GSERIALIZEDshortestline_trgeo_geo (const Temporal *temp, const GSERIALIZED *gs)
 Return the line connecting the nearest approach point between a temporal rigid geometry and a geometry @sqlfn shortestLine() More...
 
GSERIALIZEDshortestline_trgeo_tpoint (const Temporal *temp1, const Temporal *temp2)
 Return the line connecting the nearest approach point between a temporal rigid geometry and a temporal geometry point @sqlfn shortestLine() More...
 
GSERIALIZEDshortestline_trgeo_trgeo (const Temporal *temp1, const Temporal *temp2)
 Return the line connecting the nearest approach point between two temporal rigid geometries @sqlfn shortestLine() More...
 
static double solve_angle_0_poly_tpoly (LWPOLY *poly1 UNUSED, LWPOLY *poly2 UNUSED, Pose *poly_pose_s UNUSED, Pose *poly_pose_e UNUSED, uint32_t poly1_v UNUSED, uint32_t poly2_v UNUSED, double ratio UNUSED)
 
static double solve_angle_0_tpoly_point (LWPOLY *poly UNUSED, LWPOINT *point UNUSED, Pose *poly_pose_s UNUSED, Pose *poly_pose_e UNUSED, uint32_t poly_v UNUSED, double r_prev UNUSED)
 
static double solve_parallel_edges_tpoly_poly (LWPOLY *poly1, Pose *poly_pose_s, Pose *poly_pose_e, LWPOLY *poly2, uint32_t poly1_v, uint32_t poly2_v, double prev_result)
 
static double solve_s_poly_tpoly (LWPOLY *poly1, LWPOLY *poly2, Pose *poly_pose_s, Pose *poly_pose_e, uint32_t poly1_v, uint32_t poly2_v, double prev_result, bool solution_kind)
 
static double solve_s_tpoly_point (LWPOLY *poly, LWPOINT *point, Pose *poly_pose_s, Pose *poly_pose_e, uint32_t poly_v, double prev_result, bool solution_kind)
 
static double solve_s_tpoly_poly (LWPOLY *poly1, Pose *poly_pose_s, Pose *poly_pose_e, LWPOLY *poly2, uint32_t poly1_v, uint32_t poly2_v, double prev_result, bool solution_kind)
 
static tdist_elem tdist_make (double dist, TimestampTz t)
 
static uint32_t uint_mod_add (uint32_t i, uint32_t j, uint32_t n)
 
static uint32_t uint_mod_sub (uint32_t i, uint32_t j, uint32_t n)
 
static int vertex_edge_tpoly_poly (LWPOLY *poly1, Pose *pose_start, Pose *pose_end, LWPOLY *poly2, uint32_t *poly1_feature, uint32_t *poly2_feature, int *dir1 UNUSED, int *dir2, double *ratio)
 Find the next change in closest feature. More...
 
static int vertex_vertex_tpoly_point (LWPOLY *poly, Pose *pose_start, Pose *pose_end, LWPOINT *point, uint32_t *poly_feature, int *direction, double *ratio)
 Find the next change in closest feature. More...
 
static int vertex_vertex_tpoly_poly (LWPOLY *poly1, Pose *pose_start, Pose *pose_end, LWPOLY *poly2, uint32_t *poly1_feature, uint32_t *poly2_feature, int *dir1, int *dir2, double *ratio)
 Find the next change in closest feature. More...
 

Detailed Description

Distance functions for temporal rigid geometries.