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

Ray in Dim-dimensional space. More...

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

Public Types

using value_type = T
 

Public Member Functions

constexpr Ray () noexcept=default
 Default constructor.
 
constexpr Ray (Ray const &) noexcept=default
 Copy constructor.
 
template<std::convertible_to< T > U>
constexpr Ray (Ray< Dim, U > const &other) noexcept
 Converting constructor from a ray with a different scalar type.
 
constexpr Ray (Vec< Dim, T > origin, Vec< Dim, T > direction) noexcept
 Constructs a ray from an origin point and a direction vector.
 
constexpr AABB< Dim, T > aabb () const noexcept
 Returns the AABB of the ray.
 
constexpr Vec< Dim, T > at (T t) const
 Returns the point at distance t along the ray.
 
constexpr T diameter () const noexcept
 Returns the diameter of the ray.
 
constexpr bool isDegenerate () const noexcept
 Returns whether the ray is degenerate.
 
bool operator== (Ray const &) const =default
 Equality operator.
 
constexpr T volume () const noexcept
 Returns the volume of the ray.
 

Static Public Member Functions

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

Public Attributes

Vec< Dim, T > direction
 The direction of the ray.
 
Vec< Dim, T > origin
 The origin of the ray.
 

Detailed Description

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

Ray 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 ray defined by an origin point and a direction vector.

Definition at line 66 of file ray.hpp.

Member Typedef Documentation

◆ value_type

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

Definition at line 67 of file ray.hpp.

Constructor & Destructor Documentation

◆ Ray() [1/2]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Ray< Dim, T >::Ray ( Vec< Dim, T >  origin,
Vec< Dim, T >  direction 
)
inlineconstexprnoexcept

Constructs a ray from an origin point and a direction vector.

Parameters
[in]originThe origin of the ray.
[in]directionThe direction of the ray.

The direction is not automatically normalized.

Definition at line 98 of file ray.hpp.

◆ Ray() [2/2]

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

Converting constructor from a ray with a different scalar type.

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

Definition at line 109 of file ray.hpp.

Member Function Documentation

◆ aabb()

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

Returns the AABB of the ray.

Returns
The AABB.

Definition at line 160 of file ray.hpp.

◆ at()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr Vec< Dim, T > ufo::Ray< Dim, T >::at ( t) const
inlineconstexpr

Returns the point at distance t along the ray.

Parameters
[in]tThe distance along the ray.
Returns
The point at distance t.

Definition at line 125 of file ray.hpp.

◆ diameter()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr T ufo::Ray< Dim, T >::diameter ( ) const
inlineconstexprnoexcept

Returns the diameter of the ray.

Returns
The diameter (always infinity).

Definition at line 151 of file ray.hpp.

◆ dimension()

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

Returns the dimensionality of the ray.

Returns
The dimensionality.

Definition at line 118 of file ray.hpp.

◆ isDegenerate()

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

Returns whether the ray is degenerate.

Returns
true if degenerate, false otherwise.

Definition at line 136 of file ray.hpp.

◆ volume()

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr T ufo::Ray< Dim, T >::volume ( ) const
inlineconstexprnoexcept

Returns the volume of the ray.

Returns
The volume (always 0).

Definition at line 145 of file ray.hpp.

Member Data Documentation

◆ direction

template<std::size_t Dim = 3, std::floating_point T = float>
Vec<Dim, T> ufo::Ray< Dim, T >::direction

The direction of the ray.

It is recommended that the direction is normalized for most geometric tests.

Definition at line 79 of file ray.hpp.

◆ origin

template<std::size_t Dim = 3, std::floating_point T = float>
Vec<Dim, T> ufo::Ray< Dim, T >::origin

The origin of the ray.

Definition at line 72 of file ray.hpp.


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