Ion
|
The Range class defines an N-dimensional interval defined by minimum and maximum N-dimensional endpoints. More...
#include "range.h"
Public Types | |
typedef RangeBase< Dimension, T > | BaseType |
typedef BaseType::Endpoint | Endpoint |
typedef BaseType::Size | Size |
enum | { kDimension = Dimension } |
The dimension of the Range. More... | |
Public Member Functions | |
Range () | |
The default constructor defines an empty Range. More... | |
Range (const Endpoint &min_point, const Endpoint &max_point) | |
Constructor that takes the minimum and maximum points. More... | |
void | MakeEmpty () |
Sets the Range to be empty. More... | |
bool | IsEmpty () const |
Returns true if the Range is empty, meaning that the minimum value is strictly greater than the maximum value in some dimension. More... | |
const Endpoint & | GetMinPoint () const |
Returns the minimum or maximum endpoint. More... | |
const Endpoint & | GetMaxPoint () const |
void | SetMinPoint (const Endpoint &p) |
Modifies the minimum or maximum endpoint, or both. More... | |
void | SetMaxPoint (const Endpoint &p) |
void | Set (const Endpoint &min_point, const Endpoint &max_point) |
void | SetMinComponent (int i, T value) |
Modifies a single element for the minimum or maximum endpoint. More... | |
void | SetMaxComponent (int i, T value) |
void | SetWithSize (const Endpoint &min_point, const Size &size) |
Sets the Range from the minimum point and Range size. More... | |
const Size | GetSize () const |
Returns the size of the range, or the zero vector if the Range is empty. More... | |
const Endpoint | GetCenter () const |
Returns the point at the center of the range, or the origin if the range is empty. More... | |
void | ExtendByPoint (const Endpoint &p) |
Extends the Range if necessary to contain the given point. More... | |
void | ExtendByRange (const Range &r) |
Extends the Range if necessary to contain the given Range. More... | |
bool | ContainsPoint (const Endpoint &p) const |
Returns true if the Range contains the given point. More... | |
bool | ContainsRange (const Range &r) const |
Returns true if this Range fully contains the given Range by testing both min/max points of input Range. More... | |
bool | IntersectsRange (const Range &r) const |
Returns true if this Range overlaps the given Range, i.e., there exists at least one point contained in both ranges. More... | |
Static Public Member Functions | |
static const Range | BuildWithSize (const Endpoint &min_point, const Size &size) |
Convenience function that returns a Range from a minimum point and the Range size. More... | |
Friends | |
bool | operator== (const Range &m0, const Range &m1) |
Exact equality and inequality comparisons. More... | |
bool | operator!= (const Range &m0, const Range &m1) |
The Range class defines an N-dimensional interval defined by minimum and maximum N-dimensional endpoints.
The geometric interpretation of a Range is: 1D: A segment of the number line. 2D: An axis-aligned rectangle. 3D: An axis-aligned box.
A Range is considered to be empty if the minimum value is strictly greater than the maximum value in any dimension.
typedef RangeBase<Dimension, T> ion::math::Range< Dimension, T >::BaseType |
typedef BaseType::Endpoint ion::math::Range< Dimension, T >::Endpoint |
typedef BaseType::Size ion::math::Range< Dimension, T >::Size |
|
inherited |
|
inline |
The default constructor defines an empty Range.
Definition at line 107 of file range.h.
References ion::math::Range< Dimension, T >::MakeEmpty().
|
inline |
Constructor that takes the minimum and maximum points.
This does not check that the values form a valid Range, so the resulting instance might be considered empty.
Definition at line 112 of file range.h.
References ion::math::Range< Dimension, T >::Set().
|
inlinestatic |
bool ion::math::Range< Dimension, T >::ContainsPoint | ( | const Endpoint & | p | ) | const |
bool ion::math::Range< Dimension, T >::ContainsRange | ( | const Range< Dimension, T > & | r | ) | const |
Returns true if this Range fully contains the given Range by testing both min/max points of input Range.
Definition at line 322 of file range.h.
References ion::math::Range< Dimension, T >::GetMaxPoint(), and ion::math::Range< Dimension, T >::GetMinPoint().
void ion::math::Range< Dimension, T >::ExtendByPoint | ( | const Endpoint & | p | ) |
void ion::math::Range< Dimension, T >::ExtendByRange | ( | const Range< Dimension, T > & | r | ) |
Extends the Range if necessary to contain the given Range.
If this Range is empty, it becomes r. If r is empty, the Range is untouched.
Definition at line 299 of file range.h.
References ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), and ion::math::Range< Dimension, T >::IsEmpty().
Referenced by ion::math::RangeUnion().
|
inline |
Returns the point at the center of the range, or the origin if the range is empty.
Definition at line 167 of file range.h.
References ion::math::Range< Dimension, T >::IsEmpty(), and ion::math::Point< Dimension, T >::Zero().
Referenced by ion::math::ScaleRange(), and ion::math::ScaleRangeNonUniformly().
|
inline |
Definition at line 136 of file range.h.
Referenced by ion::math::Range< Dimension, T >::ContainsRange(), ion::math::Range< Dimension, T >::ExtendByRange(), ion::math::Range< Dimension, T >::IntersectsRange(), ion::math::ModulateRange(), ion::math::RangeIntersection(), ion::math::RangesAlmostEqual(), ion::math::ScaleRange(), and ion::math::ScaleRangeNonUniformly().
|
inline |
Returns the minimum or maximum endpoint.
If the Range is empty, these points will likely not be very useful.
Definition at line 135 of file range.h.
Referenced by ion::math::Range< Dimension, T >::ContainsRange(), ion::math::Range< Dimension, T >::ExtendByRange(), ion::math::Range< Dimension, T >::IntersectsRange(), ion::math::ModulateRange(), ion::math::RangeIntersection(), ion::math::RangesAlmostEqual(), ion::math::ScaleRange(), and ion::math::ScaleRangeNonUniformly().
|
inline |
Returns the size of the range, or the zero vector if the Range is empty.
Definition at line 161 of file range.h.
References ion::math::Range< Dimension, T >::IsEmpty(), and ion::math::Vector< Dimension, T >::Zero().
Referenced by ion::math::NVolume().
bool ion::math::Range< Dimension, T >::IntersectsRange | ( | const Range< Dimension, T > & | r | ) | const |
Returns true if this Range overlaps the given Range, i.e., there exists at least one point contained in both ranges.
Definition at line 327 of file range.h.
References ion::math::Range< Dimension, T >::GetMaxPoint(), and ion::math::Range< Dimension, T >::GetMinPoint().
|
inline |
Returns true if the Range is empty, meaning that the minimum value is strictly greater than the maximum value in some dimension.
Default implementation; faster specialized versions are found below.
Definition at line 264 of file range.h.
Referenced by ion::math::Range< Dimension, T >::ExtendByRange(), ion::math::Range< Dimension, T >::GetCenter(), ion::math::Range< Dimension, T >::GetSize(), ion::math::ModulateRange(), ion::math::NVolume(), ion::math::RangeIntersection(), ion::math::RangesAlmostEqual(), ion::math::ScaleRange(), and ion::math::ScaleRangeNonUniformly().
|
inline |
Sets the Range to be empty.
Specializations for higher performance.
Implementation.
Default implementation; faster specialized versions are found below.
Definition at line 254 of file range.h.
Referenced by ion::math::Range< Dimension, T >::Range().
|
inline |
Definition at line 143 of file range.h.
Referenced by ion::math::operator>>(), and ion::math::Range< Dimension, T >::Range().
void ion::math::Range< Dimension, T >::SetMaxComponent | ( | int | i, |
T | value | ||
) |
|
inline |
void ion::math::Range< Dimension, T >::SetMinComponent | ( | int | i, |
T | value | ||
) |
|
inline |
|
inline |