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