X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbox.cc;h=97bbbb905bb9c6018b684152231c9e0e35dc56fb;hb=98ca84585c45f75503adff82fc0a8cec2a105769;hp=f82325d20bc8b7650db5ca14f69426dbc2dc8ef1;hpb=94189ec2b8da6d7e89dc619c646a927adead9b19;p=lilypond.git diff --git a/lily/box.cc b/lily/box.cc index f82325d20b..97bbbb905b 100644 --- a/lily/box.cc +++ b/lily/box.cc @@ -3,30 +3,31 @@ source file of the GNU LilyPond music typesetter - (c) 1996--2001 Han-Wen Nienhuys + (c) 1996--2004 Han-Wen Nienhuys */ #include "box.hh" #include "array.hh" +#include "axes.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 +40,8 @@ Box::set_empty () Box::Box (Interval ix, Interval iy) { - x() = ix; - y() = iy; + x () = ix; + y () = iy; } Interval & @@ -61,3 +62,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); +}