|
|
|
|
@ -76,16 +76,13 @@ template<UnsignedInt dimensions, class T> class Range {
|
|
|
|
|
* |
|
|
|
|
* Construct zero-size range positioned at origin. |
|
|
|
|
*/ |
|
|
|
|
constexpr /*implicit*/ Range(ZeroInitT = ZeroInit): _min{ZeroInit}, _max{ZeroInit} {} |
|
|
|
|
constexpr /*implicit*/ Range(ZeroInitT = ZeroInit) noexcept: _min{ZeroInit}, _max{ZeroInit} {} |
|
|
|
|
|
|
|
|
|
/** @brief Construct without initializing the contents */ |
|
|
|
|
explicit Range(NoInitT): _min{NoInit}, _max{NoInit} {} |
|
|
|
|
explicit Range(NoInitT) noexcept: _min{NoInit}, _max{NoInit} {} |
|
|
|
|
|
|
|
|
|
/** @brief Construct range from minimal and maximal coordinates */ |
|
|
|
|
constexpr /*implicit*/ Range(const VectorType& min, const VectorType& max): _min{min}, _max{max} {} |
|
|
|
|
|
|
|
|
|
/** @brief Copy constructor */ |
|
|
|
|
constexpr Range(const Range<dimensions, T>&) = default; |
|
|
|
|
constexpr /*implicit*/ Range(const VectorType& min, const VectorType& max) noexcept: _min{min}, _max{max} {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Construct range from another of different type |
|
|
|
|
@ -97,11 +94,14 @@ template<UnsignedInt dimensions, class T> class Range {
|
|
|
|
|
* Range2D<Byte> integral(floatingPoint); // {{1, 2}, {-15, 7}}
|
|
|
|
|
* @endcode |
|
|
|
|
*/ |
|
|
|
|
template<class U> constexpr explicit Range(const Range<dimensions, U>& other): _min(other._min), _max(other._max) {} |
|
|
|
|
template<class U> constexpr explicit Range(const Range<dimensions, U>& other) noexcept: _min(other._min), _max(other._max) {} |
|
|
|
|
|
|
|
|
|
/** @brief Construct range from external representation */ |
|
|
|
|
template<class U, class V = decltype(Implementation::RangeConverter<dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Range(const U& other): Range{Implementation::RangeConverter<dimensions, T, U>::from(other)} {} |
|
|
|
|
|
|
|
|
|
/** @brief Copy constructor */ |
|
|
|
|
constexpr /*implicit*/ Range(const Range<dimensions, T>&) noexcept = default; |
|
|
|
|
|
|
|
|
|
/** @brief Convert range to external representation */ |
|
|
|
|
template<class U, class V = decltype(Implementation::RangeConverter<dimensions, T, U>::to(std::declval<Range<dimensions, T>>()))> constexpr explicit operator U() const { |
|
|
|
|
return Implementation::RangeConverter<dimensions, T, U>::to(*this); |
|
|
|
|
@ -230,7 +230,7 @@ See @ref Range for more information.
|
|
|
|
|
template<class T> class Range2D: public Range<2, T> { |
|
|
|
|
public: |
|
|
|
|
/** @copydoc Range(ZeroInitT) */ |
|
|
|
|
constexpr /*implicit*/ Range2D(ZeroInitT = ZeroInit) |
|
|
|
|
constexpr /*implicit*/ Range2D(ZeroInitT = ZeroInit) noexcept |
|
|
|
|
/** @todoc remove workaround when doxygen is sane */ |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
/* MSVC 2015 can't handle {} here */ |
|
|
|
|
@ -239,7 +239,7 @@ template<class T> class Range2D: public Range<2, T> {
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(NoInitT) */ |
|
|
|
|
explicit Range2D(NoInitT) |
|
|
|
|
explicit Range2D(NoInitT) noexcept |
|
|
|
|
/** @todoc remove workaround when doxygen is sane */ |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
/* MSVC 2015 can't handle {} here */ |
|
|
|
|
@ -248,13 +248,10 @@ template<class T> class Range2D: public Range<2, T> {
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const VectorType&, const VectorType&) */ |
|
|
|
|
constexpr /*implicit*/ Range2D(const Vector2<T>& min, const Vector2<T>& max): Range<2, T>(min, max) {} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range&) */ |
|
|
|
|
constexpr /*implicit*/ Range2D(const Range<2, T>& other): Range<2, T>(other) {} |
|
|
|
|
constexpr /*implicit*/ Range2D(const Vector2<T>& min, const Vector2<T>& max) noexcept: Range<2, T>(min, max) {} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range<dimensions, U>&) */ |
|
|
|
|
template<class U> constexpr explicit Range2D(const Range2D<U>& other): Range<2, T>(other) {} |
|
|
|
|
template<class U> constexpr explicit Range2D(const Range2D<U>& other) noexcept: Range<2, T>(other) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Construct range from external representation |
|
|
|
|
@ -274,6 +271,9 @@ template<class T> class Range2D: public Range<2, T> {
|
|
|
|
|
#endif |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range&) */ |
|
|
|
|
constexpr /*implicit*/ Range2D(const Range<2, T>& other) noexcept: Range<2, T>(other) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Bottom left corner |
|
|
|
|
* |
|
|
|
|
@ -364,7 +364,7 @@ See @ref Range for more information.
|
|
|
|
|
template<class T> class Range3D: public Range<3, T> { |
|
|
|
|
public: |
|
|
|
|
/** @copydoc Range(ZeroInitT) */ |
|
|
|
|
constexpr /*implicit*/ Range3D(ZeroInitT = ZeroInit) |
|
|
|
|
constexpr /*implicit*/ Range3D(ZeroInitT = ZeroInit) noexcept |
|
|
|
|
/** @todoc remove workaround when doxygen is sane */ |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
/* MSVC 2015 can't handle {} here */ |
|
|
|
|
@ -373,7 +373,7 @@ template<class T> class Range3D: public Range<3, T> {
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copybrief Range(NoInitT) */ |
|
|
|
|
explicit Range3D(NoInitT) |
|
|
|
|
explicit Range3D(NoInitT) noexcept |
|
|
|
|
/** @todoc remove workaround when doxygen is sane */ |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
/* MSVC 2015 can't handle {} here */ |
|
|
|
|
@ -382,25 +382,25 @@ template<class T> class Range3D: public Range<3, T> {
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const VectorType&, const VectorType&) */ |
|
|
|
|
constexpr /*implicit*/ Range3D(const Vector3<T>& min, const Vector3<T>& max): Range<3, T>(min, max) {} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range&) */ |
|
|
|
|
constexpr /*implicit*/ Range3D(const Range<3, T>& other): Range<3, T>(other) {} |
|
|
|
|
constexpr /*implicit*/ Range3D(const Vector3<T>& min, const Vector3<T>& max) noexcept: Range<3, T>(min, max) {} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range<dimensions, U>&) */ |
|
|
|
|
template<class U> constexpr explicit Range3D(const Range3D<U>& other): Range<3, T>(other) {} |
|
|
|
|
template<class U> constexpr explicit Range3D(const Range3D<U>& other) noexcept: Range<3, T>(other) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Construct range from external representation |
|
|
|
|
* @todoc Remove workaround when Doxygen no longer chokes on that line |
|
|
|
|
*/ |
|
|
|
|
template<class U, class V = decltype(Implementation::RangeConverter<3, T, U>::from(std::declval<U>()))> constexpr explicit Range3D(const U& other) |
|
|
|
|
template<class U, class V = decltype(Implementation::RangeConverter<3, T, U>::from(std::declval<U>()))> constexpr explicit Range3D(const U& other) noexcept |
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
/* MSVC 2015 can't handle {} here */ |
|
|
|
|
: Range<3, T>(Implementation::RangeConverter<3, T, U>::from(other)) |
|
|
|
|
#endif |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
/** @copydoc Range(const Range&) */ |
|
|
|
|
constexpr /*implicit*/ Range3D(const Range<3, T>& other) noexcept: Range<3, T>(other) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Back bottom left corner |
|
|
|
|
* |
|
|
|
|
|