]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/boxes.hh
release: 0.1.7
[lilypond.git] / lily / include / boxes.hh
index 22a2eec3a5f29ee524cd192aaee3e5277ac1f177..8161a84518ccd43b342a4ec3f236bd034c579ba7 100644 (file)
@@ -9,19 +9,28 @@
 #include "real.hh"
 #include "interval.hh"
 #include "offset.hh"
+#include "axes.hh"
 
-/// a square subset of Real^2
 struct Box {
-    Interval x, y;
-
+    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 ) {
+       return interval_a_[a];
+    }
+    
     void translate(Offset o) {
-       x.translate(o.x);
-       y.translate(o.y);
+       x().translate(o.x());
+       y().translate(o.y());
     }
+
     /// smallest box enclosing #b#
     void unite(Box b) {
-       x.unite(b.x);
-       y.unite(b.y);
+       x().unite(b.x());
+       y().unite(b.y());
     }
     Box();
     Box(Interval ix, Interval iy);