* lily/music-iterator.cc (quit, do_quit): new function: break link
[lilypond.git] / lily / box.cc
blobefed2217b57af21b1d870e0e11a95d90d44a17b8
1 /*
2 box.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2002 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;
65 void
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]);
72 Offset
73 Box::center () const
75 return Offset (interval_a_[X_AXIS].center(),
76 interval_a_[Y_AXIS].center());