MobilityDB 1.3
Loading...
Searching...
No Matches

◆ tnumbersegm_intersection()

int tnumbersegm_intersection ( Datum  start1,
Datum  end1,
Datum  start2,
Datum  end2,
meosType  basetype,
TimestampTz  lower,
TimestampTz  upper,
TimestampTz t1,
TimestampTz t2 
)

Compute the intersection, if any, of two segments of temporal sequences.

These functions suppose that the instants are synchronized, i.e., start1->t = start2->t and end1->t = end2->t. The functions return true if there is an intersection at the middle of the segments, i.e., they return false if they intersect at a bound. If they return true, they also return in the output parameter t the intersection timestamp. The two values taken by the segments at the intersection timestamp t are equal up to the floating point precision. For the temporal point case we cannot use the PostGIS functions lw_dist2d_seg_seg and lw_dist3d_seg_seg since they do not take time into consideration and would return, e.g., that the two segments [Point(1 1)@t1, Point(3 3)@t2] and [Point(3 3)@t1, Point(1 1)@t2] intersect at Point(1 1), instead of Point(2 2). These functions are used to add intermediate points when lifting operators, in particular for temporal comparisons such as tfloat <comp> tfloat where <comp> is <, <=, ... since the comparison changes its value before/at/after the intersection point.

Return 1 or 2 if two temporal number segments intersect during the the period defined by the output timestamps, return 0 otherwise

Parameters
[in]start1,end1Values defining the first segment
[in]start2,end2Values defining the second segment
[in]basetypeBase type of the values
[in]lower,upperTimestamps defining the segments
[out]t1,t2Timestamps defining the resulting period, may be equal
Note
Only the intersection inside the segments is considered