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

Camera frustum.

Stores camera frustum planes in order left (index 0), right (index 1), bottom (index 2), top (index 3), near (index 4) and far (index 5).

Public static functions

static auto fromMatrix(const Matrix4<T>& m) -> Frustum<T>
Create a frustum from projection matrix.

Constructors, destructors, conversion operators

Frustum() constexpr noexcept
Default constructor.
Frustum(IdentityInitT) explicit constexpr noexcept
Identity constructor.
Frustum(Magnum::NoInitT) explicit noexcept
Construct a frustum without initializing the contents.
Frustum(const Vector4<T>& left, const Vector4<T>& right, const Vector4<T>& bottom, const Vector4<T>& top, const Vector4<T>& near, const Vector4<T>& far) constexpr noexcept
Construct a frustum from plane equations.
template<class U>
Frustum(const Frustum<U>& other) explicit constexpr noexcept
Construct frustum from another of different type.
template<class U, class V = decltype(Implementation::FrustumConverter<T, U>::from(std::declval<U>()))>
Frustum(const U& other) explicit constexpr noexcept
Construct frustum from external representation.
template<class U, class V = decltype(Implementation::FrustumConverter<T, U>::to(std::declval<Frustum<T>>()))>
operator U() const explicit constexpr
Convert frustum to external representation.

Public functions

auto operator==(const Frustum<T>& other) const -> bool
Equality comparison.
auto operator!=(const Frustum<T>& other) const -> bool
Non-equality comparison.
auto data() -> T*
Raw data.
auto data() const -> const T* constexpr
auto planes() const -> Corrade::Containers::StaticArrayView<6, const Vector4<T>> deprecated in 2019.10 constexpr
Frustum planes.
auto operator[](std::size_t i) -> Vector4<T>& new in 2020.06
Plane at given index.
auto operator[](std::size_t i) const -> const Vector4<T>& constexpr
auto begin() -> Vector4<T>* new in 2019.10
First plane.
auto begin() const -> const Vector4<T>* constexpr new in 2019.10
auto cbegin() const -> const Vector4<T>* constexpr new in 2019.10
auto end() -> Vector4<T>* new in 2019.10
(One after) last plane
auto end() const -> const Vector4<T>* constexpr new in 2019.10
auto cend() const -> const Vector4<T>* constexpr new in 2019.10
auto left() -> Vector4<T>& new in 2020.06
Left plane.
auto left() const -> Vector4<T> constexpr
auto right() -> Vector4<T>& new in 2020.06
Right plane.
auto right() const -> Vector4<T> constexpr
auto bottom() -> Vector4<T>& new in 2020.06
Bottom plane.
auto bottom() const -> Vector4<T> constexpr
auto top() -> Vector4<T>& new in 2020.06
Top plane.
auto top() const -> Vector4<T> constexpr
auto near() -> Vector4<T>& new in 2020.06
Near plane.
auto near() const -> Vector4<T> constexpr
auto far() -> Vector4<T>& new in 2020.06
Far plane.
auto far() const -> Vector4<T> constexpr

Function documentation

template<class T>
Magnum::Math::Frustum<T>::Frustum() constexpr noexcept

Default constructor.

Equivalent to Frustum(IdentityInitT).

template<class T>
Magnum::Math::Frustum<T>::Frustum(IdentityInitT) explicit constexpr noexcept

Identity constructor.

Equivalent to creating a frustum from an identity matrix.

template<class T>
Magnum::Math::Frustum<T>::Frustum(const Vector4<T>& left, const Vector4<T>& right, const Vector4<T>& bottom, const Vector4<T>& top, const Vector4<T>& near, const Vector4<T>& far) constexpr noexcept

Construct a frustum from plane equations.

The equations are in a form $ ax + by + cz + d = 0 $ . You can use planeEquation() to calculate the coefficients from a normal and a point.

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

Construct frustum from another of different type.

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

template<class T>
T* Magnum::Math::Frustum<T>::data()

Raw data.

Returns One-dimensional array of length 24.

template<class T>
const T* Magnum::Math::Frustum<T>::data() 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>
Corrade::Containers::StaticArrayView<6, const Vector4<T>> Magnum::Math::Frustum<T>::planes() const constexpr

Frustum planes.

template<class T>
Vector4<T>& Magnum::Math::Frustum<T>::operator[](std::size_t i) new in 2020.06

Plane at given index.

Expects that i is less than 6.

template<class T>
const Vector4<T>& Magnum::Math::Frustum<T>::operator[](std::size_t i) 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>
Vector4<T>* Magnum::Math::Frustum<T>::begin() new in 2019.10

First plane.

Together with end() useful for range access, for example here to check for a point/frustum intersection, similarly to Intersection::pointFrustum():

for(Vector4 plane: frustum)
    if(Math::Distance::pointPlaneScaled(point, plane) < 0.0f) return false;
return true;

template<class T>
const Vector4<T>* Magnum::Math::Frustum<T>::begin() const constexpr new in 2019.10

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>
const Vector4<T>* Magnum::Math::Frustum<T>::cbegin() const constexpr new in 2019.10

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>
const Vector4<T>* Magnum::Math::Frustum<T>::end() const constexpr new in 2019.10

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>
const Vector4<T>* Magnum::Math::Frustum<T>::cend() const constexpr new in 2019.10

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>
Vector4<T> Magnum::Math::Frustum<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>
Vector4<T> Magnum::Math::Frustum<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>
Vector4<T> Magnum::Math::Frustum<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>
Vector4<T> Magnum::Math::Frustum<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>
Vector4<T> Magnum::Math::Frustum<T>::near() 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>
Vector4<T> Magnum::Math::Frustum<T>::far() 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> template<class T>
Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Frustum<T>& value)

Debug output operator.