2 box.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 Box::translate (Offset o
)
14 for (Axis i
= X_AXIS
; i
< NO_AXES
; incr (i
))
15 interval_a_
[i
] += o
[i
];
21 for (Axis i
= X_AXIS
; i
< NO_AXES
; incr (i
))
22 interval_a_
[i
].unite (b
[i
]);
32 interval_a_
[X_AXIS
].set_empty ();
33 interval_a_
[Y_AXIS
].set_empty ();
36 Box::Box (Interval ix
, Interval iy
)
43 Box::operator [] (Axis a
)
45 return interval_a_
[a
];
49 Box::operator [] (Axis a
) const
51 return interval_a_
[a
];
57 interval_a_
[X_AXIS
] *= s
;
58 interval_a_
[Y_AXIS
] *= s
;
62 Box::add_point (Offset o
)
64 interval_a_
[X_AXIS
].add_point (o
[X_AXIS
]);
65 interval_a_
[Y_AXIS
].add_point (o
[Y_AXIS
]);
71 return Offset (interval_a_
[X_AXIS
].center (),
72 interval_a_
[Y_AXIS
].center ());
76 Box::widen (Real x
, Real y
)
78 interval_a_
[X_AXIS
].widen (x
);
79 interval_a_
[Y_AXIS
].widen (y
);
82 /****************************************************************/
84 #include "ly-smobs.icc"
86 IMPLEMENT_SIMPLE_SMOBS (Box
);
87 IMPLEMENT_TYPE_P (Box
, "ly:box?");
88 IMPLEMENT_DEFAULT_EQUAL_P (Box
);
91 Box::mark_smob (SCM
/* x */)
97 Box::print_smob (SCM
/* x */, SCM p
, scm_print_state
*)
99 scm_puts ("#<Box>", p
);