2 box.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 Box::translate (Offset o)
15 for (Axis i = X_AXIS; i < NO_AXES; incr (i))
16 interval_a_[i] += o[i];
22 for (Axis i = X_AXIS; i < NO_AXES; incr (i))
23 interval_a_[i].unite (b[i]);
36 interval_a_[X_AXIS].set_empty ();
37 interval_a_[Y_AXIS].set_empty ();
40 Box::Box (Interval ix, Interval iy)
47 Box::operator [] (Axis a)
49 return interval_a_[a];
53 Box::operator [] (Axis a) const
55 return interval_a_[a];
61 interval_a_[X_AXIS] *= s;
62 interval_a_[Y_AXIS] *= s;
66 Box::add_point (Offset o)
68 interval_a_[X_AXIS].add_point (o[X_AXIS]);
69 interval_a_[Y_AXIS].add_point (o[Y_AXIS]);
75 return Offset (interval_a_[X_AXIS].center (),
76 interval_a_[Y_AXIS].center ());
80 Box::widen (Real x, Real y)
82 interval_a_[X_AXIS].widen (x);
83 interval_a_[Y_AXIS].widen (y);