Regina 7.0 Calculation Engine
|
A reference to an outgoing edge from a node of a model graph for a knot or link. More...
#include <link/modellinkgraph.h>
Public Member Functions | |
ModelLinkGraphArc () | |
Initialises this to a null arc. More... | |
ModelLinkGraphArc (ModelLinkGraphNode *node, int arc) | |
Initialises this to the given arc exiting the given node of a model graph. More... | |
ModelLinkGraphArc (const ModelLinkGraphArc &)=default | |
Default copy constructor. More... | |
ModelLinkGraphNode * | node () const |
The node of the model graph from which this arc exits. More... | |
int | arc () const |
Indicates which arc this is amongst the four arcs exiting the underlying node of the model graph. More... | |
bool | operator== (const ModelLinkGraphArc &rhs) const |
Tests whether this and the given arc reference are identical. More... | |
bool | operator!= (const ModelLinkGraphArc &rhs) const |
Tests whether this and the given arc reference are not identical. More... | |
ModelLinkGraphArc & | operator= (const ModelLinkGraphArc &)=default |
Default assignment operator. More... | |
ModelLinkGraphArc | opposite () const |
Returns the arc that exits the same node as this, but from the opposite side. More... | |
ModelLinkGraphArc | traverse () const |
Returns the same edge of the model graph, but seen from the other endpoint. More... | |
ModelLinkGraphArc | next () const |
Returns the next arc after this when walking through the graph as though it were a link, in a direction away from the current node. More... | |
ModelLinkGraphArc | prev () const |
Returns the previous arc before this when walking through the graph as though it were a link, in a direction away from the* current node. More... | |
ModelLinkGraphArc & | operator++ () |
Changes to the next outgoing link arc from the same node. More... | |
ModelLinkGraphArc | operator++ (int) |
Changes to the next outgoing link arc from the same node. More... | |
ModelLinkGraphArc & | operator-- () |
Changes to the previous outgoing link arc from the same node. More... | |
ModelLinkGraphArc | operator-- (int) |
Changes to the previous outgoing link arc from the same node. More... | |
operator bool () const | |
Tests whether this is a non-null arc. More... | |
Friends | |
class | ModelLinkGraph |
A reference to an outgoing edge from a node of a model graph for a knot or link.
Edges of model graphs are not directed, and so the same edge will appear twice as a ModelLinkGraphArc (once from each of its endpoints).
This class is a simple wrapper that stores (i) a pointer to the relevant node of the graph; and (ii) an integer to denote which of the four outgoing arcs we are using from that node. Recall that the four outgoing arcs for each node are indexed in clockwise order.
A "null arc" is one whose node is the null pointer.
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.
|
inline |
|
inline |
Initialises this to the given arc exiting the given node of a model graph.
Recall that the four arcs exiting a node are numbered 0,1,2,3 in a clockwise order around the node.
The given node may be null
, in which case this will become a null arc. If you are creating a null arc, then it is highly recommended that you pass arc as 0 also, so that comparison tests treat this null reference as equal to a null reference created by the zero-argument constructor.
node | the node of the model graph that this arc exits. |
arc | an integer in the range 0 to 3 inclusive, indicating which of the four arcs exiting node this represents. |
|
default |
Default copy constructor.
|
inline |
Indicates which arc this is amongst the four arcs exiting the underlying node of the model graph.
For each node of a model graph, the four arcs exiting that node are numbered 0,1,2,3 in a clockwise order.
|
inline |
Returns the next arc after this when walking through the graph as though it were a link, in a direction away from the current node.
This routine will move to the other endpoint of the graph edge described by this arc, and will then return the opposite arc at the resulting node (i.e., not just pointing backwards along the same edge).
For any arc a, calling a.next()
is equivalent to calling a.traverse().opposite()
.
null
.
|
inline |
The node of the model graph from which this arc exits.
null
if this is a null arc.
|
inline |
|
inline |
Tests whether this and the given arc reference are not identical.
Two references are identical if and only if they return the same values for both node() and arc().
null
, i) for some non-zero i, then this will not be considered equal to the null arc created by calling ModelLinkGraphArc(), since the latter is equivalent to calling ModelLinkGraphArc(null
, 0).true
if and only if this and rhs are not identical.
|
inline |
Changes to the next outgoing link arc from the same node.
This effectively rotates the arc in a clockwise direction around the node. In particular, it increments the value returned by arc(), modulo 4.
This is a preincrement operator: the object will be changed, and then a reference to it will be returned.
null
.
|
inline |
Changes to the next outgoing link arc from the same node.
This effectively rotates the arc in a clockwise direction around the node. In particular, it increments the value returned by arc(), modulo 4.
This is a postincrement operator: the object will be changed, but a copy of the original arc will be returned.
null
.
|
inline |
Changes to the previous outgoing link arc from the same node.
This effectively rotates the arc in an anticlockwise direction around the node. In particular, it decrements the value returned by arc(), modulo 4.
This is a predecrement operator: the object will be changed, and then a reference to it will be returned.
null
.
|
inline |
Changes to the previous outgoing link arc from the same node.
This effectively rotates the arc in an anticlockwise direction around the node. In particular, it decrements the value returned by arc(), modulo 4.
This is a postdecrement operator: the object will be changed, but a copy of the original arc will be returned.
null
.
|
default |
Default assignment operator.
|
inline |
Tests whether this and the given arc reference are identical.
Two references are identical if and only if they return the same values for both node() and arc().
null
, i) for some non-zero i, then this will not be considered equal to the null arc created by calling ModelLinkGraphArc(), since the latter is equivalent to calling ModelLinkGraphArc(null
, 0).true
if and only if this and rhs are identical.
|
inline |
Returns the arc that exits the same node as this, but from the opposite side.
Recall that the four arcs exiting each node are numbered in clockwise order. The return value will therefore have the same node() as this, but its arc() value will be two more than this (modulo 4).
Note that, for any arc a, a.opposite().opposite()
is identical to a.
null
.
|
inline |
Returns the previous arc before this when walking through the graph as though it were a link, in a direction away from the* current node.
This routine will jump to the opposite arc at the current node, and then move to the other endpoint of the graph edge described by that opposite arc.
For any arc a, calling a.prev()
is equivalent to calling a.opposite().traverse()
.
null
.
|
inline |
Returns the same edge of the model graph, but seen from the other endpoint.
Recall that each undirected edge of a model graph has two corresponding ModelLinkGraphArc objects, one for each of its endpoints. If this object represents one of these arcs for some underlying edge of the graph, then then return value represents the other.
Note that, for any arc a, a.traverse().traverse()
is identical to a.
null
.