Regina Calculation Engine
Public Member Functions | Friends | List of all members
regina::Dim2Triangle Class Reference

Represents a triangular face in a 2-manifold triangulation. More...

#include <dim2/dim2triangle.h>

Inheritance diagram for regina::Dim2Triangle:
regina::ShareableObject regina::NMarkedElement regina::boost::noncopyable

Public Member Functions

virtual ~Dim2Triangle ()
 Destroys this triangle. More...
 
const std::string & getDescription () const
 Returns the text description associated with this triangle. More...
 
void setDescription (const std::string &desc)
 Sets the text description associated with this triangle. More...
 
unsigned long index () const
 Returns the index of this triangle in the underlying triangulation. More...
 
Dim2TriangleadjacentTriangle (int edge) const
 Returns the adjacent triangle glued to the given edge of this triangle, or 0 if the given edge is on the boundary of the 2-manifold triangulation. More...
 
Dim2TriangleadjacentSimplex (int edge) const
 A dimension-agnostic alias for adjacentTriangle(). More...
 
NPerm3 adjacentGluing (int edge) const
 Returns a permutation describing the correspondence between vertices of this triangle and vertices of the adjacent triangle glued to the given edge of this triangle. More...
 
int adjacentEdge (int edge) const
 Examines the triangle glued to the given edge of this triangle, and returns the corresponding edge of that triangle. More...
 
int adjacentFacet (int facet) const
 A dimension-agnostic alias for adjacentEdge(). More...
 
bool hasBoundary () const
 Determines if this triangle has any edges that are boundary edges. More...
 
void joinTo (int myEdge, Dim2Triangle *you, NPerm3 gluing)
 Joins the given edge of this triangle to another triangle. More...
 
Dim2Triangleunjoin (int myEdge)
 Unglues the given edge of this triangle from whatever is joined to it. More...
 
void isolate ()
 Undoes any edge gluings involving this triangle. More...
 
Dim2TriangulationgetTriangulation () const
 Returns the triangulation to which this triangle belongs. More...
 
Dim2ComponentgetComponent () const
 Returns the 2-manifold triangulation component to which this triangle belongs. More...
 
Dim2VertexgetVertex (int vertex) const
 Returns the vertex in the 2-manifold triangulation skeleton corresponding to the given vertex of this triangle. More...
 
Dim2EdgegetEdge (int edge) const
 Returns the edge in the 2-manifold triangulation skeleton corresponding to the given edge of this triangle. More...
 
NPerm3 getVertexMapping (int vertex) const
 Returns a permutation that maps 0 to the given vertex of this triangle, and that maps (1,2) to the two remaining vertices in the following "orientation-preserving" fashion. More...
 
NPerm3 getEdgeMapping (int edge) const
 Examines the given edge of this triangle, and returns a mapping from the "canonical" vertices of the corresponding edge of the triangulation to the matching vertices of this triangle. More...
 
int orientation () const
 Returns the orientation of this triangle in the 2-manifold triangulation. More...
 
void writeTextShort (std::ostream &out) const
 Writes this object in short text format to the given output stream. More...
 
void writeTextLong (std::ostream &out) const
 Writes this object in long text format to the given output stream. More...
 
long markedIndex () const
 Returns the index at which this object is stored in an NMarkedVector. More...
 
Input and Output
std::string str () const
 Returns the output from writeTextShort() as a string. More...
 
std::string toString () const
 A deprecated alias for str(), which returns the output from writeTextShort() as a string. More...
 
std::string detail () const
 Returns the output from writeTextLong() as a string. More...
 
std::string toStringLong () const
 A deprecated alias for detail(), which returns the output from writeTextLong() as a string. More...
 

Friends

class Dim2Triangulation
 Allow access to private members. More...
 

Detailed Description

Represents a triangular face in a 2-manifold triangulation.

With each triangle is stored various pieces of information regarding the overall skeletal structure and component structure of the triangulation. This skeletal information will be allocated, calculated and deallocated by the Dim2Triangulation object containing the corresponding triangles.

A triangle must always belong to a 2-manifold triangulation. You can construct new triangles using either Dim2Triangulation::newTriangle() or Dim2Triangulation::newTriangle(const std::string&); these routines will automatically add the new triangles to the triangulation. You can destroy triangles by calling Dim2Trianguation::removeTriangle(), Dim2Trianguation::removeTriangleAt() or Dim2Triangulation::removeAllTriangles(); these routines will automatically destroy the triangles as they are removed.

Constructor & Destructor Documentation

regina::Dim2Triangle::~Dim2Triangle ( )
inlinevirtual

Destroys this triangle.

Member Function Documentation

int regina::Dim2Triangle::adjacentEdge ( int  edge) const
inline

Examines the triangle glued to the given edge of this triangle, and returns the corresponding edge of that triangle.

That is, the returned edge of the adjacent triangle is glued to the given edge of this triangle.

Precondition
The given edge of this triangle has some triangle (possibly this one) glued to it.
Parameters
edgethe edge of this triangle whose gluing we will examine. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle.
Returns
the edge of the triangle adjacent along the given edge that is in fact glued to the given edge of this triangle.
int regina::Dim2Triangle::adjacentFacet ( int  facet) const
inline

A dimension-agnostic alias for adjacentEdge().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "facet" refers to a facet of a top-dimensional simplex (which for 2-manifold triangulations means an edge of a triangle).

See adjacentEdge() for further information.

NPerm3 regina::Dim2Triangle::adjacentGluing ( int  edge) const
inline

Returns a permutation describing the correspondence between vertices of this triangle and vertices of the adjacent triangle glued to the given edge of this triangle.

If we call this permutation p, then for each vertex v of this triangle, p[v] will be the vertex of the adjacent triangle that is identified with v according to the gluing along the given edge of this triangle.

Precondition
The given edge of this triangle has some triangle (possibly this one) glued to it.
Parameters
edgethe edge of this triangle whose gluing we will examine. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle.
Returns
a permutation mapping the vertices of this triangle to the vertices of the triangle adjacent along the given edge.
Dim2Triangle * regina::Dim2Triangle::adjacentSimplex ( int  edge) const
inline

A dimension-agnostic alias for adjacentTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See adjacentTriangle() for further information.

Dim2Triangle * regina::Dim2Triangle::adjacentTriangle ( int  edge) const
inline

Returns the adjacent triangle glued to the given edge of this triangle, or 0 if the given edge is on the boundary of the 2-manifold triangulation.

Parameters
edgethe edge of this triangle to examine. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle.
Returns
the adjacent triangle glued to the given edge, or 0 if the given edge lies on the boundary.
std::string regina::ShareableObject::detail ( ) const
inherited

Returns the output from writeTextLong() as a string.

Returns
a long text representation of this object.
Dim2Component * regina::Dim2Triangle::getComponent ( ) const
inline

Returns the 2-manifold triangulation component to which this triangle belongs.

Returns
the component containing this triangle.
const std::string & regina::Dim2Triangle::getDescription ( ) const
inline

Returns the text description associated with this triangle.

Returns
the description of this triangle.
Dim2Edge * regina::Dim2Triangle::getEdge ( int  edge) const
inline

Returns the edge in the 2-manifold triangulation skeleton corresponding to the given edge of this triangle.

Edge i of a triangle is always opposite vertex i of that triangle.

Parameters
edgethe edge of this triangle to examine. This should be between 0 and 2 inclusive.
Returns
the edge of the skeleton corresponding to the requested triangle edge.
NPerm3 regina::Dim2Triangle::getEdgeMapping ( int  edge) const
inline

Examines the given edge of this triangle, and returns a mapping from the "canonical" vertices of the corresponding edge of the triangulation to the matching vertices of this triangle.

In detail: Suppose two edges of two triangles are identified within the overall 2-manifold triangulation. We call this a single "edge of the triangulation", and arbitrarily label its vertices (0,1). This routine then maps the vertices (0,1) of this edge of the triangulation to the individual vertices of this triangle that make up the given edge.

Because we are passing the argument edge, we already know which vertices of this triangle are involved. What this routine tells us is the order in which they appear to form the overall edge of the triangulation.

As a consequence: Consider two triangle edges that are identified together as a single edge of the triangulation, and choose some i from the set {0,1}. Then the vertices getEdgeMapping(...)[i] of the individual triangles are identified together, since they both become the same vertex of the same edge of the triangulation (assuming of course that we pass the correct edge number in each case to getEdgeMapping()).

Parameters
edgethe edge of this triangle to examine. This should be between 0 and 2 inclusive.
Returns
a mapping from vertices (0,1) of the requested edge to the corresponding vertices of this triangle.
Dim2Triangulation * regina::Dim2Triangle::getTriangulation ( ) const
inline

Returns the triangulation to which this triangle belongs.

Returns
the triangulation containing this triangle.
Dim2Vertex * regina::Dim2Triangle::getVertex ( int  vertex) const
inline

Returns the vertex in the 2-manifold triangulation skeleton corresponding to the given vertex of this triangle.

Parameters
vertexthe vertex of this triangle to examine. This should be between 0 and 2 inclusive.
Returns
the vertex of the skeleton corresponding to the requested triangle vertex.
NPerm3 regina::Dim2Triangle::getVertexMapping ( int  vertex) const
inline

Returns a permutation that maps 0 to the given vertex of this triangle, and that maps (1,2) to the two remaining vertices in the following "orientation-preserving" fashion.

The images of 1 and 2 under the permutations that are returned have the following properties. In each triangle, the images of 1 and 2 under this map form a directed edge of the triangle (running from the image of vertex 1 to the image of vertex 2). For any given vertex of the triangulation, these corresponding directed edges together form an ordered path within the triangulation that circles the common vertex of the triangulation (like a vertex link, except that it is not near to the vertex and so might intersect itself). Furthermore, if we consider the individual triangles in the order in which they appear in the list Dim2Vertex::getEmbeddings(), these corresponding directed edges appear in order from the start of this path to the finish (for internal vertices this path is actually a cycle, and the starting point is arbitrary).

Parameters
vertexthe vertex of this triangle to examine. This should be between 0 and 2 inclusive.
Returns
a permutation that maps 0 to the given vertex of this triangle, with the properties outlined above.
bool regina::Dim2Triangle::hasBoundary ( ) const

Determines if this triangle has any edges that are boundary edges.

Returns
true if and only if this triangle has any boundary edges.
unsigned long regina::Dim2Triangle::index ( ) const
inline

Returns the index of this triangle in the underlying triangulation.

This is identical to calling getTriangulation()->triangleIndex(this).

Note that triangle indexing may change when a triangle is added or removed from the underlying triangulation.

Returns
the index of this triangle.
void regina::Dim2Triangle::isolate ( )

Undoes any edge gluings involving this triangle.

Any other triangles involved will be automatically updated.

void regina::Dim2Triangle::joinTo ( int  myEdge,
Dim2Triangle you,
NPerm3  gluing 
)

Joins the given edge of this triangle to another triangle.

The other triangle involved will be automatically updated.

Precondition
This and the given triangle do not belong to different triangulations.
The given edge of this triangle is not currently glued to anything.
The edge of the other triangle that will be glued to the given edge of this triangle is not currently glued to anything.
If the other triangle involved is this triangle, we are not attempting to glue an edge to itself.
Parameters
myEdgethe edge of this triangle that will be glued to the given other triangle. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle.
youthe triangle (possibly this one) that will be glued to the given edge of this triangle.
gluinga permutation describing the mapping of vertices by which the two triangles will be joined. Each vertex v of this triangle that lies on the given edge will be identified with vertex gluing[v] of triangle you. In addition, the edge of you that will be glued to the given edge of this triangle will be edge number gluing[myEdge].
long regina::NMarkedElement::markedIndex ( ) const
inlineinherited

Returns the index at which this object is stored in an NMarkedVector.

If this object does not belong to an NMarkedVector, the return value is undefined.

Returns
the index at which this object is stored.
int regina::Dim2Triangle::orientation ( ) const
inline

Returns the orientation of this triangle in the 2-manifold triangulation.

The orientation of each triangle is always +1 or -1. In an orientable component of a triangulation, adjacent triangles have the same orientations if one could be transposed onto the other without reflection, and they have opposite orientations if a reflection would be required. In a non-orientable component, orientations are still +1 and -1 but no further guarantees can be made.

Returns
+1 or -1 according to the orientation of this triangle.
void regina::Dim2Triangle::setDescription ( const std::string &  desc)
inline

Sets the text description associated with this triangle.

Note that descriptions need not be unique, and may be empty.

Parameters
descthe new description to assign to this triangle.
std::string regina::ShareableObject::str ( ) const
inherited

Returns the output from writeTextShort() as a string.

Python:
This implements the __str__() function.
Returns
a short text representation of this object.
std::string regina::ShareableObject::toString ( ) const
inlineinherited

A deprecated alias for str(), which returns the output from writeTextShort() as a string.

Deprecated:
This routine has (at long last) been deprecated; use the simpler-to-type str() instead.
Returns
a short text representation of this object.
std::string regina::ShareableObject::toStringLong ( ) const
inlineinherited

A deprecated alias for detail(), which returns the output from writeTextLong() as a string.

Deprecated:
This routine has (at long last) been deprecated; use the simpler-to-type detail() instead.
Returns
a long text representation of this object.
Dim2Triangle* regina::Dim2Triangle::unjoin ( int  myEdge)

Unglues the given edge of this triangle from whatever is joined to it.

The other triangle involved (possibly this one) will be automatically updated.

Precondition
The given edge of this triangle has some triangle (possibly this one) glued to it.
Parameters
myEdgethe edge of this triangle whose gluing we will undo. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle.
Returns
the ex-adjacent triangle that was originally glued to the given edge of this triangle.
void regina::Dim2Triangle::writeTextLong ( std::ostream &  out) const
virtual

Writes this object in long text format to the given output stream.

The output should provide the user with all the information they could want. The output should be human-readable, should not contain extremely long lines (so users can read the output in a terminal), and should end with a final newline.

The default implementation of this routine merely calls writeTextShort() and adds a newline.

Python:
The parameter out does not exist; standard output will be used.
Parameters
outthe output stream to which to write.

Reimplemented from regina::ShareableObject.

void regina::Dim2Triangle::writeTextShort ( std::ostream &  out) const
inlinevirtual

Writes this object in short text format to the given output stream.

The output should be human-readable, should fit on a single line, and should not end with a newline.

Python:
The parameter out does not exist; standard output will be used.
Parameters
outthe output stream to which to write.

Implements regina::ShareableObject.

Friends And Related Function Documentation

friend class Dim2Triangulation
friend

Allow access to private members.


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

Copyright © 1999-2014, 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@debian.org).