Antkeeper  0.0.1
Classes | Typedefs | Functions
geom::primitive Namespace Reference

Classes

struct  hyperplane
 n-dimensional plane. More...
 
struct  hyperrectangle
 n-dimensional axis-aligned rectangle. More...
 
struct  hypersphere
 n-dimensional sphere. More...
 
struct  line_segment
 n-dimensional line segment. More...
 
struct  ray
 Half of a line proceeding from an initial point. More...
 

Typedefs

template<class T >
using box = hyperrectangle< T, 3 >
 3-dimensional hyperrectangle. More...
 
template<class T >
using circle = hypersphere< T, 2 >
 2-dimensional hypersphere. More...
 
template<class T >
using line = hyperplane< T, 2 >
 2-dimensional hyperplane. More...
 
template<class T >
using plane = hyperplane< T, 3 >
 3-dimensional hyperplane. More...
 
template<class T >
using rectangle = hyperrectangle< T, 2 >
 2-dimensional hyperrectangle. More...
 
template<class T >
using sphere = hypersphere< T, 3 >
 3-dimensional hypersphere. More...
 

Functions

template<class T , std::size_t N>
std::optional< std::tuple< T, T > > intersection (const ray< T, N > &ray, const hypersphere< T, N > &hypersphere) noexcept
 Ray-hypersphere intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hyperrectangle< T, N > &a, const hyperrectangle< T, N > &b) noexcept
 Hyperrectangle-hyperrectangle intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hypersphere< T, N > &a, const hypersphere< T, N > &b) noexcept
 Hypersphere-hypersphere intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< T > intersection (const ray< T, N > &ray, const hyperplane< T, N > &hyperplane) noexcept
 Ray-hyperplane intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< T > intersection (const hyperplane< T, N > &hyperplane, const ray< T, N > &ray) noexcept
 Ray-hyperplane intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< std::tuple< T, T > > intersection (const ray< T, N > &ray, const hyperrectangle< T, N > &hyperrectangle) noexcept
 Ray-hyperrectangle intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< std::tuple< T, T > > intersection (const hyperrectangle< T, N > &hyperrectangle, const ray< T, N > &ray) noexcept
 Ray-hyperrectangle intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hyperrectangle< T, N > &hyperrectangle, const hypersphere< T, N > &hypersphere) noexcept
 Hyperrectangle-hypersphere intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hypersphere< T, N > &hypersphere, const hyperrectangle< T, N > &hyperrectangle) noexcept
 Hyperrectangle-hypersphere intersection test. More...
 

Typedef Documentation

◆ box

template<class T >
using geom::primitive::box = typedef hyperrectangle<T, 3>

3-dimensional hyperrectangle.

Template Parameters
TReal type.

Definition at line 34 of file box.hpp.

◆ circle

template<class T >
using geom::primitive::circle = typedef hypersphere<T, 2>

2-dimensional hypersphere.

Template Parameters
TReal type.

Definition at line 34 of file circle.hpp.

◆ line

template<class T >
using geom::primitive::line = typedef hyperplane<T, 2>

2-dimensional hyperplane.

Template Parameters
TReal type.

Definition at line 34 of file line.hpp.

◆ plane

template<class T >
using geom::primitive::plane = typedef hyperplane<T, 3>

3-dimensional hyperplane.

Template Parameters
TReal type.

Definition at line 34 of file primitives/plane.hpp.

◆ rectangle

template<class T >
using geom::primitive::rectangle = typedef hyperrectangle<T, 2>

2-dimensional hyperrectangle.

Template Parameters
TReal type.

Definition at line 34 of file rectangle.hpp.

◆ sphere

template<class T >
using geom::primitive::sphere = typedef hypersphere<T, 3>

3-dimensional hypersphere.

Template Parameters
TReal type.

Definition at line 34 of file primitives/sphere.hpp.

Function Documentation

◆ intersection() [1/9]

template<class T , std::size_t N>
constexpr std::optional<T> geom::primitive::intersection ( const hyperplane< T, N > &  hyperplane,
const ray< T, N > &  ray 
)
inlineconstexprnoexcept

Ray-hyperplane intersection test.

Parameters
rayRay.
hyperplaneHyperplane.
Returns
Distance along the ray to the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 57 of file primitives/intersection.hpp.

◆ intersection() [2/9]

template<class T , std::size_t N>
constexpr bool geom::primitive::intersection ( const hyperrectangle< T, N > &  a,
const hyperrectangle< T, N > &  b 
)
inlineconstexprnoexcept

Hyperrectangle-hyperrectangle intersection test.

Parameters
aFirst hyperrectangle.
bSecond hyperrectangle.
Returns
true if an intersection occurred, false otherwise.

Definition at line 148 of file primitives/intersection.hpp.

◆ intersection() [3/9]

template<class T , std::size_t N>
constexpr bool geom::primitive::intersection ( const hyperrectangle< T, N > &  hyperrectangle,
const hypersphere< T, N > &  hypersphere 
)
constexprnoexcept

Hyperrectangle-hypersphere intersection test.

Parameters
hyperrectangleHyperrectangle.
hypersphereHypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 163 of file primitives/intersection.hpp.

◆ intersection() [4/9]

template<class T , std::size_t N>
constexpr std::optional<std::tuple<T, T> > geom::primitive::intersection ( const hyperrectangle< T, N > &  hyperrectangle,
const ray< T, N > &  ray 
)
inlineconstexprnoexcept

Ray-hyperrectangle intersection test.

Parameters
rayRay.
hyperrectangleHyperrectangle.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.

Definition at line 101 of file primitives/intersection.hpp.

◆ intersection() [5/9]

template<class T , std::size_t N>
constexpr bool geom::primitive::intersection ( const hypersphere< T, N > &  a,
const hypersphere< T, N > &  b 
)
inlineconstexprnoexcept

Hypersphere-hypersphere intersection test.

Parameters
aFirst hypersphere.
bSecond hypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 199 of file primitives/intersection.hpp.

◆ intersection() [6/9]

template<class T , std::size_t N>
constexpr bool geom::primitive::intersection ( const hypersphere< T, N > &  hypersphere,
const hyperrectangle< T, N > &  hyperrectangle 
)
inlineconstexprnoexcept

Hyperrectangle-hypersphere intersection test.

Parameters
hyperrectangleHyperrectangle.
hypersphereHypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 184 of file primitives/intersection.hpp.

◆ intersection() [7/9]

template<class T , std::size_t N>
constexpr std::optional<T> geom::primitive::intersection ( const ray< T, N > &  ray,
const hyperplane< T, N > &  hyperplane 
)
constexprnoexcept

Ray-hyperplane intersection test.

Parameters
rayRay.
hyperplaneHyperplane.
Returns
Distance along the ray to the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 43 of file primitives/intersection.hpp.

◆ intersection() [8/9]

template<class T , std::size_t N>
constexpr std::optional<std::tuple<T, T> > geom::primitive::intersection ( const ray< T, N > &  ray,
const hyperrectangle< T, N > &  hyperrectangle 
)
constexprnoexcept

Ray-hyperrectangle intersection test.

Parameters
rayRay.
hyperrectangleHyperrectangle.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.

Definition at line 73 of file primitives/intersection.hpp.

◆ intersection() [9/9]

template<class T , std::size_t N>
std::optional<std::tuple<T, T> > geom::primitive::intersection ( const ray< T, N > &  ray,
const hypersphere< T, N > &  hypersphere 
)
noexcept

Ray-hypersphere intersection test.

Parameters
rayRay.
hypersphereHypersphere.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.

Definition at line 116 of file primitives/intersection.hpp.