lilypond-1.5.9
[lilypond.git] / lily / boxes.cc
blobacc6681d79b5dcfeddd294bf6edec6f9b91c471e
1 /*
2 boxes.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "box.hh"
10 #include "array.hh"
12 void
13 Box::translate (Offset o)
15 for (Axis i=X_AXIS; i < NO_AXES; incr(i))
16 interval_a_[i] += o[i];
19 void
20 Box::unite (Box b)
22 for (Axis i=X_AXIS; i < NO_AXES; incr(i))
23 interval_a_[i].unite (b[i]);
26 /**
27 Initialize to empty.
29 Box::Box()
33 void
34 Box::set_empty ()
36 interval_a_[X_AXIS].set_empty ();
37 interval_a_[Y_AXIS].set_empty ();
40 Box::Box (Interval ix, Interval iy)
42 x() = ix;
43 y() = iy;
46 Interval &
47 Box::operator[] (Axis a)
49 return interval_a_[a];
52 Interval
53 Box::operator[] (Axis a)const
55 return interval_a_[a];