summaryrefslogtreecommitdiff
path: root/lily/include/box.hh
blob: c53543d05855087590009b5e1dff587cbe182709 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
    some 2D geometrical concepts
*/

#ifndef BOXES_HH
#define BOXES_HH

#include "fproto.hh"
#include "real.hh"
#include "interval.hh"
#include "offset.hh"
#include "axes.hh"


struct Box {
  Interval interval_a_[NO_AXES];
    
  Interval &x() {return interval_a_[X_AXIS]; }
  Interval &y(){ return interval_a_[Y_AXIS]; }
  Interval x() const{ return interval_a_[X_AXIS]; }
  Interval y() const{return interval_a_[Y_AXIS]; }
  Interval operator[](Axis a) const;
  Interval &operator[] (Axis a);
    
  void translate (Offset o);
  /// smallest box enclosing #b#
  void set_empty ();
  void unite (Box b);
  Box();
  Box (Interval ix, Interval iy);
};


#endif