dim2::Box

Declared in lemon/dim2.h, in the group Geometric Data Structures; the same class on the Doxygen site.

template< typename T >
class Box

Bounding box of plain vectors (points).

A class to calculate or store the bounding box of plain vectors (points).

Public Functions

inline Box()

Default constructor: creates an empty box.

inline Box(Point< T > a)

Construct a box from one point.

inline Box(Point< T > a, Point< T > b)

Construct a box from two points.

Warning

The coordinates of the bottom left corner must be no more than those of the top right one.

Parameters:
  • a – The bottom left corner.

  • b – The top right corner.

inline Box( T l , T b , T r , T t )

Construct a box from four numbers.

Warning

The left side must be no more than the right side and bottom must be no more than the top.

Parameters:
  • 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.

inline bool empty() const

Return true if the box is empty.

Return true if the 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 box are not defined.

inline void clear()

Make the box empty.

inline Point< T > bottomLeft() const

Give back the bottom left corner of the box. If the box is empty, then the return value is not defined.

inline void bottomLeft(Point< T > p)

Set the bottom left corner of the box.

Pre:

The box must not be empty.

inline Point< T > topRight() const

Give back the top right corner of the box. If the box is empty, then the return value is not defined.

inline void topRight(Point< T > p)

Set the top right corner of the box.

Pre:

The box must not be empty.

inline Point< T > bottomRight() const

Give back the bottom right corner of the box. If the box is empty, then the return value is not defined.

inline void bottomRight(Point< T > p)

Set the bottom right corner of the box.

Pre:

The box must not be empty.

inline Point< T > topLeft() const

Give back the top left corner of the box. If the box is empty, then the return value is not defined.

inline void topLeft(Point< T > p)

Set the top left corner of the box.

Pre:

The box must not be empty.

inline T bottom() const

Give back the bottom of the box. If the box is empty, then the return value is not defined.

inline void bottom( T t )

Set the bottom of the box.

Pre:

The box must not be empty.

inline T top() const

Give back the top of the box. If the box is empty, then the return value is not defined.

inline void top( T t )

Set the top of the box.

Pre:

The box must not be empty.

inline T left() const

Give back the left side of the box. If the box is empty, then the return value is not defined.

inline void left( T t )

Set the left side of the box.

Pre:

The box must not be empty.

inline T right() const

Give back the right side of the box. If the box is empty, then the return value is not defined.

inline void right( T t )

Set the right side of the box.

Pre:

The box must not be empty.

inline T height() const

Give back the height of the box. If the box is empty, then the return value is not defined.

inline T width() const

Give back the width of the box. If the box is empty, then the return value is not defined.

inline bool inside( const Point< T > & u ) const

Checks whether a point is inside the box.

inline Box & add( const Point< T > & u )

Increments the box with a point.

inline Box & add( const Box & u )

Increments the box to contain another box.

inline Box operator&( const Box & u ) const

Intersection of two boxes.