MobilityDB 1.3
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
tpoint_geom_clip.c File Reference

Fast 2D/3D temporal point clipping against 2D geometries. More...

#include <math.h>
#include "postgres.h"
#include <utils/float.h>
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
#include "meos.h"
#include "meos_internal_geo.h"
#include "temporal/span.h"
#include "temporal/temporal.h"
#include "temporal/temporal_restrict.h"
#include "geo/tgeo.h"
#include "geo/tgeo_spatialfuncs.h"

Data Structures

struct  Edge
 Structure keeping a geometry edge. More...
 
struct  IntersectResult
 Structure keeping an intersection result. More...
 

Macros

#define RTREE_MIN_NUMBER_ELEMS   100
 

Enumerations

enum  EdgeType { EDGE_POINT = 0 , EDGE_LINE , EDGE_POLY }
 Enumeration defining the edge types. More...
 
enum  IntersectType { INTERSECT_NONE = 0 , INTERSECT_POINT , INTERSECT_OVERLAP }
 Enumeration defining the intersection types. More...
 

Functions

static RTreebuild_edge_rtree (const Edge *edges, int nedges, int32_t srid)
 Build an R-tree from edges. More...
 
static void emit_ring_edges (const POINTARRAY *pa, MeosArray *edges, EdgeType etype)
 Add to the dynamic array in the last argument the edges obtained from a ring. More...
 
static void extract_line (const LWLINE *line, MeosArray *edges)
 Add to the dynamic array in the last argument the segments obtained from a line. More...
 
static void extract_mline (const LWMLINE *ml, MeosArray *edges)
 Add to the dynamic array in the last argument the segments obtained from a multiline. More...
 
static void extract_mpoint (const LWMPOINT *mp, MeosArray *edges)
 Add to the dynamic array in the last argument the edges obtained from a multipoint. More...
 
static void extract_mpoly (const LWMPOLY *mp, MeosArray *edges)
 Add to the dynamic array in the last argument the edges obtained from a multipolygon. More...
 
static void extract_point (const LWPOINT *pt, MeosArray *edges)
 Add to the dynamic array in the last argument the edge obtained from a point. More...
 
static void extract_poly (const LWPOLY *poly, MeosArray *edges)
 Add to the dynamic array in the last argument the edges obtained from a polygon. More...
 
static void extract_triangle (const LWTRIANGLE *tri, MeosArray *edges)
 Add to the dynamic array in the last argument the edges obtained from a triangle. More...
 
static int float8_qsort_cmp (const void *a1, const void *a2)
 Comparison function for sorting float8 values. More...
 
static MeosArraygeom_extract_edges (const LWGEOM *geom)
 Return the edges of a geometry in a dynamic array. More...
 
static void geom_extract_edges_iter (const LWGEOM *geom, MeosArray *edges)
 Return the edges of a geometry in a dynamic array (iterator) More...
 
static void intervals_from_lines (const POINT2D *a, const POINT2D *b, Edge **edges, int nedges)
 Compute the intersection intervals of a trajectory segment with an array of linear or point edges. More...
 
static void intervals_from_points (const POINT2D *a, const POINT2D *b, Edge **edges, int nedges)
 Compute the intersection intervals of a trajectory segment with an array of point edges. More...
 
static void intervals_from_polygons (const POINT2D *a, const POINT2D *b, Edge **edges, int nedges, Edge **all_edges, int all_nedges)
 Compute the intersection intervals of a trajectory segment with an array of polygon edges. More...
 
static IntersectResult linesegm_intersect (double ax, double ay, double rx, double ry, double cx, double cy, double dx, double dy)
 Return the intersection value obtained by computing the intersection of a line segment defined by two 2D points intersects an edge. More...
 
static int point_in_polygon (double x, double y, Edge **edges, int nedges)
 Return true if a point is located in a polygon. More...
 
static bool point_inter_points_lines (const POINT2D *a, Edge **edges, int nedges)
 Return true if a trajectory point intersects with an array of point and linear edges. More...
 
static bool point_on_segment (double px, double py, double x1, double y1, double x2, double y2)
 Return true if a point is located on a segment. More...
 
Temporaltpoint_linear_inter_geom (const Temporal *temp, const GSERIALIZED *gs, bool clip)
 Return the temporal intersection/intersects of a temporal geometric point with linear interpolation and a 2D geometry. More...
 
Temporaltpoint_linear_restrict_geom (const Temporal *temp, const GSERIALIZED *gs, bool atfunc)
 Return a temporal geometric point with linear interpolation restricted to a 2D geometry. More...
 
static void tpointinst_clip_edges (const TInstant *inst, Edge **edges, int nedges, RTree *rtree, Edge **cand_edges)
 Clip a 2D/3D trajectory with linear interpolation with respect to a geometry. More...
 
static void tpointseq_clip_edges (const TSequence *seq, Edge **edges, int nedges, RTree *rtree, Edge **cand_edges)
 Clip a 2D/3D trajectory with linear interpolation with respect to a geometry. More...
 

Variables

static MeosArrayevents = NULL
 
static MeosArrayintervals = NULL
 
static MeosArrayperiods = NULL
 
static int * rtree_results = NULL
 

Detailed Description

Fast 2D/3D temporal point clipping against 2D geometries.

Support (multi)point, (multi)line, triangle, (multi)polygons with holes and islands inside holes (recursively), and collection of the above

Note
Avoid processing in GEOS to improve performance