lilypond-1.3.154
[lilypond.git] / lily / box.cc
blobeb31e8311071473ad772d23f7063e8bbace2b25d
1 /*
2 box.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2001 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];
58 void
59 Box::scale (Real s)
61 interval_a_[X_AXIS] *= s;
62 interval_a_[Y_AXIS] *= s;