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>
9 #include "ly-smobs.icc"
15 Box::translate (Offset o)
17 for (Axis i = X_AXIS; i < NO_AXES; incr (i))
18 interval_a_[i] += o[i];
24 for (Axis i = X_AXIS; i < NO_AXES; incr (i))
25 interval_a_[i].unite (b[i]);
38 interval_a_[X_AXIS].set_empty ();
39 interval_a_[Y_AXIS].set_empty ();
42 Box::Box (Interval ix, Interval iy)
49 Box::operator [] (Axis a)
51 return interval_a_[a];
55 Box::operator [] (Axis a) const
57 return interval_a_[a];
63 interval_a_[X_AXIS] *= s;
64 interval_a_[Y_AXIS] *= s;
68 Box::add_point (Offset o)
70 interval_a_[X_AXIS].add_point (o[X_AXIS]);
71 interval_a_[Y_AXIS].add_point (o[Y_AXIS]);
77 return Offset (interval_a_[X_AXIS].center (),
78 interval_a_[Y_AXIS].center ());
82 Box::widen (Real x, Real y)
84 interval_a_[X_AXIS].widen (x);
85 interval_a_[Y_AXIS].widen (y);
88 IMPLEMENT_SIMPLE_SMOBS (Box);
89 IMPLEMENT_TYPE_P (Box, "ly:box?");
90 IMPLEMENT_DEFAULT_EQUAL_P (Box);
93 Box::mark_smob (SCM x)
100 Box::print_smob (SCM x, SCM p, scm_print_state*)
103 scm_puts ("#<Box>", p);