2 box.cc -- implement Box
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 Box::translate (Offset o
)
16 for (Axis i
=X_AXIS
; i
< NO_AXES
; incr (i
))
17 interval_a_
[i
] += o
[i
];
23 for (Axis i
=X_AXIS
; i
< NO_AXES
; incr (i
))
24 interval_a_
[i
].unite (b
[i
]);
37 interval_a_
[X_AXIS
].set_empty ();
38 interval_a_
[Y_AXIS
].set_empty ();
41 Box::Box (Interval ix
, Interval iy
)
48 Box::operator[] (Axis a
)
50 return interval_a_
[a
];
54 Box::operator[] (Axis a
)const
56 return interval_a_
[a
];
62 interval_a_
[X_AXIS
] *= s
;
63 interval_a_
[Y_AXIS
] *= s
;
67 Box::add_point (Offset o
)
69 interval_a_
[X_AXIS
].add_point (o
[X_AXIS
]);
70 interval_a_
[Y_AXIS
].add_point (o
[Y_AXIS
]);
76 return Offset (interval_a_
[X_AXIS
].center (),
77 interval_a_
[Y_AXIS
].center ());
80 Box::widen (Real x
, Real y
)
82 interval_a_
[X_AXIS
].widen (x
);
83 interval_a_
[Y_AXIS
].widen (y
);