Regina Calculation Engine
|
Represents a triangular face in a 2-manifold triangulation. More...
#include <dim2/dim2triangle.h>
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... | |
Dim2Triangle * | adjacentTriangle (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... | |
Dim2Triangle * | adjacentSimplex (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... | |
Dim2Triangle * | unjoin (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... | |
Dim2Triangulation * | getTriangulation () const |
Returns the triangulation to which this triangle belongs. More... | |
Dim2Component * | getComponent () const |
Returns the 2-manifold triangulation component to which this triangle belongs. More... | |
Dim2Vertex * | getVertex (int vertex) const |
Returns the vertex in the 2-manifold triangulation skeleton corresponding to the given vertex of this triangle. More... | |
Dim2Edge * | getEdge (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... | |
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.
|
inlinevirtual |
Destroys this triangle.
|
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.
edge | the 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. |
|
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.
|
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.
edge | the 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. |
|
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.
|
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.
edge | the edge of this triangle to examine. This should be between 0 and 2 inclusive, where edge i is opposite vertex i of the triangle. |
|
inherited |
Returns the output from writeTextLong() as a string.
|
inline |
Returns the 2-manifold triangulation component to which this triangle belongs.
|
inline |
Returns the text description associated with this triangle.
|
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.
edge | the edge of this triangle to examine. This should be between 0 and 2 inclusive. |
|
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()).
edge | the edge of this triangle to examine. This should be between 0 and 2 inclusive. |
|
inline |
Returns the triangulation to which this triangle belongs.
|
inline |
Returns the vertex in the 2-manifold triangulation skeleton corresponding to the given vertex of this triangle.
vertex | the vertex of this triangle to examine. This should be between 0 and 2 inclusive. |
|
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).
vertex | the vertex of this triangle to examine. This should be between 0 and 2 inclusive. |
bool regina::Dim2Triangle::hasBoundary | ( | ) | const |
Determines if this triangle has any edges that are boundary edges.
true
if and only if this triangle has any boundary edges.
|
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.
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.
myEdge | the 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. |
you | the triangle (possibly this one) that will be glued to the given edge of this triangle. |
gluing | a 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] . |
|
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.
|
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.
|
inline |
Sets the text description associated with this triangle.
Note that descriptions need not be unique, and may be empty.
desc | the new description to assign to this triangle. |
|
inherited |
Returns the output from writeTextShort() as a string.
__str__()
function.
|
inlineinherited |
A deprecated alias for str(), which returns the output from writeTextShort() as a string.
|
inlineinherited |
A deprecated alias for detail(), which returns the output from writeTextLong() as a string.
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.
myEdge | the 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. |
|
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.
out | the output stream to which to write. |
Reimplemented from regina::ShareableObject.
|
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.
out | the output stream to which to write. |
Implements regina::ShareableObject.
|
friend |
Allow access to private members.