2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
23 Box::translate (Offset o
)
25 for (Axis i
= X_AXIS
; i
< NO_AXES
; incr (i
))
26 interval_a_
[i
] += o
[i
];
32 for (Axis i
= X_AXIS
; i
< NO_AXES
; incr (i
))
33 interval_a_
[i
].unite (b
[i
]);
43 interval_a_
[X_AXIS
].set_empty ();
44 interval_a_
[Y_AXIS
].set_empty ();
47 Box::Box (Interval ix
, Interval iy
)
54 Box::operator [] (Axis a
)
56 return interval_a_
[a
];
60 Box::operator [] (Axis a
) const
62 return interval_a_
[a
];
68 interval_a_
[X_AXIS
] *= s
;
69 interval_a_
[Y_AXIS
] *= s
;
73 Box::add_point (Offset o
)
75 interval_a_
[X_AXIS
].add_point (o
[X_AXIS
]);
76 interval_a_
[Y_AXIS
].add_point (o
[Y_AXIS
]);
82 return Offset (interval_a_
[X_AXIS
].center (),
83 interval_a_
[Y_AXIS
].center ());
87 Box::widen (Real x
, Real y
)
89 interval_a_
[X_AXIS
].widen (x
);
90 interval_a_
[Y_AXIS
].widen (y
);
93 /****************************************************************/
95 #include "ly-smobs.icc"
97 IMPLEMENT_SIMPLE_SMOBS (Box
);
98 IMPLEMENT_TYPE_P (Box
, "ly:box?");
99 IMPLEMENT_DEFAULT_EQUAL_P (Box
);
102 Box::mark_smob (SCM
/* x */)
108 Box::print_smob (SCM
/* x */, SCM p
, scm_print_state
*)
110 scm_puts ("#<Box>", p
);