Regina 7.0 Calculation Engine
Public Member Functions | List of all members
regina::FacePair Class Reference

Represents a pair of tetrahedron face numbers. More...

#include <triangulation/facepair.h>

Public Member Functions

 FacePair ()
 Creates a new face pair (0,1). More...
 
 FacePair (int first, int second)
 Creates a new face pair from the two given face numbers. More...
 
 FacePair (const FacePair &)=default
 Creates a new face pair that is a clone of the given pair. More...
 
int lower () const
 Returns the smaller of the two face numbers in this pair. More...
 
int upper () const
 Returns the larger of the two face numbers in this pair. More...
 
bool isBeforeStart () const
 Determines if this face pair represents a before-the-start value. More...
 
bool isPastEnd () const
 Determines if this face pair represents a past-the-end value. More...
 
FacePair complement () const
 Returns the complement of this face pair. More...
 
FacePairoperator= (const FacePair &cloneMe)=default
 Sets this face pair to be a copy of the given pair. More...
 
bool operator== (const FacePair &other) const
 Determines if this and the given face pair are equal. More...
 
bool operator!= (const FacePair &other) const
 Determines if this and the given face pair are not equal. More...
 
bool operator< (const FacePair &other) const
 Determines if this is less than the given face pair. More...
 
bool operator> (const FacePair &other) const
 Determines if this is greater than the given face pair. More...
 
bool operator<= (const FacePair &other) const
 Determines if this is less than or equal to the given face pair. More...
 
bool operator>= (const FacePair &other) const
 Determines if this is greater than or equal to the given face pair. More...
 
FacePairoperator++ ()
 Increments this face pair. More...
 
FacePair operator++ (int)
 Increments this face pair. More...
 
FacePairoperator-- ()
 Decrements this face pair. More...
 
FacePair operator-- (int)
 Decrements this face pair. More...
 
int commonEdge () const
 Identifies the tetrahedron edge that is common to both faces in this pair. More...
 
int oppositeEdge () const
 Identifies the tetrahedron edge that belongs to neither of the two faces in this pair. More...
 

Detailed Description

Represents a pair of tetrahedron face numbers.

Note that we are not storing triangle numbers in a triangulation skeleton, but merely face numbers 0, 1, 2 and 3 in a single tetrahedron. Thus there are only six possible face pairs; this class merely makes working with such pairs more convenient.

As well as providing the six possible face pairs, there is also a before-the-start and a past-the-end value; this (combined with the increment operator) allows for iteration through face pairs.

When iterating through face pairs, the ordering will be the lexicographical ordering (0,1), (0,2), (0,3), (1,2), (1,3), (2,3).

The before-the-start and past-the-end values are internally represented as (0,0) and (3,3) respectively.

These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.

Constructor & Destructor Documentation

◆ FacePair() [1/3]

regina::FacePair::FacePair ( )
inline

Creates a new face pair (0,1).

◆ FacePair() [2/3]

regina::FacePair::FacePair ( int  first,
int  second 
)
inline

Creates a new face pair from the two given face numbers.

The two given numbers need not be in any particular order.

Precondition
The two given face numbers must be distinct integers between 0 and 3 inclusive.
Parameters
firstthe first face number in the new pair.
secondthe second face number in the new pair.

◆ FacePair() [3/3]

regina::FacePair::FacePair ( const FacePair )
default

Creates a new face pair that is a clone of the given pair.

Member Function Documentation

◆ commonEdge()

int regina::FacePair::commonEdge ( ) const
inline

Identifies the tetrahedron edge that is common to both faces in this pair.

This will be a tetrahedron edge number, between 0 and 5 inclusive. Note that edges commonEdge() and oppositeEdge() will be opposite edges in the tetrahedron.

Precondition
This face pair is neither before-the-start nor past-the-end.
Returns
the edge that belongs to both faces in this pair.

◆ complement()

FacePair regina::FacePair::complement ( ) const
inline

Returns the complement of this face pair.

The complement is the pair containing the two faces not included in this face pair.

Precondition
This face pair is neither before-the-start nor past-the-end.
Returns
the complement of this face pair.

◆ isBeforeStart()

bool regina::FacePair::isBeforeStart ( ) const
inline

Determines if this face pair represents a before-the-start value.

Returns
true if and only if this face pair is before-the-start.

◆ isPastEnd()

bool regina::FacePair::isPastEnd ( ) const
inline

Determines if this face pair represents a past-the-end value.

Returns
true if and only if this face pair is past-the-end.

◆ lower()

int regina::FacePair::lower ( ) const
inline

Returns the smaller of the two face numbers in this pair.

Precondition
This face pair is neither before-the-start or past-the-end.
Returns
the lower face number.

◆ operator!=()

bool regina::FacePair::operator!= ( const FacePair other) const
inline

Determines if this and the given face pair are not equal.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this and the given pair are not equal.

◆ operator++() [1/2]

FacePair & regina::FacePair::operator++ ( )

Increments this face pair.

It will be set to the following face pair in the lexicographical ordering, or to a past-the-end value if there are no more face pairs.

This is a preincrement operator: the object will be changed, and then a reference to it will be returned.

Precondition
This face pair is not currently past-the-end.
Python
This routine is not available; however, the postincrement operator is available under the name inc().
Returns
a reference to this object.

◆ operator++() [2/2]

FacePair regina::FacePair::operator++ ( int  )
inline

Increments this face pair.

It will be set to the following face pair in the lexicographical ordering, or to a past-the-end value if there are no more face pairs.

This is a postincrement operator: the object will be changed, but a copy of the original reference will be returned.

Precondition
This face pair is not currently past-the-end.
Python
This routine is available under the name inc().
Returns
a copy of this object before the change took place.

◆ operator--() [1/2]

FacePair & regina::FacePair::operator-- ( )

Decrements this face pair.

It will be set to the previous face pair in the lexicographical ordering, or to a before-the-start value if there are no previous face pairs.

This is a predecrement operator: the object will be changed, and then a reference to it will be returned.

Precondition
This face pair is not currently before-the-start.
Python
This routine is not available; however, the postdecrement operator is available under the name dec().
Returns
a reference to this object.

◆ operator--() [2/2]

FacePair regina::FacePair::operator-- ( int  )
inline

Decrements this face pair.

It will be set to the previous face pair in the lexicographical ordering, or to a before-the-start value if there are no previous face pairs.

This is a postdecrement operator: the object will be changed, but a copy of the original reference will be returned.

Precondition
This face pair is not currently before-the-start.
Python
This routine is available under the name dec().
Returns
a copy of this object before the change took place.

◆ operator<()

bool regina::FacePair::operator< ( const FacePair other) const
inline

Determines if this is less than the given face pair.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this is less than other.

◆ operator<=()

bool regina::FacePair::operator<= ( const FacePair other) const
inline

Determines if this is less than or equal to the given face pair.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this is less than or equal to other.

◆ operator=()

FacePair & regina::FacePair::operator= ( const FacePair cloneMe)
default

Sets this face pair to be a copy of the given pair.

Parameters
cloneMethe face pair to clone.
Returns
a reference to this face pair.

◆ operator==()

bool regina::FacePair::operator== ( const FacePair other) const
inline

Determines if this and the given face pair are equal.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this and the given pair are equal.

◆ operator>()

bool regina::FacePair::operator> ( const FacePair other) const
inline

Determines if this is greater than the given face pair.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this is greater than other.

◆ operator>=()

bool regina::FacePair::operator>= ( const FacePair other) const
inline

Determines if this is greater than or equal to the given face pair.

Parameters
otherthe pair to compare with this.
Returns
true if and only if this is greater than or equal to other.

◆ oppositeEdge()

int regina::FacePair::oppositeEdge ( ) const
inline

Identifies the tetrahedron edge that belongs to neither of the two faces in this pair.

This will be a tetrahedron edge number, between 0 and 5 inclusive. Note that edges commonEdge() and oppositeEdge() will be opposite edges in the tetrahedron.

Precondition
This face pair is neither before-the-start nor past-the-end.
Returns
the edge that does not belong to either of these two faces.

◆ upper()

int regina::FacePair::upper ( ) const
inline

Returns the larger of the two face numbers in this pair.

Precondition
This face pair is neither before-the-start or past-the-end.
Returns
the upper face number.

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

Copyright © 1999-2021, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).