]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/box.hh
unsmob_pitch -> Pitch::unsmob and related
[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 #include "smobs.hh"
11
12 class Box
13 {
14   Interval interval_a_[NO_AXES];
15   DECLARE_SIMPLE_SMOBS (Box);
16 public:
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) const;
22   Interval &operator [] (Axis a);
23   Real area () const;
24   bool is_empty () const;
25   bool is_empty (Axis a) const;
26
27   Offset center () const;
28
29   void translate (Offset o);
30
31   /// smallest box enclosing #b#
32   void set_empty ();
33   void add_point (Offset);
34   void widen (Real x, Real y);
35   void scale (Real r);
36   void unite (Box b);
37   void intersect (Box b);
38   void print ();
39   Box ();
40   Box (Interval ix, Interval iy);
41 };
42
43
44 #endif