]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/box.cc
(ordered_elements): we cannot
[lilypond.git] / lily / box.cc
index f82325d20bc8b7650db5ca14f69426dbc2dc8ef1..5ec4a9f03949234f7ce87d003b2f6f157b8a0eb9 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996--2001 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,23 @@ 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);
+}