]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/box.cc
2003 -> 2004
[lilypond.git] / lily / box.cc
index 6f8bf3439496eadd80957e6f92615494fa2a8752..4854743b8bdcb5893d8ad2d49f87eee04736a196 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "box.hh"
 void
 Box::translate (Offset o)
 {
-  for (Axis i=X_AXIS; i < NO_AXES; incr(i))
+  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
     interval_a_[i] += o[i];
 }
 
 void
 Box::unite (Box b)
 {
-  for (Axis i=X_AXIS; i < NO_AXES; incr(i))
+  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
     interval_a_[i].unite (b[i]);
 }
 
 /**
   Initialize to empty.
  */
-Box::Box()
+Box::Box ()
 {        
 }
 
@@ -39,8 +39,8 @@ Box::set_empty ()
 
 Box::Box (Interval ix, Interval iy)
 {
-  x() = ix;
-  y() = iy;
+  x () = ix;
+  y () = iy;
 }
 
 Interval &
@@ -61,3 +61,24 @@ Box::scale (Real s)
   interval_a_[X_AXIS] *= s;
   interval_a_[Y_AXIS] *= s;
 }
+
+void
+Box::add_point (Offset o)
+{
+  interval_a_[X_AXIS].add_point (o[X_AXIS]);
+  interval_a_[Y_AXIS].add_point (o[Y_AXIS]);  
+}
+
+Offset
+Box::center () const
+{
+  return Offset (interval_a_[X_AXIS].center(),
+                interval_a_[Y_AXIS].center()); 
+}
+void
+Box::widen (Real x, Real y)
+{
+  interval_a_[X_AXIS].widen (x);
+  interval_a_[Y_AXIS].widen (y);
+  
+}