32 #ifndef __TPOINT_SPATIALFUNCS_H__ 33 #define __TPOINT_SPATIALFUNCS_H__ 36 #include <liblwgeom.h> 51 const POINT2D *A,
const POINT2D *B, POINT2D *closest);
53 const POINT3DZ *A,
const POINT3DZ *B, POINT3DZ *closest);
55 const POINT4D *A,
const POINT4D *B, POINT4D *closest,
double *dist);
57 const POINT4D *v1,
const POINT4D *v2,
double f, POINT4D *p);
73 const GSERIALIZED *gs2);
75 const GSERIALIZED *gs);
77 const GSERIALIZED *gs);
96 extern Datum
point_make(
double x,
double y,
double z,
bool hasz,
97 bool geodetic, int32 srid);
116 const TInstant *inst2, Datum value, TimestampTz *t);
123 double ratio,
bool hasz,
bool geodetic);
127 const POINT4D *v1,
const POINT4D *v2,
double f, POINT4D *p);
213 Datum geom,
bool atfunc);
215 const STBOX *box,
bool exc_upper);
221 GSERIALIZED *gsinter,
int *count);
void ensure_has_Z_gs(const GSERIALIZED *gs)
Ensure that the geometry/geography has not Z dimension.
Definition: tpoint_spatialfuncs.c:589
TSequence * tgeogpointseq_to_tgeompointseq(const TSequence *seq)
void ensure_same_srid_stbox(const STBOX *box1, const STBOX *box2)
Ensure that the spatiotemporal boxes have the same SRID.
Definition: tpoint_spatialfuncs.c:451
Structure to represent periods.
Definition: timetypes.h:52
void ensure_same_spatial_dimensionality(int16 flags1, int16 flags2)
Ensure that the temporal values have the same spatial dimensionality.
Definition: tpoint_spatialfuncs.c:503
void ensure_has_not_M_gs(const GSERIALIZED *gs)
Ensure that the geometry/geography has not M dimension.
Definition: tpoint_spatialfuncs.c:637
Datum datum_transform(Datum value, Datum srid)
Call the PostGIS transform function.
Definition: tpoint_spatialfuncs.c:263
Datum point_make(double x, double y, double z, bool hasz, bool geodetic, int32 srid)
Create a point.
Definition: tpoint_spatialfuncs.c:861
bool geopoint_collinear(Datum value1, Datum value2, Datum value3, double ratio, bool hasz, bool geodetic)
Returns true if the three values are collinear.
Definition: tpoint_spatialfuncs.c:1221
void spheroid_init(SPHEROID *s, double a, double b)
Definition: geography_functions.c:848
Datum tpoint_azimuth(PG_FUNCTION_ARGS)
Returns the temporal azimuth of the temporal geometry point.
Definition: tpoint_spatialfuncs.c:3306
Temporal * tpoint_get_coord_internal(const Temporal *temp, char c)
Get the X coordinates of the temporal point (internal function)
Definition: tpoint_spatialfuncs.c:2638
Datum tpoint_trajectory_external(const Temporal *temp)
Returns the trajectory of a temporal point (dispatch function)
Definition: tpoint_spatialfuncs.c:1526
Datum tpoint_trajectory(PG_FUNCTION_ARGS)
Returns the trajectory of a temporal point.
Definition: tpoint_spatialfuncs.c:1546
void ensure_same_spatial_dimensionality_stbox_gs(const STBOX *box1, const GSERIALIZED *gs)
Ensure that the spatiotemporal boxes have the same spatial dimensionality.
Definition: tpoint_spatialfuncs.c:548
int tpointinstset_srid(const TInstantSet *ti)
Returns the SRID of a temporal instant set point.
Definition: tpoint_spatialfuncs.c:1599
void ensure_same_srid_stbox_gs(const STBOX *box, const GSERIALIZED *gs)
Ensure that the temporal point and the geometry/geography have the same SRID.
Definition: tpoint_spatialfuncs.c:477
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
Datum tpointseq_make_trajectory(const TInstant **instants, int count, bool linear)
Compute the trajectory of an array of instants.
Definition: tpoint_spatialfuncs.c:1358
int tpointseqset_srid(const TSequenceSet *ts)
Returns the SRID of a temporal sequence set point.
Definition: tpoint_spatialfuncs.c:1619
Datum tpoint_minus_geometry(PG_FUNCTION_ARGS)
Restrict the temporal point to the complement of the geometry.
Definition: tpoint_spatialfuncs.c:5065
int tpointseq_srid(const TSequence *seq)
Returns the SRID of a temporal sequence point.
Definition: tpoint_spatialfuncs.c:1609
datum_func2 get_pt_distance_fn(int16 flags)
Select the appropriate distance function.
Definition: tpoint_spatialfuncs.c:292
TInstant * tpointinst_transform(const TInstant *inst, Datum srid)
Transform a temporal instant point into another spatial reference system.
Definition: tpoint_spatialfuncs.c:1837
void ensure_same_geodetic(int16 flags1, int16 flags2)
Ensure that the spatiotemporal argument have the same type of coordinates, either planar or geodetic...
Definition: tpoint_spatialfuncs.c:411
Datum tpointseq_twcentroid(const TSequence *seq)
Returns the time-weighed centroid of the temporal geometry point of sequence type.
Definition: tpoint_spatialfuncs.c:3040
void datum_get_point4d(POINT4D *p, Datum value)
Returns a 4D point from the datum.
Definition: tpoint_spatialfuncs.c:183
Structure to represent spatiotemporal boxes.
Definition: stbox.h:51
Datum tgeogpoint_to_tgeompoint(PG_FUNCTION_ARGS)
Converts a temporal geography point to a temporal geometry point.
Definition: tpoint_spatialfuncs.c:2194
void store_fcinfo(FunctionCallInfo fcinfo)
Store in the cache the fcinfo of the external function.
Definition: tpoint_spatialfuncs.c:92
GSERIALIZED * geo_serialize(LWGEOM *geom)
Serialize a geometry/geography.
Definition: tpoint_spatialfuncs.c:250
Datum tpointseqset_trajectory(const TSequenceSet *ts)
Returns the trajectory of a temporal point with sequence set type from the precomputed trajectories o...
Definition: tpoint_spatialfuncs.c:1419
Datum tpoint_set_srid(PG_FUNCTION_ARGS)
Set the SRID of a temporal point.
Definition: tpoint_spatialfuncs.c:1773
void ensure_has_Z(int16 flags)
Ensure that the temporal value has Z dimension.
Definition: tpoint_spatialfuncs.c:565
Datum tgeompoint_twcentroid(PG_FUNCTION_ARGS)
void ensure_has_M_gs(const GSERIALIZED *gs)
Ensure that the geometry/geography has M dimension.
Definition: tpoint_spatialfuncs.c:621
long double closest_point_on_segment_sphere(const POINT4D *p, const POINT4D *A, const POINT4D *B, POINT4D *closest, double *dist)
Returns a float between 0 and 1 representing the location of the closest point on the geography segme...
Definition: tpoint_spatialfuncs.c:816
void ensure_same_dimensionality_tpoint_gs(const Temporal *temp, const GSERIALIZED *gs)
Ensure that the temporal point and the geometry/geography have the same dimensionality.
Definition: tpoint_spatialfuncs.c:532
bool tgeompointseq_min_bearing_at_timestamp(const TInstant *start1, const TInstant *end1, const TInstant *start2, const TInstant *end2, TimestampTz *t)
POINT2D datum_get_point2d(Datum value)
Returns a 2D point from the datum.
Definition: tpoint_spatialfuncs.c:122
int tpoint_srid_internal(const Temporal *t)
Returns the SRID of a temporal point (dispatch function)
Definition: tpoint_spatialfuncs.c:1629
const POINT2D * gs_get_point2d_p(GSERIALIZED *gs)
Returns a 2D point from the serialized geometry.
Definition: tpoint_spatialfuncs.c:143
Functions for temporal points.
FunctionCallInfo fetch_fcinfo()
Fetch from the cache the fcinfo of the external function.
Definition: tpoint_spatialfuncs.c:82
Datum geog_distance(Datum geog1, Datum geog2)
Returns the distance between the two geographies.
Definition: tpoint_spatialfuncs.c:333
Basic functions for temporal types of any subtype.
Datum tpoint_at_stbox(PG_FUNCTION_ARGS)
Restricts the temporal value to the spatiotemporal box.
Definition: tpoint_spatialfuncs.c:5308
POINT3DZ datum_get_point3dz(Datum value)
Returns a 3DZ point from the datum.
Definition: tpoint_spatialfuncs.c:152
void ensure_not_geodetic(int16 flags)
Ensure that the spatiotemporal argument has planar coordinates.
Definition: tpoint_spatialfuncs.c:399
Datum tpointinstset_twcentroid(const TInstantSet *ti)
Returns the time-weighed centroid of the temporal geometry point of instant set type.
Definition: tpoint_spatialfuncs.c:2998
const POINT3DZ * datum_get_point3dz_p(Datum value)
Returns a pointer to a 3DZ point from the datum.
Definition: tpoint_spatialfuncs.c:163
Datum tpoint_trajectory_internal(const Temporal *temp)
Returns the trajectory of a temporal point (dispatch function)
Definition: tpoint_spatialfuncs.c:1496
Datum tpoint_twcentroid_internal(Temporal *temp)
Returns the time-weighed centroid of the temporal geometry point (dispatch function) ...
Definition: tpoint_spatialfuncs.c:3145
bool tgeogpointseq_intersection(const TInstant *start1, const TInstant *end1, const TInstant *start2, const TInstant *end2, TimestampTz *t)
Returns true if the two segments of the temporal geographic point values intersect at the timestamp...
Definition: tpoint_spatialfuncs.c:1167
void interpolate_point4d_sphere(const POINT3D *p1, const POINT3D *p2, const POINT4D *v1, const POINT4D *v2, double f, POINT4D *p)
Find interpolation point p between geography points p1 and p2 so that the len(p1,p) == len(p1...
Definition: geography_functions.c:514
Datum tpointseqset_twcentroid(const TSequenceSet *ts)
Returns the time-weighed centroid of the temporal geometry point of sequence set type.
Definition: tpoint_spatialfuncs.c:3086
datum_func2 get_distance_fn(int16 flags)
Select the appropriate distance function.
Definition: tpoint_spatialfuncs.c:277
long double closest_point2d_on_segment_ratio(const POINT2D *p, const POINT2D *A, const POINT2D *B, POINT2D *closest)
Returns a long double between 0 and 1 representing the location of the closest point on the segment t...
Definition: tpoint_spatialfuncs.c:711
void ensure_not_geodetic_gs(const GSERIALIZED *gs)
Ensure that the spatial argument has planar coordinates.
Definition: tpoint_spatialfuncs.c:384
void geography_interpolate_point4d(const POINT3D *p1, const POINT3D *p2, const POINT4D *v1, const POINT4D *v2, double f, POINT4D *p)
void ensure_point_type(const GSERIALIZED *gs)
Ensure that the geometry/geography is a point.
Definition: tpoint_spatialfuncs.c:653
LWLINE * geopoint_lwline(Datum value1, Datum value2)
Compute the trajectory from two geometry points.
Definition: tpoint_spatialfuncs.c:1313
void ensure_has_not_Z(int16 flags)
Datum tpoint_minus_stbox(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the spatiotemporal box.
Definition: tpoint_spatialfuncs.c:5318
Datum tpointseq_trajectory(const TSequence *seq)
Returns the precomputed trajectory of a temporal sequence point.
Definition: tpoint_spatialfuncs.c:1391
void ensure_same_geodetic_gs(const GSERIALIZED *gs1, const GSERIALIZED *gs2)
Ensure that the spatiotemporal argument have the same type of coordinates, either planar or geodetic...
Definition: tpoint_spatialfuncs.c:424
Structure to represent temporal values of sequence set subtype.
Definition: temporal.h:293
long double closest_point3dz_on_segment_ratio(const POINT3DZ *p, const POINT3DZ *A, const POINT3DZ *B, POINT3DZ *closest)
Returns a float between 0 and 1 representing the location of the closest point on the segment to the ...
Definition: tpoint_spatialfuncs.c:761
Temporal * tpoint_set_srid_internal(Temporal *temp, int32 srid)
Set the SRID of a temporal point (dispatch function)
Definition: tpoint_spatialfuncs.c:1752
Datum tpoint_speed(PG_FUNCTION_ARGS)
Returns the speed of the temporal point.
Definition: tpoint_spatialfuncs.c:2969
Datum tpointseq_trajectory_copy(const TSequence *seq)
Copy the precomputed trajectory of a temporal sequence point.
Definition: tpoint_spatialfuncs.c:1402
TInstantSet ** tpointinstset_make_simple1(const TInstantSet *ti, int *count)
Split a temporal point into an array of non self-intersecting pieces.
Definition: tpoint_spatialfuncs.c:4132
Datum pt_distance2d(Datum geom1, Datum geom2)
Returns the 2D distance between the two geometric points.
Definition: tpoint_spatialfuncs.c:343
Datum tpoint_cumulative_length(PG_FUNCTION_ARGS)
Returns the cumulative length traversed by the temporal point.
Definition: tpoint_spatialfuncs.c:2884
Datum tpointinstset_trajectory(const TInstantSet *ti)
Compute the trajectory of a temporal instant set point.
Definition: tpoint_spatialfuncs.c:1283
Structure to represent temporal values of instant set subtype.
Definition: temporal.h:266
Datum geo_set_precision(PG_FUNCTION_ARGS)
Sets the precision of the coordinates of the geometry.
Definition: tpoint_spatialfuncs.c:2564
bool datum_point_eq(Datum geopoint1, Datum geopoint2)
Returns true if the two points are equal.
Definition: tpoint_spatialfuncs.c:211
Datum tgeompoint_to_tgeogpoint(PG_FUNCTION_ARGS)
Converts a temporal geometry point to a temporal geography point.
Definition: tpoint_spatialfuncs.c:2181
Datum tpoint_get_z(PG_FUNCTION_ARGS)
Get the Z coordinates of the temporal point.
Definition: tpoint_spatialfuncs.c:2698
Datum tpoint_get_x(PG_FUNCTION_ARGS)
Get the X coordinates of the temporal point.
Definition: tpoint_spatialfuncs.c:2672
void ensure_non_empty(const GSERIALIZED *gs)
Ensure that the geometry/geography is not empty.
Definition: tpoint_spatialfuncs.c:665
TSequence ** tpointseq_at_geometry(const TSequence *seq, Datum geo, int *count)
Restricts the temporal sequence point to the geometry.
Definition: tpoint_spatialfuncs.c:4826
Datum geom_distance3d(Datum geom1, Datum geom2)
Returns the 3D distance between the two geometries.
Definition: tpoint_spatialfuncs.c:320
Datum(* datum_func2)(Datum, Datum)
Definition: temporal.h:358
TSequence ** tpointseq_make_simple1(const TSequence *seq, int *count)
Split a temporal point into an array of non self-intersecting pieces.
Definition: tpoint_spatialfuncs.c:4248
Datum geom_bearing(Datum point1, Datum point2)
Computes the bearing between two geometric points.
Definition: tpoint_spatialfuncs.c:3356
void tpoint_trajectory_free(const Temporal *temp, Datum traj)
Free the trajectory after a call to tpoint_trajectory_internal.
Definition: tpoint_spatialfuncs.c:1515
LWGEOM * lwpointarr_make_trajectory(LWGEOM **lwpoints, int count, bool linear)
Compute a trajectory from a set of points.
Definition: tpoint_spatialfuncs.c:1261
const POINT3DZ * gs_get_point3dz_p(GSERIALIZED *gs)
Returns a 3DZ point from the serialized geometry.
Definition: tpoint_spatialfuncs.c:173
Datum tpoint_at_geometry(PG_FUNCTION_ARGS)
Restricts the temporal point to the geometry.
Definition: tpoint_spatialfuncs.c:5055
Period ** tpointseq_interperiods(const TSequence *seq, GSERIALIZED *gsinter, int *count)
Get the periods at which the temporal sequence point with linear interpolation intersects the geometr...
Definition: tpoint_spatialfuncs.c:4601
bool tpointseq_intersection_value(const TInstant *inst1, const TInstant *inst2, Datum value, TimestampTz *t)
Returns true if the segment of the temporal point value intersects the base value at the timestamp...
Definition: tpoint_spatialfuncs.c:1020
Datum pt_distance3d(Datum geom1, Datum geom2)
Returns the 3D distance between the two geometric points.
Definition: tpoint_spatialfuncs.c:354
bool tgeompointseq_intersection(const TInstant *start1, const TInstant *end1, const TInstant *start2, const TInstant *end2, TimestampTz *t)
Returns true if the two segments of the temporal geometric point values intersect at the timestamp...
Definition: tpoint_spatialfuncs.c:1059
void ensure_same_srid_tpoint_stbox(const Temporal *temp, const STBOX *box)
Ensure that the temporal point and the spatiotemporal boxes have the same SRID.
Definition: tpoint_spatialfuncs.c:464
void ensure_same_dimensionality_gs(const GSERIALIZED *gs1, const GSERIALIZED *gs2)
Ensure that the geometries/geographies have the same dimensionality.
Definition: tpoint_spatialfuncs.c:516
TSequenceSet * tgeogpoints_to_tgeompoints(const TSequenceSet *ts)
TInstant * tgeogpointinst_to_tgeompointinst(const TInstant *inst)
Datum geom_distance2d(Datum geom1, Datum geom2)
Returns the 2D distance between the two geometries.
Definition: tpoint_spatialfuncs.c:307
long double geoseg_locate_point(Datum start, Datum end, Datum point, double *dist)
Returns a float between 0 and 1 representing the location of the closest point on the geometry segmen...
Definition: tpoint_spatialfuncs.c:931
void ensure_has_not_Z_gs(const GSERIALIZED *gs)
Ensure that the geometry/geography has not Z dimension.
Definition: tpoint_spatialfuncs.c:605
int tpointinst_srid(const TInstant *inst)
Returns the SRID of a temporal instant point.
Definition: tpoint_spatialfuncs.c:1589
Datum tpoint_srid(PG_FUNCTION_ARGS)
Returns the SRID of a temporal point.
Definition: tpoint_spatialfuncs.c:1649
Datum tpoint_length(PG_FUNCTION_ARGS)
Returns the length traversed by the temporal sequence (set) point.
Definition: tpoint_spatialfuncs.c:2749
Temporal * tpoint_restrict_geometry_internal(const Temporal *temp, Datum geom, bool atfunc)
Restricts the temporal point to the (complement of the) geometry (dispatch function) ...
Definition: tpoint_spatialfuncs.c:4985
const POINT2D * datum_get_point2d_p(Datum value)
Returns a pointer to a 2D point from the datum.
Definition: tpoint_spatialfuncs.c:133
Datum tpoint_get_y(PG_FUNCTION_ARGS)
Get the Y coordinates of the temporal point.
Definition: tpoint_spatialfuncs.c:2685
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
Datum tpoint_set_precision(PG_FUNCTION_ARGS)
Set the precision of the coordinates of the temporal point to the number of decimal places...
Definition: tpoint_spatialfuncs.c:2579
Temporal * tpoint_at_stbox_internal(const Temporal *temp, const STBOX *box, bool exc_upper)
Restrict the temporal point to the spatiotemporal box.
Definition: tpoint_spatialfuncs.c:5162
void ensure_same_srid(int32_t srid1, int32_t srid2)
Ensure that the two spatial "objects" have the same SRID.
Definition: tpoint_spatialfuncs.c:439
Datum geog_bearing(Datum point1, Datum point2)
Computes the bearing between two geographic points.
Definition: tpoint_spatialfuncs.c:3388
void ensure_spatial_validity(const Temporal *temp1, const Temporal *temp2)
Ensure that the spatial constraints required for operating on two temporal geometries are satisfied...
Definition: tpoint_spatialfuncs.c:370
void ensure_same_dimensionality(int16 flags1, int16 flags2)
Ensure that the temporal values have the same dimensionality.
Definition: tpoint_spatialfuncs.c:489
Datum geoseg_interpolate_point(Datum value1, Datum value2, long double ratio)
Returns a point interpolated from the geometry/geography segment with respect to the fraction of its ...
Definition: tpoint_spatialfuncs.c:881
Datum geopoint_line(Datum value1, Datum value2)
Compute the trajectory from two points.
Definition: tpoint_spatialfuncs.c:1336
Structure to represent temporal values of instant subtype.
Definition: temporal.h:253