UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
ufo::Frustum< Dim, T > Struct Template Reference

Frustum in Dim-dimensional space. More...

#include <lib/geometry/include/ufo/geometry/frustum.hpp>

Public Types

using value_type = T
 

Public Member Functions

constexpr Frustum () noexcept=default
 Default constructor.
 
constexpr Frustum (Frustum const &) noexcept=default
 Copy constructor.
 
template<std::convertible_to< T > U>
constexpr Frustum (Frustum< Dim, U > const &other) noexcept
 Converting constructor from a frustum with a different scalar type.
 
constexpr Frustum (Vec< 2, T > const &far_right, Vec< 2, T > const &far_left, Vec< 2, T > const &near_left, Vec< 2, T > const &near_right)
 Constructs a 2D frustum from four points.
 
constexpr Frustum (Vec< 2, T > const &pos, Vec< 2, T > const &target, T fov, T near_dist, T far_dist)
 Constructs a 2D frustum from a camera-like setup.
 
constexpr Frustum (Vec< 3, T > const &far_top_right, Vec< 3, T > const &far_top_left, Vec< 3, T > const &far_bottom_left, Vec< 3, T > const &far_bottom_right, Vec< 3, T > const &near_top_right, Vec< 3, T > const &near_top_left, Vec< 3, T > const &near_bottom_left, Vec< 3, T > const &near_bottom_right)
 Constructs a 3D frustum from eight points.
 
constexpr Frustum (Vec< 3, T > const &pos, Vec< 3, T > const &target, Vec< 3, T > const &up, T vertical_fov, T horizontal_fov, T near_distance, T far_distance)
 Constructs a 3D frustum from a camera-like setup.
 
constexpr AABB< Dim, T > aabb () const noexcept
 Returns the AABB of the frustum.
 
constexpr Vec< Dim, T > center () const noexcept
 Returns the center of the frustum.
 
constexpr bool isDegenerate () const noexcept
 Returns whether the frustum is degenerate.
 
bool operator== (Frustum const &) const =default
 Equality operator.
 
constexpr auto & operator[] (this auto &self, std::size_t pos) noexcept
 Accesses the plane at position pos.
 

Static Public Member Functions

static constexpr std::size_t dimension () noexcept
 Returns the dimensionality of the frustum.
 

Public Attributes

std::array< Plane< Dim, T >, 2 *Dim > planes
 The planes defining the frustum.
 

Detailed Description

template<std::size_t Dim = 3, std::floating_point T = float>
struct ufo::Frustum< Dim, T >

Frustum in Dim-dimensional space.

Template Parameters
DimThe dimensionality of the space (default: 3).
TThe numeric type (default: float), must be a floating-point type.

Represents a frustum defined by 2*Dim planes.

Definition at line 68 of file frustum.hpp.

Member Typedef Documentation

◆ value_type

template<std::size_t Dim = 3, std::floating_point T = float>
using ufo::Frustum< Dim, T >::value_type = T

Definition at line 69 of file frustum.hpp.

Constructor & Destructor Documentation

◆ Frustum() [1/5]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Frustum< Dim, T >::Frustum ( Vec< 2, T > const &  far_right,
Vec< 2, T > const &  far_left,
Vec< 2, T > const &  near_left,
Vec< 2, T > const &  near_right 
)
inlineconstexpr

Constructs a 2D frustum from four points.

Parameters
[in]far_rightThe far-right point.
[in]far_leftThe far-left point.
[in]near_leftThe near-left point.
[in]near_rightThe near-right point.

Definition at line 94 of file frustum.hpp.

◆ Frustum() [2/5]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Frustum< Dim, T >::Frustum ( Vec< 2, T > const &  pos,
Vec< 2, T > const &  target,
fov,
near_dist,
far_dist 
)
inlineconstexpr

Constructs a 2D frustum from a camera-like setup.

Parameters
[in]posThe position of the eye.
[in]targetThe target point.
[in]fovThe field of view in radians.
[in]near_distThe near clip distance.
[in]far_distThe far clip distance.

Definition at line 113 of file frustum.hpp.

◆ Frustum() [3/5]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Frustum< Dim, T >::Frustum ( Vec< 3, T > const &  far_top_right,
Vec< 3, T > const &  far_top_left,
Vec< 3, T > const &  far_bottom_left,
Vec< 3, T > const &  far_bottom_right,
Vec< 3, T > const &  near_top_right,
Vec< 3, T > const &  near_top_left,
Vec< 3, T > const &  near_bottom_left,
Vec< 3, T > const &  near_bottom_right 
)
inlineconstexpr

Constructs a 3D frustum from eight points.

Parameters
[in]far_top_rightThe far-top-right point.
[in]far_top_leftThe far-top-left point.
[in]far_bottom_leftThe far-bottom-left point.
[in]far_bottom_rightThe far-bottom-right point.
[in]near_top_rightThe near-top-right point.
[in]near_top_leftThe near-top-left point.
[in]near_bottom_leftThe near-bottom-left point.
[in]near_bottom_rightThe near-bottom-right point.

Definition at line 146 of file frustum.hpp.

◆ Frustum() [4/5]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Frustum< Dim, T >::Frustum ( Vec< 3, T > const &  pos,
Vec< 3, T > const &  target,
Vec< 3, T > const &  up,
vertical_fov,
horizontal_fov,
near_distance,
far_distance 
)
inlineconstexpr

Constructs a 3D frustum from a camera-like setup.

Parameters
[in]posThe position of the eye.
[in]targetThe target point.
[in]upThe up vector.
[in]vertical_fovThe vertical field of view in radians.
[in]horizontal_fovThe horizontal field of view in radians.
[in]near_distanceThe near clip distance.
[in]far_distanceThe far clip distance.

Definition at line 173 of file frustum.hpp.

◆ Frustum() [5/5]

template<std::size_t Dim = 3, std::floating_point T = float>
template<std::convertible_to< T > U>
constexpr ufo::Frustum< Dim, T >::Frustum ( Frustum< Dim, U > const &  other)
inlineexplicitconstexprnoexcept

Converting constructor from a frustum with a different scalar type.

Template Parameters
UThe scalar type of the other frustum.
Parameters
[in]otherThe other frustum.

Definition at line 222 of file frustum.hpp.

Member Function Documentation

◆ aabb()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr AABB< Dim, T > ufo::Frustum< Dim, T >::aabb ( ) const
inlineconstexprnoexcept

Returns the AABB of the frustum.

Returns
The AABB.

Definition at line 268 of file frustum.hpp.

◆ center()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr Vec< Dim, T > ufo::Frustum< Dim, T >::center ( ) const
inlineconstexprnoexcept

Returns the center of the frustum.

Returns
The center.

Definition at line 254 of file frustum.hpp.

◆ dimension()

template<std::size_t Dim = 3, std::floating_point T = float>
static constexpr std::size_t ufo::Frustum< Dim, T >::dimension ( )
inlinestaticconstexprnoexcept

Returns the dimensionality of the frustum.

Definition at line 232 of file frustum.hpp.

◆ isDegenerate()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr bool ufo::Frustum< Dim, T >::isDegenerate ( ) const
inlineconstexprnoexcept

Returns whether the frustum is degenerate.

Returns
true if degenerate, false otherwise.

Definition at line 280 of file frustum.hpp.

◆ operator[]()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr auto & ufo::Frustum< Dim, T >::operator[] ( this auto &  self,
std::size_t  pos 
)
inlineconstexprnoexcept

Accesses the plane at position pos.

Parameters
[in]posThe position of the plane [0..2*Dim-1].
Returns
A (const) reference to the plane.

Definition at line 240 of file frustum.hpp.

Member Data Documentation

◆ planes

template<std::size_t Dim = 3, std::floating_point T = float>
std::array<Plane<Dim, T>, 2 * Dim> ufo::Frustum< Dim, T >::planes

The planes defining the frustum.

Standard order: 0, 1: X-axis (Left, Right) 2, 3: Y-axis (Bottom, Top) - if Dim >= 2 4, 5: Z-axis (Near, Far) - if Dim >= 3

Definition at line 79 of file frustum.hpp.


The documentation for this struct was generated from the following file: