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

n-dimensional axis-aligned rectangle. More...

#include <hyperrectangle.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 hyperrectangle. More...
 
constexpr bool contains (const hyperrectangle &other) const noexcept
 Tests whether another hyperrectangle is contained within this hyperrectangle. More...
 
constexpr vector_type center () const noexcept
 Returns the center position of the hyperrectangle. More...
 
distance (const vector_type &point) const noexcept
 Calculates the signed distance from the hyperrectangle to a point. More...
 
void extend (const vector_type &point) noexcept
 Extends the hyperrectangle to include a point. More...
 
void extend (const hyperrectangle &other) noexcept
 Extends the hyperrectangle to include another hyperrectangle. More...
 
constexpr bool intersects (const hyperrectangle &other) const noexcept
 Tests whether another hyperrectangle intersects this hyperrectangle. More...
 
constexpr vector_type size () const noexcept
 Calculates the size of the hyperrectangle. More...
 
constexpr vector_type extents () const noexcept
 Calculates the extents of the hyperrectangle. More...
 
constexpr bool degenerate () const noexcept
 Returns true if any coordinates of min are greater than max, false otherwise. More...
 
constexpr T volume () const noexcept
 Calculates the volume of the hyperrectangle. More...
 
constexpr vector_type corner (std::size_t index) const noexcept
 Returns the nth corner of the hyperrectangle. More...
 

Public Attributes

vector_type min
 Minimum extent of the hyperrectangle. More...
 
vector_type max
 Maximum extent of the hyperrectangle. More...
 

Detailed Description

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

n-dimensional axis-aligned rectangle.

Template Parameters
TReal type.
NNumber of dimensions.

Definition at line 36 of file hyperrectangle.hpp.

Member Typedef Documentation

◆ vector_type

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

Vector type.

Definition at line 39 of file hyperrectangle.hpp.

Member Function Documentation

◆ center()

template<class T , std::size_t N>
constexpr vector_type geom::primitives::hyperrectangle< T, N >::center ( ) const
inlineconstexprnoexcept

Returns the center position of the hyperrectangle.

Definition at line 86 of file hyperrectangle.hpp.

◆ contains() [1/2]

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

Tests whether another hyperrectangle is contained within this hyperrectangle.

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

Definition at line 73 of file hyperrectangle.hpp.

◆ contains() [2/2]

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

Tests whether a point is contained within this hyperrectangle.

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

Definition at line 54 of file hyperrectangle.hpp.

◆ corner()

template<class T , std::size_t N>
constexpr vector_type geom::primitives::hyperrectangle< T, N >::corner ( std::size_t  index) const
inlineconstexprnoexcept

Returns the nth corner of the hyperrectangle.

Parameters
indexIndex of a corner.

Definition at line 189 of file hyperrectangle.hpp.

◆ degenerate()

template<class T , std::size_t N>
constexpr bool geom::primitives::hyperrectangle< T, N >::degenerate ( ) const
inlineconstexprnoexcept

Returns true if any coordinates of min are greater than max, false otherwise.

Definition at line 160 of file hyperrectangle.hpp.

◆ distance()

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

Calculates the signed distance from the hyperrectangle to a point.

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

Definition at line 98 of file hyperrectangle.hpp.

◆ extend() [1/2]

template<class T , std::size_t N>
void geom::primitives::hyperrectangle< T, N >::extend ( const hyperrectangle< T, N > &  other)
inlinenoexcept

Extends the hyperrectangle to include another hyperrectangle.

Parameters
otherHyperrectangle to include in this hyperrectangle.

Definition at line 120 of file hyperrectangle.hpp.

◆ extend() [2/2]

template<class T , std::size_t N>
void geom::primitives::hyperrectangle< T, N >::extend ( const vector_type point)
inlinenoexcept

Extends the hyperrectangle to include a point.

Parameters
pointPoint to include in the hyperrectangle.

Definition at line 109 of file hyperrectangle.hpp.

◆ extents()

template<class T , std::size_t N>
constexpr vector_type geom::primitives::hyperrectangle< T, N >::extents ( ) const
inlineconstexprnoexcept

Calculates the extents of the hyperrectangle.

Definition at line 152 of file hyperrectangle.hpp.

◆ intersects()

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

Tests whether another hyperrectangle intersects this hyperrectangle.

Parameters
otherHyperrectangle to test for intersection.
Returns
true if the hyperrectangle intersects this hyperrectangle, false otherwise.

Definition at line 133 of file hyperrectangle.hpp.

◆ size()

template<class T , std::size_t N>
constexpr vector_type geom::primitives::hyperrectangle< T, N >::size ( ) const
inlineconstexprnoexcept

Calculates the size of the hyperrectangle.

Definition at line 146 of file hyperrectangle.hpp.

◆ volume()

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

Calculates the volume of the hyperrectangle.

Definition at line 174 of file hyperrectangle.hpp.

Member Data Documentation

◆ max

template<class T , std::size_t N>
vector_type geom::primitives::hyperrectangle< T, N >::max

Maximum extent of the hyperrectangle.

Definition at line 45 of file hyperrectangle.hpp.

◆ min

template<class T , std::size_t N>
vector_type geom::primitives::hyperrectangle< T, N >::min

Minimum extent of the hyperrectangle.

Definition at line 42 of file hyperrectangle.hpp.


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