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

Represents a single crossing in a link diagram. More...

#include <link/link.h>

Inheritance diagram for regina::Crossing:
regina::MarkedElement regina::ShortOutput< Crossing > regina::Output< Crossing, false >

Public Member Functions

size_t index () const
 Returns the index of this crossing within the overall link. More...
 
int sign () const
 Returns the sign of this crossing. More...
 
StrandRef upper ()
 Returns a reference to the strand running over this crossing. More...
 
StrandRef lower ()
 Returns a reference to the strand running under this crossing. More...
 
StrandRef over ()
 Returns a reference to the strand running over this crossing. More...
 
StrandRef under ()
 Returns a reference to the strand running under this crossing. More...
 
StrandRef strand (int which)
 Returns a reference to one of the two strands of the link that pass each other at this crossing. More...
 
StrandRef next (int strand) const
 Returns the crossing reference that immediately follows this when walking forward in the direction of the link along one of the two strands that pass at this crossing. More...
 
StrandRef prev (int strand) const
 Returns the crossing reference that immediately precedes this when walking backward against the direction of the link along one of the two strands that pass at this crossing. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this object to the given output stream. More...
 
 Crossing (const Crossing &)=delete
 
Crossingoperator= (const Crossing &)=delete
 
size_t markedIndex () const
 Returns the index at which this object is stored in an MarkedVector. 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...
 

Friends

class Link
 
class ModelLinkGraph
 
class Tangle
 
class XMLLinkCrossingsReader
 
class XMLLinkConnectionsReader
 

Detailed Description

Represents a single crossing in a link diagram.

The two strands of the link that run over and under the crossing respectively can be accessed through routines such as over(), under(), upper(), lower(), and strand().

Each crossing has a sign, which is either positive (denoted by +1) or negative (denoted by -1):

If a link has n crossings, then these are numbered 0,...,n-1. The number assigned to this crossing can be accessed by calling index(). Note that crossings in a link may be reindexed when other crossings are added or removed - if you wish to track a particular crossing through such operations then you should use a pointer to the relevant Crossing object instead.

Crossings do not support value semantics: they cannot be copied, swapped, or manually constructed. Their location in memory defines them, and they are often passed and compared by pointer. End users are never responsible for their memory management; this is all taken care of by the Link to which they belong.

Member Function Documentation

◆ detail()

std::string regina::Output< Crossing , 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.

◆ index()

size_t regina::Crossing::index ( ) const
inline

Returns the index of this crossing within the overall link.

If the link contains n crossings, then the index will be a number between 0 and n-1 inclusive.

Warning
The index of this crossing might change if other crossings are added or removed.
Returns
the index of this crossing.

◆ lower()

StrandRef regina::Crossing::lower ( )
inline

Returns a reference to the strand running under this crossing.

This is equivalent to directly constructing StrandRef(this, 0).

Note that lower() and under() are synonyms.

Returns
a reference to the lower strand for this crossing.

◆ markedIndex()

size_t regina::MarkedElement::markedIndex ( ) const
inlineinherited

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

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

Returns
the index at which this object is stored.

◆ next()

StrandRef regina::Crossing::next ( int  strand) const
inline

Returns the crossing reference that immediately follows this when walking forward in the direction of the link along one of the two strands that pass at this crossing.

Which strand we follow is indicated by the argument strand.

Note that for a crossing c, calling c.next(s) is equivalent to calling c.strand(s).next().

Parameters
strandeither 1 to walk forward along the upper strand, or 0 to walk forward along the lower strand.
Returns
a reference to the next crossing after this along the given strand.

◆ over()

StrandRef regina::Crossing::over ( )
inline

Returns a reference to the strand running over this crossing.

This is equivalent to directly constructing StrandRef(this, 1).

Note that upper() and over() are synonyms.

Returns
a reference to the upper strand for this crossing.

◆ prev()

StrandRef regina::Crossing::prev ( int  strand) const
inline

Returns the crossing reference that immediately precedes this when walking backward against the direction of the link along one of the two strands that pass at this crossing.

Which strand we follow is indicated by the argument strand.

Note that for a crossing c, calling c.prev(s) is equivalent to calling c.strand(s).prev().

Parameters
strandeither 1 to walk backward along the upper strand, or 0 to walk backward along the lower strand.
Returns
a reference to the previous crossing before this along the given strand.

◆ sign()

int regina::Crossing::sign ( ) const
inline

Returns the sign of this crossing.

This will be +1 for a positive crossing, or -1 for a negative crossing.

See the Crossing class notes for diagrams of positive and negative crossings

Returns
the sign of this crossing.

◆ str()

std::string regina::Output< Crossing , 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.

◆ strand()

StrandRef regina::Crossing::strand ( int  which)
inline

Returns a reference to one of the two strands of the link that pass each other at this crossing.

This is equivalent to directly constructing StrandRef(this, which).

Note that upper() and over() are synonyms for strand(1), and lower() and under() are synonyms for strand(0).

Parameters
whicheither 1 to indicate the upper strand, or 0 to indicate the lower strand.
Returns
a reference to the given strand at this crossing.

◆ under()

StrandRef regina::Crossing::under ( )
inline

Returns a reference to the strand running under this crossing.

This is equivalent to directly constructing StrandRef(this, 0).

Note that lower() and under() are synonyms.

Returns
a reference to the lower strand for this crossing.

◆ upper()

StrandRef regina::Crossing::upper ( )
inline

Returns a reference to the strand running over this crossing.

This is equivalent to directly constructing StrandRef(this, 1).

Note that upper() and over() are synonyms.

Returns
a reference to the upper strand for this crossing.

◆ utf8()

std::string regina::Output< Crossing , 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< Crossing , 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::Crossing::writeTextShort ( std::ostream &  out) const
inline

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).