VAT  3.0
Video Analysis Tool
intervals.h
1 #ifndef __INTERVALS_H__
2 #define __INTERVALS_H__
3 
4 class Interval;
5 
6 typedef Interval *interval_t;
7 
8 class Interval {
9  public:
10  double x1;
11  double x2;
12  double length;
13  bool is_null;
14 
15  Interval();
16  Interval(double, double);
17  Interval(Interval *);
18  ~Interval();
19 
20  //Initialize an interval with two values
21  static void newInterval(interval_t, double, double);
22  //Copy information from parameter
23  void copyInterval(interval_t);
24  //Copy information from second to first parameter.
25  static void copyInterval(interval_t, interval_t);
26  //Store intersection interval of i1 and i2 if it exist, null interval if there is no. Returns 1 if there is intersection and 0 if not
27  static bool intersect(interval_t result, interval_t i1, interval_t i2);
28  //Returns union interval result if intersection interval is not NULL, else it returns NULL.
29  static void unifyIfIntersect(interval_t result, interval_t interval1, interval_t interval2);
30  //Sets data representing null interval
31  void null();
32 };
33 
34 
35 #define INTERVAL_LENGTH(_interval) ((_interval)->length)
36 #define INTERVAL_IS_NULL(_interval) ((_interval)->is_null)
37 #define INTERVAL_X1(_interval) ((_interval)->x1)
38 #define INTERVAL_X2(_interval) ((_interval)->x2)
39 
40 #endif
Definition: intervals.h:8