#include <lemon/dim2.h>
Public Member Functions | |
BoundingBox () | |
Default constructor: creates an empty bounding box. | |
BoundingBox (Point< T > a) | |
Construct an instance from one point. | |
BoundingBox (Point< T > a, Point< T > b) | |
Construct an instance from two points. | |
BoundingBox (T l, T b, T r, T t) | |
Construct an instance from four numbers. | |
bool | empty () const |
Return true if the bounding box is empty. | |
void | clear () |
Make the BoundingBox empty. | |
Point< T > | bottomLeft () const |
Give back the bottom left corner of the box. | |
void | bottomLeft (Point< T > p) |
Set the bottom left corner of the box. | |
Point< T > | topRight () const |
Give back the top right corner of the box. | |
void | topRight (Point< T > p) |
Set the top right corner of the box. | |
Point< T > | bottomRight () const |
Give back the bottom right corner of the box. | |
void | bottomRight (Point< T > p) |
Set the bottom right corner of the box. | |
Point< T > | topLeft () const |
Give back the top left corner of the box. | |
void | topLeft (Point< T > p) |
Set the top left corner of the box. | |
T | bottom () const |
Give back the bottom of the box. | |
void | bottom (T t) |
Set the bottom of the box. | |
T | top () const |
Give back the top of the box. | |
void | top (T t) |
Set the top of the box. | |
T | left () const |
Give back the left side of the box. | |
void | left (T t) |
Set the left side of the box. | |
T | right () const |
Give back the right side of the box. | |
void | right (T t) |
Set the right side of the box. | |
T | height () const |
Give back the height of the box. | |
T | width () const |
Give back the width of the box. | |
bool | inside (const Point< T > &u) const |
Checks whether a point is inside a bounding box. | |
BoundingBox & | add (const Point< T > &u) |
BoundingBox & | add (const BoundingBox &u) |
BoundingBox | operator& (const BoundingBox &u) const |
BoundingBox | ( | Point< T > | a, | |
Point< T > | b | |||
) | [inline] |
Construct an instance from two points.
a | The bottom left corner. | |
b | The top right corner. |
BoundingBox | ( | T | l, | |
T | b, | |||
T | r, | |||
T | t | |||
) | [inline] |
Construct an instance from four numbers.
l | The left side of the box. | |
b | The bottom of the box. | |
r | The right side of the box. | |
t | The top of the box. |
bool empty | ( | ) | const [inline] |
Return true
if the bounding box is empty (i.e. return false
if at least one point was added to the box or the coordinates of the box were set).
The coordinates of an empty bounding box are not defined.
Point<T> bottomLeft | ( | ) | const [inline] |
Give back the bottom left corner of the box. If the bounding box is empty, then the return value is not defined.
void bottomLeft | ( | Point< T > | p | ) | [inline] |
Set the bottom left corner of the box. It should only be used for non-empty box.
Point<T> topRight | ( | ) | const [inline] |
Give back the top right corner of the box. If the bounding box is empty, then the return value is not defined.
void topRight | ( | Point< T > | p | ) | [inline] |
Set the top right corner of the box. It should only be used for non-empty box.
Point<T> bottomRight | ( | ) | const [inline] |
Give back the bottom right corner of the box. If the bounding box is empty, then the return value is not defined.
void bottomRight | ( | Point< T > | p | ) | [inline] |
Set the bottom right corner of the box. It should only be used for non-empty box.
Point<T> topLeft | ( | ) | const [inline] |
Give back the top left corner of the box. If the bounding box is empty, then the return value is not defined.
void topLeft | ( | Point< T > | p | ) | [inline] |
Set the top left corner of the box. It should only be used for non-empty box.
T bottom | ( | ) | const [inline] |
Give back the bottom of the box. If the bounding box is empty, then the return value is not defined.
void bottom | ( | T | t | ) | [inline] |
Set the bottom of the box. It should only be used for non-empty box.
T top | ( | ) | const [inline] |
Give back the top of the box. If the bounding box is empty, then the return value is not defined.
void top | ( | T | t | ) | [inline] |
Set the top of the box. It should only be used for non-empty box.
T left | ( | ) | const [inline] |
Give back the left side of the box. If the bounding box is empty, then the return value is not defined.
void left | ( | T | t | ) | [inline] |
Set the left side of the box. It should only be used for non-empty box.
T right | ( | ) | const [inline] |
Give back the right side of the box. If the bounding box is empty, then the return value is not defined.
void right | ( | T | t | ) | [inline] |
Set the right side of the box. It should only be used for non-empty box.
T height | ( | ) | const [inline] |
Give back the height of the box. If the bounding box is empty, then the return value is not defined.
T width | ( | ) | const [inline] |
Give back the width of the box. If the bounding box is empty, then the return value is not defined.
BoundingBox& add | ( | const Point< T > & | u | ) | [inline] |
Increments a bounding box with a point.
BoundingBox& add | ( | const BoundingBox< T > & | u | ) | [inline] |
Increments a bounding box to contain another bounding box.
BoundingBox operator& | ( | const BoundingBox< T > & | u | ) | const [inline] |
Intersection of two bounding boxes.