Antkeeper  0.0.1
Public Types | Public Member Functions | Public Attributes | List of all members
geom::primitive::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...
 
constexpr vector_type closest_point (const vector_type &point) const noexcept
 Calculates the closest point on 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 valid () const noexcept
 Returns false if any coordinates of min are greater than max. More...
 
constexpr T volume () const noexcept
 Calculates the volume 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::primitive::hyperrectangle< T, N >

n-dimensional axis-aligned rectangle.

Template Parameters
TReal type.
NNumber of dimensions.

Definition at line 37 of file hyperrectangle.hpp.

Member Typedef Documentation

◆ vector_type

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

Vector type.

Definition at line 40 of file hyperrectangle.hpp.

Member Function Documentation

◆ center()

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

Returns the center position of the hyperrectangle.

Definition at line 87 of file hyperrectangle.hpp.

◆ closest_point()

template<class T , std::size_t N>
constexpr vector_type geom::primitive::hyperrectangle< T, N >::closest_point ( const vector_type point) const
inlineconstexprnoexcept

Calculates the closest point on the hyperrectangle to a point.

Parameters
pointInput point.
Returns
Closest point on the hyperrectangle to point.

Definition at line 112 of file hyperrectangle.hpp.

◆ contains() [1/2]

template<class T , std::size_t N>
constexpr bool geom::primitive::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 74 of file hyperrectangle.hpp.

◆ contains() [2/2]

template<class T , std::size_t N>
constexpr bool geom::primitive::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 55 of file hyperrectangle.hpp.

◆ distance()

template<class T , std::size_t N>
T geom::primitive::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 99 of file hyperrectangle.hpp.

◆ extend() [1/2]

template<class T , std::size_t N>
void geom::primitive::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 144 of file hyperrectangle.hpp.

◆ extend() [2/2]

template<class T , std::size_t N>
void geom::primitive::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 133 of file hyperrectangle.hpp.

◆ extents()

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

Calculates the extents of the hyperrectangle.

Definition at line 176 of file hyperrectangle.hpp.

◆ intersects()

template<class T , std::size_t N>
constexpr bool geom::primitive::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 157 of file hyperrectangle.hpp.

◆ size()

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

Calculates the size of the hyperrectangle.

Definition at line 170 of file hyperrectangle.hpp.

◆ valid()

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

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

Definition at line 184 of file hyperrectangle.hpp.

◆ volume()

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

Calculates the volume of the hyperrectangle.

Definition at line 197 of file hyperrectangle.hpp.

Member Data Documentation

◆ max

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

Maximum extent of the hyperrectangle.

Definition at line 46 of file hyperrectangle.hpp.

◆ min

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

Minimum extent of the hyperrectangle.

Definition at line 43 of file hyperrectangle.hpp.


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