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

Sphere in Dim-dimensional space. More...

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

Public Types

using value_type = T
 

Public Member Functions

constexpr Sphere () noexcept=default
 Default constructor.
 
constexpr Sphere (Sphere const &) noexcept=default
 Copy constructor.
 
template<std::convertible_to< T > U>
constexpr Sphere (Sphere< Dim, U > const &other) noexcept
 Converting constructor from a sphere with a different scalar type.
 
constexpr Sphere (Vec< Dim, T > const &center, T radius) noexcept
 Constructs a sphere from a center point and a radius.
 
constexpr AABB< Dim, T > aabb () const noexcept
 Returns the AABB of the sphere.
 
constexpr Vec< Dim, T > const & center () const noexcept
 Returns the center of the sphere.
 
constexpr Vec< Dim, T > & center () noexcept
 Returns the center of the sphere.
 
constexpr T diameter () const noexcept
 Returns the diameter of the sphere.
 
constexpr bool isDegenerate () const noexcept
 Returns whether the sphere is degenerate.
 
bool operator== (Sphere const &) const =default
 Equality operator.
 
constexpr T volume () const noexcept
 Returns the volume of the sphere.
 

Static Public Member Functions

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

Public Attributes

Vec< Dim, T > center_
 The center of the sphere.
 
radius
 The radius of the sphere.
 

Detailed Description

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

Sphere 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 sphere defined by a center point and a radius.

Definition at line 67 of file sphere.hpp.

Member Typedef Documentation

◆ value_type

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

Definition at line 68 of file sphere.hpp.

Constructor & Destructor Documentation

◆ Sphere() [1/2]

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

Constructs a sphere from a center point and a radius.

Parameters
[in]centerThe center of the sphere.
[in]radiusThe radius of the sphere.

Definition at line 90 of file sphere.hpp.

◆ Sphere() [2/2]

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

Converting constructor from a sphere with a different scalar type.

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

Definition at line 106 of file sphere.hpp.

Member Function Documentation

◆ aabb()

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

Returns the AABB of the sphere.

Returns
The AABB.

Definition at line 139 of file sphere.hpp.

◆ center() [1/2]

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

Returns the center of the sphere.

Returns
The center.

Definition at line 127 of file sphere.hpp.

◆ center() [2/2]

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

Returns the center of the sphere.

Returns
The center.

Definition at line 121 of file sphere.hpp.

◆ diameter()

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

Returns the diameter of the sphere.

Returns
The diameter.

Definition at line 133 of file sphere.hpp.

◆ dimension()

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

Returns the dimensionality of the sphere.

Returns
The dimensionality.

Definition at line 115 of file sphere.hpp.

◆ isDegenerate()

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

Returns whether the sphere is degenerate.

Returns
true if degenerate, false otherwise.

Definition at line 148 of file sphere.hpp.

◆ volume()

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

Returns the volume of the sphere.

Returns
The volume.

The volume is calculated using the formula V = (pi^n * r^n) / (n * Gamma(n/2 + 1)), where n is the dimensionality of the space and r is the radius.

Definition at line 157 of file sphere.hpp.

Member Data Documentation

◆ center_

template<std::size_t Dim = 3, std::floating_point T = float>
Vec<Dim, T> ufo::Sphere< Dim, T >::center_

The center of the sphere.

Definition at line 73 of file sphere.hpp.

◆ radius

template<std::size_t Dim = 3, std::floating_point T = float>
T ufo::Sphere< Dim, T >::radius

The radius of the sphere.

Definition at line 78 of file sphere.hpp.


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