MobilityDB 1.1

◆ tnumbersegm_intersection()

static bool tnumbersegm_intersection ( const TInstant start1,
const TInstant end1,
const TInstant start2,
const TInstant end2,
TimestampTz t 
)
static

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 true if two segments of two temporal numbers intersect at a timestamp

Parameters
[in]start1,end1Temporal instants defining the first segment
[in]start2,end2Temporal instants defining the second segment
[out]tTimestamp
Precondition
The instants are synchronized, i.e., start1->t = start2->t and end1->t = end2->t