20 #ifndef ANTKEEPER_GEOM_PRIMITIVES_VIEW_FRUSTUM_HPP
21 #define ANTKEEPER_GEOM_PRIMITIVES_VIEW_FRUSTUM_HPP
30 namespace primitives {
147 for (std::size_t i = 0; i < 6; ++i)
150 const std::size_t j = i >> 1;
313 using namespace primitives;
T inv_length(const quaternion< T > &q)
Calculates the inverse length of a quaternion.
T constant
Hyperplane constant.
constexpr T distance(const vector_type &point) const noexcept
Calculates the signed distance from the hyperplane to a point.
vector_type normal
Hyperplane normal.
n-dimensional axis-aligned rectangle.
vector_type min
Minimum extent of the hyperrectangle.
vector_type max
Maximum extent of the hyperrectangle.
vector_type center
Hypersphere center.
T radius
Hypersphere radius.
constexpr plane_type & right() noexcept
Returns the right clipping plane.
constexpr const plane_type & right() const noexcept
Returns the right clipping plane.
constexpr const plane_type & far() const noexcept
Returns the far clipping plane.
bool intersects(const sphere_type &sphere) const noexcept
Tests for intersection between a sphere and the view frustum.
constexpr view_frustum() noexcept=default
Constructs a view frustum.
constexpr plane_type & near() noexcept
Returns the near clipping plane.
constexpr const plane_type & bottom() const noexcept
Returns the bottom clipping plane.
bool contains(const sphere_type &sphere) const noexcept
Checks if a sphere is completely contained within the view frustum.
void extract(const matrix_type &matrix) noexcept
Extracts the view frustum planes from a view-projection matrix.
plane_type planes[6]
View frustum clipping planes.
constexpr bool contains(const vector_type &point) const noexcept
Tests whether a point is contained within this view frustum.
constexpr plane_type & left() noexcept
Returns the left clipping plane.
constexpr plane_type & top() noexcept
Returns the top clipping plane.
bool contains(const box_type &box) const noexcept
Checks if an axis-aligned box is completely contained within the view frustum.
constexpr const plane_type & top() const noexcept
Returns the top clipping plane.
constexpr plane_type & far() noexcept
Returns the far clipping plane.
bool intersects(const box_type &box) const noexcept
Tests for intersection between an axis-aligned box and the view frustum.
constexpr const plane_type & near() const noexcept
Returns the near clipping plane.
constexpr const plane_type & left() const noexcept
Returns the left clipping plane.
constexpr plane_type & bottom() noexcept
Returns the bottom clipping plane.
n by m column-major matrix.
constexpr element_type & x() noexcept
Returns a reference to the first element.
constexpr element_type & y() noexcept
Returns a reference to the second element.
constexpr element_type & z() noexcept
Returns a reference to the third element.