243 ///Makes the BoundingBox empty |
243 ///Makes the BoundingBox empty |
244 void clear() { |
244 void clear() { |
245 _empty=1; |
245 _empty=1; |
246 } |
246 } |
247 |
247 |
248 ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) |
248 ///\brief Gives back the bottom left corner |
|
249 ///(if the bounding box is empty, then the return value is not defined) |
249 xy<T> bottomLeft() const { |
250 xy<T> bottomLeft() const { |
250 return bottom_left; |
251 return bottom_left; |
251 } |
252 } |
252 |
253 |
253 ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) |
254 ///\brief Sets the bottom left corner |
|
255 ///(should only bee used for non-empty box) |
|
256 void bottomLeft(xy<T> p) { |
|
257 bottom_left = p; |
|
258 } |
|
259 |
|
260 ///\brief Gives back the top right corner |
|
261 ///(if the bounding box is empty, then the return value is not defined) |
254 xy<T> topRight() const { |
262 xy<T> topRight() const { |
255 return top_right; |
263 return top_right; |
256 } |
264 } |
257 |
265 |
258 ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) |
266 ///\brief Sets the top right corner |
|
267 ///(should only bee used for non-empty box) |
|
268 void topRight(xy<T> p) { |
|
269 top_right = p; |
|
270 } |
|
271 |
|
272 ///\brief Gives back the bottom right corner |
|
273 ///(if the bounding box is empty, then the return value is not defined) |
259 xy<T> bottomRight() const { |
274 xy<T> bottomRight() const { |
260 return xy<T>(top_right.x,bottom_left.y); |
275 return xy<T>(top_right.x,bottom_left.y); |
261 } |
276 } |
262 |
277 |
263 ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) |
278 ///\brief Sets the bottom right corner |
|
279 ///(should only bee used for non-empty box) |
|
280 void bottomRight(xy<T> p) { |
|
281 top_right.x = p.x; |
|
282 bottom_left.y = p.y; |
|
283 } |
|
284 |
|
285 ///\brief Gives back the top left corner |
|
286 ///(if the bounding box is empty, then the return value is not defined) |
264 xy<T> topLeft() const { |
287 xy<T> topLeft() const { |
265 return xy<T>(bottom_left.x,top_right.y); |
288 return xy<T>(bottom_left.x,top_right.y); |
266 } |
289 } |
267 |
290 |
268 ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) |
291 ///\brief Sets the top left corner |
|
292 ///(should only bee used for non-empty box) |
|
293 void topLeft(xy<T> p) { |
|
294 top_right.y = p.y; |
|
295 bottom_left.x = p.x; |
|
296 } |
|
297 |
|
298 ///\brief Gives back the bottom of the box |
|
299 ///(if the bounding box is empty, then the return value is not defined) |
269 T bottom() const { |
300 T bottom() const { |
270 return bottom_left.y; |
301 return bottom_left.y; |
271 } |
302 } |
272 |
303 |
273 ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) |
304 ///\brief Sets the bottom of the box |
|
305 ///(should only bee used for non-empty box) |
|
306 void bottom(T t) { |
|
307 bottom_left.y = t; |
|
308 } |
|
309 |
|
310 ///\brief Gives back the top of the box |
|
311 ///(if the bounding box is empty, then the return value is not defined) |
274 T top() const { |
312 T top() const { |
275 return top_right.y; |
313 return top_right.y; |
276 } |
314 } |
277 |
315 |
278 ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) |
316 ///\brief Sets the top of the box |
|
317 ///(should only bee used for non-empty box) |
|
318 void top(T t) { |
|
319 top_right.y = t; |
|
320 } |
|
321 |
|
322 ///\brief Gives back the left side of the box |
|
323 ///(if the bounding box is empty, then the return value is not defined) |
279 T left() const { |
324 T left() const { |
280 return bottom_left.x; |
325 return bottom_left.x; |
281 } |
326 } |
282 |
327 |
283 ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) |
328 ///\brief Sets the left side of the box |
|
329 ///(should only bee used for non-empty box) |
|
330 void left(T t) { |
|
331 bottom_left.x = t; |
|
332 } |
|
333 |
|
334 ///\brief Gives back the right side of the box |
|
335 ///(if the bounding box is empty, then the return value is not defined) |
284 T right() const { |
336 T right() const { |
285 return top_right.x; |
337 return top_right.x; |
286 } |
338 } |
287 |
339 |
288 ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) |
340 ///\brief Sets the right side of the box |
|
341 ///(should only bee used for non-empty box) |
|
342 void right(T t) { |
|
343 top_right.x = t; |
|
344 } |
|
345 |
|
346 ///\brief Gives back the height of the box |
|
347 ///(if the bounding box is empty, then the return value is not defined) |
289 T height() const { |
348 T height() const { |
290 return top_right.y-bottom_left.y; |
349 return top_right.y-bottom_left.y; |
291 } |
350 } |
292 |
351 |
293 ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) |
352 ///\brief Gives back the width of the box |
|
353 ///(if the bounding box is empty, then the return value is not defined) |
294 T width() const { |
354 T width() const { |
295 return top_right.x-bottom_left.x; |
355 return top_right.x-bottom_left.x; |
296 } |
356 } |
297 |
357 |
298 ///Checks whether a point is inside a bounding box |
358 ///Checks whether a point is inside a bounding box |