Antkeeper  0.0.1
Public Types | Public Member Functions | Public Attributes | List of all members
geom::primitives::hypersphere< T, N > Struct Template Reference

n-dimensional sphere. More...

#include <hypersphere.hpp>

Public Types

using vector_type = math::vector< T, N >
 Vector type. More...
 

Public Member Functions

constexpr bool contains (const vector_type &point) const noexcept
 Tests whether a point is contained within this hypersphere. More...
 
constexpr bool contains (const hypersphere &other) const noexcept
 Tests whether another hypersphere is contained within this hypersphere. More...
 
distance (const vector_type &point) const noexcept
 Calculates the signed distance from the hypersphere to a point. More...
 
constexpr bool intersects (const hypersphere &other) const noexcept
 Tests whether another hypersphere intersects this hypersphere. More...
 
constexpr T volume () const noexcept
 Calculates the volume of the hypersphere. More...
 

Public Attributes

vector_type center
 Hypersphere center. More...
 
radius
 Hypersphere radius. More...
 
template<>
static constexpr T volume (T r) noexcept
 Volume calculation helper function. More...
 
template<>
static constexpr T volume (T r) noexcept
 Volume calculation helper function. More...
 

Detailed Description

template<class T, std::size_t N>
struct geom::primitives::hypersphere< T, N >

n-dimensional sphere.

Template Parameters
TReal type.
NNumber of dimensions.

Definition at line 36 of file hypersphere.hpp.

Member Typedef Documentation

◆ vector_type

template<class T , std::size_t N>
using geom::primitives::hypersphere< T, N >::vector_type = math::vector<T, N>

Vector type.

Definition at line 39 of file hypersphere.hpp.

Member Function Documentation

◆ contains() [1/2]

template<class T , std::size_t N>
constexpr bool geom::primitives::hypersphere< T, N >::contains ( const hypersphere< T, N > &  other) const
inlineconstexprnoexcept

Tests whether another hypersphere is contained within this hypersphere.

Parameters
otherHypersphere to test for containment.
Returns
true if the hypersphere is contained within this hypersphere, false otherwise.

Definition at line 66 of file hypersphere.hpp.

◆ contains() [2/2]

template<class T , std::size_t N>
constexpr bool geom::primitives::hypersphere< T, N >::contains ( const vector_type point) const
inlineconstexprnoexcept

Tests whether a point is contained within this hypersphere.

Parameters
pointPoint to test for containment.
Returns
true if the point is contained within this hypersphere, false otherwise.

Definition at line 54 of file hypersphere.hpp.

◆ distance()

template<class T , std::size_t N>
T geom::primitives::hypersphere< T, N >::distance ( const vector_type point) const
inlinenoexcept

Calculates the signed distance from the hypersphere to a point.

Parameters
pointInput point.
Returns
Signed distance from the hypersphere to point.

Definition at line 84 of file hypersphere.hpp.

◆ intersects()

template<class T , std::size_t N>
constexpr bool geom::primitives::hypersphere< T, N >::intersects ( const hypersphere< T, N > &  other) const
inlineconstexprnoexcept

Tests whether another hypersphere intersects this hypersphere.

Parameters
otherHypersphere to test for intersection.
Returns
true if the hypersphere intersects this hypersphere, false otherwise.

Definition at line 97 of file hypersphere.hpp.

◆ volume() [1/3]

template<class T , std::size_t N>
constexpr T geom::primitives::hypersphere< T, N >::volume ( ) const
inlineconstexprnoexcept

Calculates the volume of the hypersphere.

Definition at line 134 of file hypersphere.hpp.

◆ volume() [2/3]

template<class T , std::size_t N>
template<>
static constexpr T geom::primitives::hypersphere< T, N >::volume ( r)
inlinestaticconstexprnoexcept

Volume calculation helper function.

Template Parameters
MDimension.
Parameters
rRadius.
Returns
Volume.

Definition at line 121 of file hypersphere.hpp.

◆ volume() [3/3]

template<class T , std::size_t N>
template<>
static constexpr T geom::primitives::hypersphere< T, N >::volume ( r)
inlinestaticconstexprnoexcept

Volume calculation helper function.

Template Parameters
MDimension.
Parameters
rRadius.
Returns
Volume.

Definition at line 127 of file hypersphere.hpp.

Member Data Documentation

◆ center

template<class T , std::size_t N>
vector_type geom::primitives::hypersphere< T, N >::center

Hypersphere center.

Definition at line 42 of file hypersphere.hpp.

◆ radius

template<class T , std::size_t N>
T geom::primitives::hypersphere< T, N >::radius

Hypersphere radius.

Definition at line 45 of file hypersphere.hpp.


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