]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/boxes.hh
release: 0.1.11
[lilypond.git] / lily / include / boxes.hh
1 /*
2     some 2D geometrical concepts
3 */
4
5 #ifndef BOXES_HH
6 #define BOXES_HH
7
8 #include "fproto.hh"
9 #include "real.hh"
10 #include "interval.hh"
11 #include "offset.hh"
12 #include "axes.hh"
13
14 struct Box {
15     Interval interval_a_[NO_AXES];
16     
17     Interval &x() {return interval_a_[X_AXIS]; }
18     Interval &y(){ return interval_a_[Y_AXIS]; }
19     Interval x() const{ return interval_a_[X_AXIS]; }
20     Interval y() const{return interval_a_[Y_AXIS]; }
21     Interval operator[](Axis a) {
22         return interval_a_[a];
23     }
24     
25     void translate (Offset o) {
26         x().translate (o.x ());
27         y().translate (o.y ());
28     }
29
30     /// smallest box enclosing #b#
31     void unite (Box b) {
32         x().unite (b.x ());
33         y().unite (b.y ());
34     }
35     Box();
36     Box (Interval ix, Interval iy);
37 };
38
39
40 #endif