ThunderEgg  1.0.0
ThunderEgg::Face< D, M > Class Template Referenceabstract

Enum-style class for the faces of an n-dimensional cube. More...

#include <Face.h>

Classes

class  Range
 Range class for Face. More...
 

Public Member Functions

 Face (unsigned char value)
 Construct a new Face object. More...
 
 Face ()
 Construct a new Face object with a null value.
 
size_t getIndex () const
 Get the index for this Face. More...
 
template<int N = 0>
auto getAxisIndex () const -> typename std::enable_if< D<=3 &&D >=1 &&M==D - 1 &&N==N, size_t >::type
 Get the axis index of this side.
 
template<int N = 0>
auto isLowerOnAxis () const -> typename std::enable_if< D<=3 &&D >=1 &&M==D - 1 &&N==N, bool >::type
 Return if this side is lower on it's axis.
 
template<int N = 0>
auto isHigherOnAxis () const -> typename std::enable_if< D<=3 &&D >=1 &&M==D - 1 &&N==N, bool >::type
 Return if this side is higher on it's axis.
 
Face< D, M > opposite () const
 Get the face on the opposite side of the hypercube. More...
 
std::array< Face< D, D - 1 >, D - M > getSides () const
 Get the Sides that this Face lies on. More...
 
bool operator< (const Face< D, M > &other) const
 Compare the enum indexes. More...
 
bool operator== (const Face< D, M > &other) const
 Equals operator. More...
 
bool operator!= (const Face< D, M > &other) const
 Not Equals operator. More...
 

Static Public Member Functions

static Face< D, M > null ()
 null value More...
 
template<int N = 0>
static auto west () -> typename std::enable_if< D<=3 &&M==D - 1 &&N==N, Face< D, M >>::type
 west side
 
template<int N = 0>
static auto east () -> typename std::enable_if< D<=3 &&M==D - 1 &&N==N, Face< D, M >>::type
 east side
 
template<int N = 0>
static auto south () -> typename std::enable_if< D<=3 &&D >=2 &&M==D - 1 &&N==N, Face< D, M >>::type
 south side
 
template<int N = 0>
static auto north () -> typename std::enable_if< D<=3 &&D >=2 &&M==D - 1 &&N==N, Face< D, M >>::type
 north side
 
template<int N = 0>
static auto bottom () -> typename std::enable_if< D<=3 &&D >=3 &&M==D - 1 &&N==N, Face< D, M >>::type
 bottom side
 
template<int N = 0>
static auto top () -> typename std::enable_if< D<=3 &&D >=3 &&M==D - 1 &&N==N, Face< D, M >>::type
 top side
 
template<int N = 0>
static auto sw () -> typename std::enable_if< D==2 &&M==0 &&N
 southwest corner
 
template<int N = 0>
static auto se () -> typename std::enable_if< D==2 &&M==0 &&N
 southeast corner
 
template<int N = 0>
static auto nw () -> typename std::enable_if< D==2 &&M==0 &&N
 northwest corner
 
template<int N = 0>
static auto ne () -> typename std::enable_if< D==2 &&M==0 &&N
 northeast corner
 
template<int N = 0>
static auto bsw () -> typename std::enable_if< D==3 &&M==0 &&N
 bottom-south-west corner
 
template<int N = 0>
static auto bse () -> typename std::enable_if< D==3 &&M==0 &&N
 bottom-south-east corner
 
template<int N = 0>
static auto bnw () -> typename std::enable_if< D==3 &&M==0 &&N
 bottom-north-west corner
 
template<int N = 0>
static auto bne () -> typename std::enable_if< D==3 &&M==0 &&N
 bottom-north-east corner
 
template<int N = 0>
static auto tsw () -> typename std::enable_if< D==3 &&M==0 &&N
 top-south-west corner
 
template<int N = 0>
static auto tse () -> typename std::enable_if< D==3 &&M==0 &&N
 top-south-east corner
 
template<int N = 0>
static auto tnw () -> typename std::enable_if< D==3 &&M==0 &&N
 top-north-west corner
 
template<int N = 0>
static auto tne () -> typename std::enable_if< D==3 &&M==0 &&N
 top-north-east corner
 
template<int N = 0>
static auto bs () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 bottom-south edge
 
template<int N = 0>
static auto bn () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 bottom-north edge
 
template<int N = 0>
static auto ts () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 top-south edge
 
template<int N = 0>
static auto tn () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 top-north edge
 
template<int N = 0>
static auto bw () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 bottom-west edge
 
template<int N = 0>
static auto be () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 bottom-east edge
 
template<int N = 0>
static auto tw () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 top-west edge
 
template<int N = 0>
static auto te () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 top-east edge
 
template<int N = 0>
static auto sw () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 south-west edge
 
template<int N = 0>
static auto se () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 south-east edge
 
template<int N = 0>
static auto nw () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 north-west edge
 
template<int N = 0>
static auto ne () -> typename std::enable_if< D==3 &&M==1 &&N==N, Face< D, M >>::type
 north-east edge
 
static Range getValues ()
 Get a range of values that can be iterated over. More...
 

Static Public Attributes

static constexpr int dimensionality = M
 
static constexpr size_t number_of = twopow(D - M) * choose(D, M)
 the number of faces
 
static constexpr size_t sum_of_faces = M <= 0 ? 0 : sum(M - 1)
 

Detailed Description

template<int D, int M>
class ThunderEgg::Face< D, M >

Enum-style class for the faces of an n-dimensional cube.

Template Parameters
Dthe dimension
Mthe dimensionality of the face

For 3D, this class represents corners (M = 0), edges (M = 1), and faces (M = 2).

Constructor & Destructor Documentation

◆ Face()

template<int D, int M>
ThunderEgg::Face< D, M >::Face ( unsigned char  value)
inlineexplicit

Construct a new Face object.

Parameters
valuethe value of the face

Member Function Documentation

◆ getIndex()

template<int D, int M>
size_t ThunderEgg::Face< D, M >::getIndex ( ) const
inline

Get the index for this Face.

Returns
size_t the index

◆ getSides()

template<int D, int M>
std::array<Face<D, D - 1>, D - M> ThunderEgg::Face< D, M >::getSides ( ) const
inline

Get the Sides that this Face lies on.

Returns
std::array<Face<D, D - 1>, D - M> the sides

◆ getValues()

template<int D, int M>
static Range ThunderEgg::Face< D, M >::getValues ( )
inlinestatic

Get a range of values that can be iterated over.

Returns
Range the range of values

◆ null()

template<int D, int M>
static Face<D, M> ThunderEgg::Face< D, M >::null ( )
inlinestatic

null value

Returns
Face<D, M> the null value

◆ operator!=()

template<int D, int M>
bool ThunderEgg::Face< D, M >::operator!= ( const Face< D, M > &  other) const
inline

Not Equals operator.

Parameters
otherThe other side.
Returns
Whether or not the value of this face equals the value other face.

◆ operator<()

template<int D, int M>
bool ThunderEgg::Face< D, M >::operator< ( const Face< D, M > &  other) const
inline

Compare the enum indexes.

Parameters
otherThe other side.
Returns
Whether or not the index of this face is lower than the other face.

◆ operator==()

template<int D, int M>
bool ThunderEgg::Face< D, M >::operator== ( const Face< D, M > &  other) const
inline

Equals operator.

Parameters
otherThe other side.
Returns
Whether or not the value of this face equals the value other face.

◆ opposite()

template<int D, int M>
Face<D, M> ThunderEgg::Face< D, M >::opposite ( ) const
inline

Get the face on the opposite side of the hypercube.

Returns
Face<D, M> the face on the opposite side

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