Regina 7.3 Calculation Engine
Public Member Functions | Static Public Member Functions | List of all members
regina::SnappedTwoSphere Class Reference

Represents a 2-sphere made from two snapped 3-balls in a triangulation. More...

#include <subcomplex/snappedtwosphere.h>

Inheritance diagram for regina::SnappedTwoSphere:
regina::ShortOutput< SnappedTwoSphere > regina::Output< SnappedTwoSphere, false >

Public Member Functions

 SnappedTwoSphere (const SnappedTwoSphere &)=default
 Creates a new copy of the given structure. More...
 
SnappedTwoSphereoperator= (const SnappedTwoSphere &)=default
 Sets this to be a copy of the given structure. More...
 
const SnappedBallsnappedBall (int index) const
 Returns one of the two snapped 3-balls whose equators are joined. More...
 
bool operator== (const SnappedTwoSphere &other) const
 Determines whether this and the given object represent the same specific presentation of a snapped 2-sphere. More...
 
bool operator!= (const SnappedTwoSphere &other) const
 Determines whether this and the given object represent different specific presentations of a snapped 2-sphere. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this object to the given output stream. More...
 
void writeTextLong (std::ostream &out) const
 A default implementation for detailed output. More...
 
std::string str () const
 Returns a short text representation of this object. More...
 
std::string utf8 () const
 Returns a short text representation of this object using unicode characters. More...
 
std::string detail () const
 Returns a detailed text representation of this object. More...
 

Static Public Member Functions

static std::unique_ptr< SnappedTwoSphererecognise (Tetrahedron< 3 > *tet1, Tetrahedron< 3 > *tet2)
 Determines if the two given tetrahedra together form a snapped 2-sphere. More...
 
static std::unique_ptr< SnappedTwoSphererecognise (const SnappedBall &ball1, const SnappedBall &ball2)
 Determines if the two given snapped 3-balls together form a snapped 2-sphere. More...
 

Detailed Description

Represents a 2-sphere made from two snapped 3-balls in a triangulation.

This occurs when two snapped 3-balls are glued together at their equators (note that this gluing does not have to extend to triangular faces). Each 3-ball has a central disc (bounded by the 3-ball's equator and bisecting its internal degree one edge), and these two discs together form an embedded 2-sphere in the triangulation.

This 2-sphere can be cut along and the two resulting 2-sphere boundaries filled in with 3-balls, and the resulting triangulation has the same number of tetrahedra as the original. If the snapped 2-sphere was separating, the resulting triangulation will contain the two terms of the corresponding connected sum.

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. However, the only way to create them (aside from copying or moving) is via the static member function recognise().

Constructor & Destructor Documentation

◆ SnappedTwoSphere()

regina::SnappedTwoSphere::SnappedTwoSphere ( const SnappedTwoSphere )
default

Creates a new copy of the given structure.

Member Function Documentation

◆ detail()

std::string regina::Output< SnappedTwoSphere , supportsUtf8 >::detail ( ) const
inherited

Returns a detailed text representation of this object.

This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.

Returns
a detailed text representation of this object.

◆ operator!=()

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

Determines whether this and the given object represent different specific presentations of a snapped 2-sphere.

Specifically, two snapped 2-spheres will compare as equal if and only if they slice through the same pair of numbered tetrahedra, presented in the same order, and bisecting the same numbered edges within corresponding tetrahedra.

Since this test looks at tetrahedron numbers and not the specific Tetrahedron objects, it is meaningful to compare snapped 2-spheres within different triangulations.

Parameters
otherthe snapped 2-sphere to compare with this.
Returns
true if and only if this and the given object represent different specific presentations of a snapped 2-sphere.

◆ operator=()

SnappedTwoSphere & regina::SnappedTwoSphere::operator= ( const SnappedTwoSphere )
default

Sets this to be a copy of the given structure.

Returns
a reference to this structure.

◆ operator==()

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

Determines whether this and the given object represent the same specific presentation of a snapped 2-sphere.

Specifically, two snapped 2-spheres will compare as equal if and only if they slice through the same pair of numbered tetrahedra, presented in the same order, and bisecting the same numbered degree one edges within corresponding tetrahedra.

Since this test looks at tetrahedron numbers and not the specific Tetrahedron objects, it is meaningful to compare snapped 2-spheres within different triangulations.

Parameters
otherthe snapped 2-sphere to compare with this.
Returns
true if and only if this and the given object represent the same specific presentation of a snapped 2-sphere.

◆ recognise() [1/2]

static std::unique_ptr< SnappedTwoSphere > regina::SnappedTwoSphere::recognise ( const SnappedBall ball1,
const SnappedBall ball2 
)
static

Determines if the two given snapped 3-balls together form a snapped 2-sphere.

If this is the case, the snapped 3-balls stored in the structure returned will be clones of the original 3-balls, not the original 3-balls themselves.

Even though SnappedTwoSphere is a two-dimensional class and so does not inherit from StandardTriangulation, this routine nevertheless returns by (smart) pointer for consistency with the StandardTriangulation recognition routines (which use pointers because of the polymorphic StandardTriangulation class hierarchy).

Precondition
The two given snapped 3-balls use distinct tetrahedra.
Parameters
ball1the first snapped 3-ball to examine.
ball2the second snapped 3-ball to examine.
Returns
a structure containing details of the snapped 2-sphere, or null if the given snapped 3-balls do not form a snapped 2-sphere.

◆ recognise() [2/2]

static std::unique_ptr< SnappedTwoSphere > regina::SnappedTwoSphere::recognise ( Tetrahedron< 3 > *  tet1,
Tetrahedron< 3 > *  tet2 
)
static

Determines if the two given tetrahedra together form a snapped 2-sphere.

Even though SnappedTwoSphere is a two-dimensional class and so does not inherit from StandardTriangulation, this routine nevertheless returns by (smart) pointer for consistency with the StandardTriangulation recognition routines (which use pointers because of the polymorphic StandardTriangulation class hierarchy).

Precondition
The two given tetrahedra are distinct.
Parameters
tet1the first tetrahedron to examine.
tet2the second tetrahedron to examine.
Returns
a structure containing details of the snapped 2-sphere, or null if the given tetrahedra do not form a snapped 2-sphere.

◆ snappedBall()

const SnappedBall & regina::SnappedTwoSphere::snappedBall ( int  index) const
inline

Returns one of the two snapped 3-balls whose equators are joined.

Parameters
indexspecifies which of the two 3-balls to return; this must be either 0 or 1.
Returns
the corresponding snapped 3-ball.

◆ str()

std::string regina::Output< SnappedTwoSphere , supportsUtf8 >::str ( ) const
inherited

Returns a short text representation of this object.

This text should be human-readable, should use plain ASCII characters where possible, and should not contain any newlines.

Within these limits, this short text ouptut should be as information-rich as possible, since in most cases this forms the basis for the Python __str__() and __repr__() functions.

Python
The Python "stringification" function __str__() will use precisely this function, and for most classes the Python __repr__() function will incorporate this into its output.
Returns
a short text representation of this object.

◆ utf8()

std::string regina::Output< SnappedTwoSphere , supportsUtf8 >::utf8 ( ) const
inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should not contain any newlines, and (within these constraints) should be as information-rich as is reasonable.

Unlike str(), this function may use unicode characters to make the output more pleasant to read. The string that is returned will be encoded in UTF-8.

Returns
a short text representation of this object.

◆ writeTextLong()

void regina::ShortOutput< SnappedTwoSphere , false >::writeTextLong ( std::ostream &  out) const
inlineinherited

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python
Not present. Instead you can call detail() from the subclass T, which returns this output as a string.
Parameters
outthe output stream to which to write.

◆ writeTextShort()

void regina::SnappedTwoSphere::writeTextShort ( std::ostream &  out) const

Writes a short text representation of this object to the given output stream.

Python
Not present. Use str() instead.
Parameters
outthe output stream to which to write.

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

Copyright © 1999-2023, 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).