template<class T>
Magnum::Math::Range2D class

Two-dimensional range.

See Range for more information.

Base classes

template<UnsignedInt dimensions, class T>
class Range
N-dimensional range.

Constructors, destructors, conversion operators

Range2D(ZeroInitT = ZeroInit) constexpr noexcept
Construct zero range.

Range2D(NoInitT) explicit noexcept
Construct without initializing the contents.

Range2D(const Vector2<T>& min, const Vector2<T>& max) constexpr noexcept
Construct range from minimal and maximal coordinates.
template<class U>
Range2D(const Range2D<U>& other) explicit constexpr noexcept
Construct range from another of different type.
template<class U, class V = decltype(Implementation::RangeConverter<2, T, U>::from(std::declval<U>()))>
Range2D(const U& other) explicit constexpr
Construct range from external representation.
Range2D(const Range<2, T>& other) constexpr noexcept
Copy constructor.

Public functions

auto bottomLeft() -> Vector2<T>&
Bottom left corner.
auto bottomLeft() const -> Vector2<T> constexpr
auto bottomRight() const -> Vector2<T> constexpr
Bottom right corner.
auto topLeft() const -> Vector2<T> constexpr
Top left corner.
auto topRight() -> Vector2<T>&
Top right corner.
auto topRight() const -> Vector2<T> constexpr
auto left() -> T&
Left edge.
auto left() const -> T constexpr
auto right() -> T&
Right edge.
auto right() const -> T constexpr
auto bottom() -> T&
Bottom edge.
auto bottom() const -> T constexpr
auto top() -> T&
Top edge.
auto top() const -> T constexpr
auto sizeX() const -> T
Range width.
auto sizeY() const -> T
Range height.
auto centerX() const -> T
Range center on X axis.
auto centerY() const -> T
Range center on Y axis.

Function documentation

template<class T>
Magnum::Math::Range2D<T>::Range2D(ZeroInitT = ZeroInit) constexpr noexcept

Construct zero range.

Construct zero-size range positioned at origin.

template<class T> template<class U>
Magnum::Math::Range2D<T>::Range2D(const Range2D<U>& other) explicit constexpr noexcept

Construct range from another of different type.

Performs only default casting on the values, no rounding or anything else. Example usage:

Range2D<Float> floatingPoint({1.3f, 2.7f}, {-15.0f, 7.0f});
Range2D<Byte> integral(floatingPoint); // {{1, 2}, {-15, 7}}

template<class T>
Vector2<T>& Magnum::Math::Range2D<T>::bottomLeft()

Bottom left corner.

Equivalent to min().

template<class T>
Vector2<T> Magnum::Math::Range2D<T>::bottomLeft() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
Vector2<T>& Magnum::Math::Range2D<T>::topRight()

Top right corner.

Equivalent to max().

template<class T>
Vector2<T> Magnum::Math::Range2D<T>::topRight() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
T Magnum::Math::Range2D<T>::left() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
T Magnum::Math::Range2D<T>::right() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
T Magnum::Math::Range2D<T>::bottom() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
T Magnum::Math::Range2D<T>::top() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T>
T Magnum::Math::Range2D<T>::sizeX() const

Range width.

template<class T>
T Magnum::Math::Range2D<T>::sizeY() const

Range height.

template<class T>
T Magnum::Math::Range2D<T>::centerX() const

Range center on X axis.

template<class T>
T Magnum::Math::Range2D<T>::centerY() const

Range center on Y axis.