|
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>
|
typedef If< typename NumericTraits< VALUETYPE >::isIntegral, detail::EndOutsidePolicy< VALUETYPE >, detail::EndInsidePolicy< VALUETYPE > >::type | RangePolicy |
|
Detailed Description
template<class VALUETYPE, unsigned int DIMENSION>
class vigra::Box< VALUETYPE, DIMENSION >
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().
§ value_type
STL-compatible definition of coordinate valuetype
§ VolumeType
typedef NumericTraits<VALUETYPE>::Promote VolumeType |
Promoted coordinate valuetype, used for volume()
§ Vector
§ RangePolicy
typedef If<typename NumericTraits<VALUETYPE>::isIntegral, detail::EndOutsidePolicy<VALUETYPE>, detail::EndInsidePolicy<VALUETYPE> >::type RangePolicy |
|
protected |
Range policy (EndInsidePolicy/EndOutsidePolicy, depending on valuetype)
§ Box() [1/3]
Construct an empty box (isEmpty() will return true). (Internally, this will initialize all dimensions with the empty range [1..0].)
§ Box() [2/3]
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).
§ Box() [3/3]
Construct a box of given size at the origin (i.e. end() == size()).
§ begin() [1/2]
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.
§ begin() [2/2]
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.
§ end() [1/2]
Get end vector (i.e. coordinates higher than begin() in each dimension for non-empty boxes). This is begin() + size(), and depending on the valuetype (float/int), this is the last point within or the first point outside the box, respectively.
§ end() [2/2]
Access end vector (i.e. coordinates higher than begin() in each dimension for non-empty boxes). This is begin() + size(), and depending on the valuetype (float/int), this is the last point within or the first point outside the box, respectively.
§ setBegin()
void setBegin |
( |
Vector const & |
begin | ) |
|
§ setEnd()
void setEnd |
( |
Vector const & |
end | ) |
|
§ moveTo()
void moveTo |
( |
Vector const & |
newBegin | ) |
|
Move the whole box so that the given point will be begin() afterwards.
§ moveBy()
void moveBy |
( |
Vector const & |
offset | ) |
|
Move the whole box by the given offset. (Equivalent to operator+=)
§ volume()
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.
§ size()
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.
§ setSize()
void setSize |
( |
Vector const & |
size | ) |
|
Resize this box to the given extents. This will change end() only.
§ addSize()
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.)
§ addBorder() [1/2]
void addBorder |
( |
VALUETYPE |
borderWidth | ) |
|
Adds a border of the given width around the box. That means, begin()'s components are moved by -borderWidth and end()'s by borderWidth. (If borderWidth is negative, the box will get smaller accordingly.)
§ addBorder() [2/2]
void addBorder |
( |
const Vector & |
borderWidth | ) |
|
Adds a border of the given width around the box. That means, begin()'s components are moved by -borderWidth and end()'s by borderWidth. (If borderWidth is negative, the box will get smaller accordingly.)
§ isEmpty()
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.
§ contains() [1/2]
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).
§ contains() [2/2]
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.
§ intersects()
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).
§ operator|=() [1/2]
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.
§ operator|() [1/2]
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.
§ operator|=() [2/2]
Box& operator|= |
( |
Box< VALUETYPE, DIMENSION > const & |
r | ) |
|
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.
§ operator|() [2/2]
Box operator| |
( |
Box< VALUETYPE, DIMENSION > const & |
r | ) |
const |
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.
§ operator &=()
Box& operator&= |
( |
Box< VALUETYPE, DIMENSION > const & |
r | ) |
|
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.
§ operator &()
Box operator& |
( |
Box< VALUETYPE, DIMENSION > const & |
r | ) |
const |
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.
§ operator*=()
Box& operator*= |
( |
double |
scale | ) |
|
Scale box by scalar multiply-assignment. The same scalar multiply-assignment operation will be performed on both begin() and end().
§ operator*()
Box operator* |
( |
double |
scale | ) |
const |
Return box scaled by given factor. The same scalar multiplication will be performed on both begin() and end().
§ operator/=()
Box& operator/= |
( |
double |
scale | ) |
|
Scale box by scalar divide-assignment. The same scalar divide-assignment operation will be performed on both begin() and end().
§ operator/()
Box operator/ |
( |
double |
scale | ) |
const |
Return box scaled by inverse of given factor. The same scalar division will be performed on both begin() and end().
§ operator+=()
Translate box by vector addition-assignment. The same vector addition-assignment operation will be performed on both begin() and end().
§ operator+()
Translate box by vector addition. The same vector addition operation will be performed on both begin() and end().
§ operator-=()
Translate box by vector subtract-assignment. The same vector subtract-assignment operation will be performed on both begin() and end().
§ operator-()
Translate box by vector subtract. The same vector subtract operation will be performed on both begin() and end().
The documentation for this class was generated from the following file: