MobilityDB 1.3
Loading...
Searching...
No Matches
Macros | Functions
tbox.c File Reference

Functions for temporal bounding boxes. More...

#include "temporal/tbox.h"
#include <assert.h>
#include <limits.h>
#include "utils/timestamp.h"
#include <meos.h>
#include <meos_internal.h>
#include "temporal/meos_catalog.h"
#include "temporal/postgres_types.h"
#include "temporal/set.h"
#include "temporal/span.h"
#include "temporal/spanset.h"
#include "temporal/temporal.h"
#include "temporal/tnumber_mathfuncs.h"
#include "temporal/type_parser.h"
#include "temporal/type_util.h"

Macros

#define TBOX_MAXLEN   128
 Buffer size for input and output of TBox values. More...
 

Functions

bool adjacent_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if two temporal boxes are adjacent. More...
 
bool after_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is after the second one. More...
 
bool before_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is before the second one. More...
 
bool contained_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is contained in the second one. More...
 
bool contains_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box contains the second one. More...
 
bool ensure_same_dimensionality_tbox (const TBox *box1, const TBox *box2)
 Ensure that a temporal boxes have the same dimensionality. More...
 
static bool ensure_valid_tbox_tbox (const TBox *box1, const TBox *box2, bool *hasx, bool *hast)
 Return the ouput variables initialized with the flag values of the boxes. More...
 
void float_set_tbox (double d, TBox *box)
 Return in the last argument a temporal box constructed from a float. More...
 
TBoxfloat_timestamptz_to_tbox (double d, TimestampTz t)
 Return a temporal box from a float and a timestamptz. More...
 
TBoxfloat_to_tbox (double d)
 Convert a float into a temporal box. More...
 
TBoxfloat_tstzspan_to_tbox (double d, const Span *s)
 Return a temporal box from a float and a timestamptz span. More...
 
void int_set_tbox (int i, TBox *box)
 Return in the last argument a temporal box constructed from an integer. More...
 
TBoxint_timestamptz_to_tbox (int i, TimestampTz t)
 Return a temporal box from an integer and a timestamptz. More...
 
TBoxint_to_tbox (int i)
 Convert an integer into a temporal box. More...
 
TBoxint_tstzspan_to_tbox (int i, const Span *s)
 Return a temporal box from an integer and a timestamptz span. More...
 
bool inter_tbox_tbox (const TBox *box1, const TBox *box2, TBox *result)
 Return in the last argument the intersection of two temporal boxes. More...
 
TBoxintersection_tbox_tbox (const TBox *box1, const TBox *box2)
 Return the intersection of two temporal boxes. More...
 
bool left_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is to the left of the second one. More...
 
void number_set_tbox (Datum value, meosType basetype, TBox *box)
 Return in the last argument a temporal box constructed from a number. More...
 
TBoxnumber_tbox (Datum value, meosType basetype)
 Convert a number into a temporal box. More...
 
TBoxnumber_timestamptz_to_tbox (Datum value, meosType basetype, TimestampTz t)
 Return a temporal box from an integer and a timestamptz. More...
 
TBoxnumber_tstzspan_to_tbox (Datum value, meosType basetype, const Span *s)
 Return a temporal box from an integer and a timestamptz span. More...
 
void numset_set_tbox (const Set *s, TBox *box)
 Return in the last argument a temporal box constructed from a number set. More...
 
void numspan_set_tbox (const Span *s, TBox *box)
 Return in the last argument a temporal box constructed from a number span. More...
 
TBoxnumspan_timestamptz_to_tbox (const Span *s, TimestampTz t)
 Return a temporal box from a number span and a timestamptz. More...
 
TBoxnumspan_tstzspan_to_tbox (const Span *s, const Span *p)
 Return a temporal box from a number span and a timestamptz span. More...
 
bool overafter_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is not before the second one. More...
 
bool overbefore_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is not after the second one. More...
 
bool overlaps_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if two temporal boxes overlap. More...
 
bool overleft_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box does not extend to the right of the second one. More...
 
bool overright_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box does not extend to the left of the second one. More...
 
bool right_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is to the right of the second one. More...
 
bool same_tbox_tbox (const TBox *box1, const TBox *box2)
 Return true if two temporal boxes are equal in the common dimensions. More...
 
TBoxset_tbox (const Set *s)
 Convert a number or a timestamptz set into a temporal box. More...
 
TBoxset_to_tbox (const Set *s)
 Convert a number or a timestamptz set into a temporal box. More...
 
TBoxspan_tbox (const Span *s)
 Convert a number span into a temporal box. More...
 
TBoxspan_to_tbox (const Span *s)
 Convert a number span into a temporal box. More...
 
TBoxspanset_tbox (const SpanSet *ss)
 Convert a number span set into a temporal box. More...
 
TBoxspanset_to_tbox (const SpanSet *ss)
 Convert a number span set into a temporal box. More...
 
int tbox_cmp (const TBox *box1, const TBox *box2)
 Return -1, 0, or 1 depending on whether the first temporal box is less than, equal to, or greater than the second one. More...
 
TBoxtbox_copy (const TBox *box)
 Return a copy of a temporal box. More...
 
bool tbox_eq (const TBox *box1, const TBox *box2)
 Return true if two temporal boxes are equal. More...
 
void tbox_expand (const TBox *box1, TBox *box2)
 Return the second temporal box expanded with the first one. More...
 
TBoxtbox_expand_float (const TBox *box, const double d)
 Return a temporal box with the value span expanded/decreased by a double. More...
 
TBoxtbox_expand_int (const TBox *box, const int i)
 Return a temporal box with the value span expanded/decreased by an integer. More...
 
TBoxtbox_expand_time (const TBox *box, const Interval *interv)
 Return a temporal box with the time span expanded/decreased by an interval. More...
 
TBoxtbox_expand_value (const TBox *box, Datum value, meosType basetype)
 Return a temporal box with the value span expanded/decreased by a value. More...
 
Spantbox_floatspan (const TBox *box)
 Convert a temporal box into a float span. More...
 
bool tbox_ge (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is greater than or equal to the second one. More...
 
bool tbox_gt (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is greater than the second one. More...
 
bool tbox_hast (const TBox *box)
 Return true if a temporal box has time dimension. More...
 
bool tbox_hasx (const TBox *box)
 Return true if a temporal box has value dimension. More...
 
TBoxtbox_in (const char *str)
 Return a temporal box from its Well-Known Text (WKT) representation. More...
 
Spantbox_intspan (const TBox *box)
 Convert a temporal box into an integer span. More...
 
bool tbox_le (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is less than or equal to the second one. More...
 
bool tbox_lt (const TBox *box1, const TBox *box2)
 Return true if the first temporal box is less than the second one. More...
 
TBoxtbox_make (const Span *s, const Span *p)
 Return a temporal box from a number span and a timestamptz span. More...
 
bool tbox_ne (const TBox *box1, const TBox *box2)
 Return true if two temporal boxes are different. More...
 
char * tbox_out (const TBox *box, int maxdd)
 Return the Well-Known Text (WKT) representation of a temporal box. More...
 
TBoxtbox_round (const TBox *box, int maxdd)
 Return a temporal box with the precision of the value span set to a number of decimal places. More...
 
void tbox_set (const Span *s, const Span *p, TBox *box)
 Return in the last argument a temporal box constructed from a number span and a timestamptz span. More...
 
TBoxtbox_shift_scale_float (const TBox *box, double shift, double width, bool hasshift, bool haswidth)
 Return a temporal box with the value span shifted and/or scaled by the values. More...
 
TBoxtbox_shift_scale_int (const TBox *box, int shift, int width, bool hasshift, bool haswidth)
 Return a temporal box with the value span shifted and/or scaled by the values. More...
 
TBoxtbox_shift_scale_time (const TBox *box, const Interval *shift, const Interval *duration)
 Return a temporal box with the value span shifted and/or scaled by the values. More...
 
TBoxtbox_shift_scale_value (const TBox *box, Datum shift, Datum width, bool hasshift, bool haswidth)
 Return a temporal box with the value span shifted and/or scaled by the values. More...
 
bool tbox_tmax (const TBox *box, TimestampTz *result)
 Return in the last argument the maximum T value of a temporal box. More...
 
bool tbox_tmax_inc (const TBox *box, bool *result)
 Return in the last argument whether the maximum T value of a temporal box is inclusive. More...
 
bool tbox_tmin (const TBox *box, TimestampTz *result)
 Return in the last argument the minimum T value of a temporal box. More...
 
bool tbox_tmin_inc (const TBox *box, bool *result)
 Return in the last argument whether the minimum T value of a temporal box is inclusive. More...
 
Spantbox_to_floatspan (const TBox *box)
 Convert a temporal box into a float span. More...
 
Spantbox_to_intspan (const TBox *box)
 Convert a temporal box into an integer span. More...
 
Spantbox_to_tstzspan (const TBox *box)
 Convert a temporal box into a timestamptz span. More...
 
Spantbox_tstzspan (const TBox *box)
 Convert a temporal box into a timestamptz span. More...
 
bool tbox_xmax (const TBox *box, double *result)
 Return in the last argument the maximum X value of a temporal box as a double. More...
 
bool tbox_xmax_inc (const TBox *box, bool *result)
 Return in the last argument whether the maximum X value of a temporal box is inclusive. More...
 
bool tbox_xmin (const TBox *box, double *result)
 Return in the last argument the minimum X value of a temporal box as a double. More...
 
bool tbox_xmin_inc (const TBox *box, bool *result)
 Return in the last argument whether the minimum X value of a temporal box is inclusive. More...
 
bool tboxfloat_xmax (const TBox *box, double *result)
 Return in the last argument the maximum X value of a temporal box. More...
 
bool tboxfloat_xmin (const TBox *box, double *result)
 Return in the last argument the minimum X value of a temporal box. More...
 
bool tboxint_xmax (const TBox *box, int *result)
 Return in the last argument the maximum X value of a temporal box. More...
 
bool tboxint_xmin (const TBox *box, int *result)
 Return in the last argument the minimum X value of a temporal box. More...
 
void timestamptz_set_tbox (TimestampTz t, TBox *box)
 Return in the last argument a temporal box constructed from a timestamptz. More...
 
TBoxtimestamptz_to_tbox (TimestampTz t)
 Convert a timestamptz into a temporal box. More...
 
void tstzset_set_tbox (const Set *s, TBox *box)
 Return in the last argument a temporal box constructed from a timestamptz set. More...
 
void tstzspan_set_tbox (const Span *s, TBox *box)
 Return in the last argument a temporal box constructed from a timestamptz span. More...
 
TBoxunion_tbox_tbox (const TBox *box1, const TBox *box2, bool strict)
 Return the union of two temporal boxes. More...
 

Detailed Description

Functions for temporal bounding boxes.