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(IdentityInitT = IdentityInit) constexpr noexcept
Identity constructor.
Frustum(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 constexpr
Frustum planes.
auto operator[](std::size_t i) const -> const Vector4<T>& constexpr
Plane at given index.
auto begin() -> Vector4<T>*
First plane.
auto begin() const -> const Vector4<T>* constexpr
auto cbegin() const -> const Vector4<T>* constexpr
auto end() -> Vector4<T>*
(One after) last plane
auto end() const -> const Vector4<T>* constexpr
auto cend() const -> const Vector4<T>* constexpr
auto left() const -> Vector4<T> constexpr
Left plane.
auto right() const -> Vector4<T> constexpr
Right plane.
auto bottom() const -> Vector4<T> constexpr
Bottom plane.
auto top() const -> Vector4<T> constexpr
Top plane.
auto near() const -> Vector4<T> constexpr
Near plane.
auto far() const -> Vector4<T> constexpr
Far plane.

Function documentation

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

Identity constructor.

Equivalent to creating a frustum from an identity matrix.

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>
const Vector4<T>& Magnum::Math::Frustum<T>::operator[](std::size_t i) const constexpr

Plane at given index.

Expects that i is less than 6.

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

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

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

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

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

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.