-
首页
-
C4D R23.110 C++ SDK
#include <range.h>
详细描述
template<typename T>
class maxon::Range< T >
A
Range
represents a closed interval of values min ... max (both bounds are inclusive). If T is a vector type, this is actually a multi-dimensional interval such as a rectangle for two-dimensional vectors or an axis-aligned (bounding) box in three dimensions.
To compare
T
values, range uses
a.LessThanOrEqual(b)
if possible, otherwise
a <= b
. The corresponding order may be a partial order (as it is the case for vectors).
-
Template Parameters
-
T
|
The underlying datatype, either a scalar type, or a vector type where T::ValueType specifies the type of the vector elements.
|
Member Typedef Documentation
◆
ScalarType
构造函数 & 析构函数文档编制
◆
Range()
[1/3]
Constructs an empty range. min is set to the maximum possible value, max to the minimum possible value.
◆
Range()
[2/3]
constexpr
Range
|
(
|
const T &
|
v
|
)
|
|
|
explicit
constexpr
|
Constructs a singleton range containing exactly v.
-
参数
-
[in]
|
v
|
Initial value for the range.
|
◆
Range()
[3/3]
constexpr
Range
|
(
|
const T &
|
rangeMin
,
|
|
|
const T &
|
rangeMax
|
|
)
|
|
|
|
constexpr
|
Constructs the range rangeMin ... rangeMax. If rangeMin is not less than or equal to rangeMax, the range will be empty.
-
参数
-
[in]
|
rangeMin
|
Initial minimum value for the range.
|
[in]
|
rangeMax
|
Initial maximum value for the range.
|
成员函数文档编制
◆
Reset()
Resets the range to its initial state, i.e., to an empty range where min is set to the maximum possible value, max to the minimum possible value.
◆
Set()
[1/2]
Sets this range to a singleton range containing exactly v.
-
参数
-
[in]
|
v
|
Singleton value for the range.
|
◆
Set()
[2/2]
void Set
|
(
|
const T &
|
rangeMin
,
|
|
|
const T &
|
rangeMax
|
|
)
|
|
|
Sets this range to rangeMin ... rangeMax. If rangeMin is not less than or equal to rangeMax, the range will be empty.
-
参数
-
[in]
|
rangeMin
|
Minimum value for the range.
|
[in]
|
rangeMax
|
Maximum value for the range.
|
◆
Add()
[1/3]
Extends this range if necessary so that it encloses p.
-
参数
-
[in]
|
p
|
Value to include in this range.
|
◆
Add()
[2/3]
void Add
|
(
|
const T &
|
rangeMin
,
|
|
|
const T &
|
rangeMax
|
|
)
|
|
|
Extends this range if necessary so that it encloses the range given by rangeMin ... rangeMax. It that range is empty, nothing happens.
-
参数
-
[in]
|
rangeMin
|
Minimum value of the other range to include.
|
[in]
|
rangeMax
|
Maximum value of the other range to include.
|
◆
Add()
[3/3]
void Add
|
(
|
const
Range
< T > &
|
range
|
)
|
|
Extends this range if necessary so that it encloses the other range. It that range is empty, nothing happens.
-
参数
-
[in]
|
range
|
Another range to include in this range.
|
◆
Intersect()
[1/2]
void Intersect
|
(
|
const T &
|
rangeMin
,
|
|
|
const T &
|
rangeMax
|
|
)
|
|
|
Intersects this range with the range given by rangeMin ... rangeMax.
-
参数
-
[in]
|
rangeMin
|
Minimum value of the other range for intersection.
|
[in]
|
rangeMax
|
Maximum value of the other range for intersection.
|
◆
Intersect()
[2/2]
void Intersect
|
(
|
const
Range
< T > &
|
range
|
)
|
|
Intersects this range with the other range.
-
参数
-
[in]
|
range
|
Another range to intersect with.
|
◆
operator+=()
Range
& operator+=
|
(
|
const T &
|
shift
|
)
|
|
Shifts this range by #shift. The value of #shift is added to the minimum and maximum value.
-
参数
-
[in]
|
shift
|
Value to add to the bounds.
|
◆
operator-=()
Range
& operator-=
|
(
|
const T &
|
shift
|
)
|
|
Shifts this range by #shift. The value of #shift is substracted from the minimum and maximum value.
-
参数
-
[in]
|
shift
|
Value to subtract from the bounds.
|
◆
operator+()
Range
operator+
|
(
|
const T &
|
shift
|
)
|
const
|
Returns a new range which is given by this range, shifted by #shift. The value of #shift is added to the minimum and maximum value.
-
参数
-
[in]
|
shift
|
Value to add to the bounds.
|
-
返回
-
New range with shifted bounds.
◆
operator-()
Range
operator-
|
(
|
const T &
|
shift
|
)
|
const
|
Returns a new range which is given by this range, shifted by #shift. The value of #shift is subtracted from the minimum and maximum value.
-
参数
-
[in]
|
shift
|
Value to subtract from the bounds.
|
-
返回
-
New range with shifted bounds.
◆
IsIntersecting()
Bool
IsIntersecting
|
(
|
const
Range
< T > &
|
range
|
)
|
const
|
Tests if this range intersects with the other range
-
参数
-
[in]
|
range
|
Another range to test the intersect with.
|
-
返回
-
Return true if the ranges intersect, false otherwise
◆
IsEmpty()
Returns true if this range is empty. In that case
GetMin()
,
GetMax()
,
GetCenter()
,
GetDimension()
will return a guaranteed, but incorrect value of 0.
-
返回
-
True if range is empty.
◆
IsPopulated()
Bool
IsPopulated
|
(
|
|
)
|
const
|
Returns true if this range is populated.
-
返回
-
True if range is not empty.
◆
GetMin()
Returns the minimum boundary. For an empty range, this will return T(0).
-
返回
-
Minimum boundary, or T(0) for an empty range.
◆
GetMax()
Returns the maximum boundary. For an empty range, this will return T(0).
-
返回
-
Maximum boundary, or T(0) for an empty range.
◆
GetCenter()
Returns the center of the range. For an empty range, this will return T(0).
-
返回
-
Center of the range, or T(0) for an empty range.
◆
GetDimension()
Returns the dimension of range. For an empty range, this will return T(0), otherwise the difference of maximum and minimum value. Note that for integral datatypes this does not calculate the number of elements (which is _maxValue - _minValue + 1). To do so you need to add 1 manually.
-
返回
-
Dimension of the range, or T(0) for an empty range.
◆
Contains()
[1/2]
Bool
Contains
|
(
|
const T &
|
value
|
)
|
const
|
Tests if the given
value
is contained in this range.
-
参数
-
[in]
|
value
|
Value to check.
|
-
返回
-
True if the value is contained in the range.
◆
Contains()
[2/2]
Bool
Contains
|
(
|
const
Range
< T > &
|
value
|
)
|
const
|
Tests if the given
value
is contained in this range.
-
参数
-
[in]
|
value
|
Value to check.
|
-
返回
-
True if the value is contained in the range.
◆
MAXON_OPERATOR_EQUALITY_HASHCODE()
◆
ToString()
Member Data Documentation
◆
_minValue
The inclusive minimum boundary of this range.
◆
_maxValue
The inclusive maximum boundary of this range. If the minimum boundary is not less than or equal to this, the range is empty.