[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Box< VALUETYPE, DIMENSION > Class Template Reference |
Represent an n-dimensional box as a (begin, end) pair. Depending on the value type, end() is considered to be outside the box (as in the STL, for integer types), or inside (for floating point types). size() will always be end() - begin(). More...
#include <vigra/box.hxx>
Public Types | |
typedef VALUETYPE | value_type |
typedef TinyVector< VALUETYPE, DIMENSION > | Vector |
typedef NumericTraits < VALUETYPE >::Promote | VolumeType |
Public Member Functions | |
void | addBorder (VALUETYPE borderWidth) |
void | addBorder (const Vector &borderWidth) |
void | addSize (Vector const &offset) |
Vector const & | begin () const |
Vector & | begin () |
Box () | |
Box (Vector const &begin, Vector const &end) | |
Box (Vector const &size) | |
bool | contains (Vector const &p) const |
bool | contains (Box const &r) const |
Vector const & | end () const |
Vector & | end () |
bool | intersects (Box const &r) const |
bool | isEmpty () const |
void | moveBy (Vector const &offset) |
void | moveTo (Vector const &newBegin) |
bool | operator!= (Box const &r) const |
inequality check | |
Box | operator& (Box const &r) const |
Box & | operator&= (Box const &r) |
Box | operator* (double scale) const |
Box & | operator*= (double scale) |
Box | operator+ (const Vector &offset) const |
Box & | operator+= (const Vector &offset) |
Box | operator- (const Vector &offset) const |
Box & | operator-= (const Vector &offset) |
Box | operator/ (double scale) const |
Box & | operator/= (double scale) |
bool | operator== (Box const &r) const |
equality check | |
Box | operator| (Vector const &p) const |
Box | operator| (Box const &r) const |
Box & | operator|= (Vector const &p) |
Box & | operator|= (Box const &r) |
void | setBegin (Vector const &begin) |
void | setEnd (Vector const &end) |
void | setSize (Vector const &size) |
Vector | size () const |
VolumeType | volume () const |
Protected Types | |
typedef If< typename NumericTraits< VALUETYPE > ::isIntegral, detail::EndOutsidePolicy < VALUETYPE > , detail::EndInsidePolicy < VALUETYPE > >::type | RangePolicy |
Represent an n-dimensional box as a (begin, end) pair. Depending on the value type, end() is considered to be outside the box (as in the STL, for integer types), or inside (for floating point types). size() will always be end() - begin().
typedef VALUETYPE value_type |
STL-compatible definition of coordinate valuetype
typedef NumericTraits<VALUETYPE>::Promote VolumeType |
Promoted coordinate valuetype, used for volume()
typedef TinyVector<VALUETYPE, DIMENSION> Vector |
|
protected |
Range policy (EndInsidePolicy/EndOutsidePolicy, depending on valuetype)
Box | ( | ) |
Construct an empty box (isEmpty() will return true). (Internally, this will initialize all dimensions with the empty range [1..0].)
Construct a box representing the given range. Depending on the value type, end() is considered to be outside the box (as in the STL, for integer types), or inside (for floating point types).
Vector const& begin | ( | ) | const |
Get begin vector (i.e. smallest coordinates for each dimension). This is the first point (scan-order wise) which is considered to be "in" the box.
Vector& begin | ( | ) |
Access begin vector (i.e. smallest coordinates for each dimension). This is the first point (scan-order wise) which is considered to be "in" the box.
Vector const& end | ( | ) | const |
Vector& end | ( | ) |
void setBegin | ( | Vector const & | begin | ) |
void setEnd | ( | Vector const & | end | ) |
void moveTo | ( | Vector const & | newBegin | ) |
Move the whole box so that the given point will be begin() afterwards.
void moveBy | ( | Vector const & | offset | ) |
Move the whole box by the given offset. (Equivalent to operator+=)
VolumeType volume | ( | ) | const |
Determine and return the area of this box. That is, if this rect isEmpty(), returns zero, otherwise returns the product of the extents in each dimension.
Vector size | ( | ) | const |
Determine and return the size of this box. The size might be zero or even negative in one or more dimensions, and if so, isEmpty() will return true.
void setSize | ( | Vector const & | size | ) |
Resize this box to the given extents. This will change end() only.
void addSize | ( | Vector const & | offset | ) |
Increase the size of the box by the given offset. This will move end() only. (If any of offset's components is negative, the box will get smaller accordingly.)
void addBorder | ( | VALUETYPE | borderWidth | ) |
void addBorder | ( | const Vector & | borderWidth | ) |
bool isEmpty | ( | ) | const |
Return whether this box is considered empty. It is non-empty if all end() coordinates are greater than (or equal, for floating point valuetypes) the corresponding begin() coordinates. Uniting an empty box with something will return the bounding box of the 'something', and intersecting any box with an empty box will again yield an empty box.
bool contains | ( | Vector const & | p | ) | const |
Return whether this box contains the given point. That is, if the point lies within the range [begin, end] in each dimension (excluding end() itself for integer valuetypes).
bool contains | ( | Box< VALUETYPE, DIMENSION > const & | r | ) | const |
Return whether this box contains the given one. r1.contains(r2)
returns the same as r1 == (r1|r2)
(but is of course more efficient). That also means, a box (even an empty one!) contains() any empty box.
bool intersects | ( | Box< VALUETYPE, DIMENSION > const & | r | ) | const |
Return whether this box overlaps with the given one. r1.intersects(r2)
returns the same as !(r1&r2).isEmpty()
(but is of course much more efficient).
Modifies this box by including the given point. The result will be the bounding box of the box and the point. If isEmpty() returns true on the original box, the union will be a box containing only the given point.
Returns the union of this box and the given point. The result will be the bounding box of the box and the point. If isEmpty() returns true on the original box, the union will be a box containing only the given point.
Modifies this box by uniting it with the given one. The result will be the bounding box of both boxs. If one of the boxes isEmpty(), the union will be the other one.
Returns the union of this box and the given one. The result will be the bounding box of both boxs. If one of the boxes isEmpty(), the union will be the other one.
Modifies this box by intersecting it with the given one. The result will be the maximal box contained in both original ones. Intersecting with an empty box will yield again an empty box.
Intersects this box with the given one. The result will be the maximal box contained in both original ones. Intersecting with an empty box will yield again an empty box.
Box& operator*= | ( | double | scale | ) |
Box operator* | ( | double | scale | ) | const |
Box& operator/= | ( | double | scale | ) |
Box operator/ | ( | double | scale | ) | const |
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|