An edge consisting of two vertex pointers. More...
#include <VertexPair2.h>
Public Member Functions | |
| VertexPair2 () | |
| Default constructor. | |
| VertexPair2 (Point2 *pSource, Point2 *pTarget) | |
| Constructor that initializes the vertex pair with two different vertex pointers. More... | |
| double | getSqLen25D () const |
| Get the squared 2.5D length of the edge. More... | |
| double | getSqLen2D () const |
| Get the squared 2D length of the edge. More... | |
| Point2 * | getSrc () const |
| Get the oriented source vertex pointer. More... | |
| Point2 * | getTrg () const |
| Get the oriented target vertex pointer. More... | |
| bool | operator< (const VertexPair2 &other) const |
| Less-than operator. More... | |
| bool | operator== (const VertexPair2 &other) const |
| Equality operator. More... | |
Public Attributes | |
| bool | bReverse |
| Flag indicating if the pointers were reversed. | |
| Point2 * | p0 |
| The smaller vertex pointer. | |
| Point2 * | p1 |
| The larger vertex pointer. | |
Friends | |
| CLASS_DECLSPEC friend std::ostream & | operator<< (std::ostream &stream, const VertexPair2 &pr) |
Stream output operator for VertexPair2. More... | |
The VertexPair2 struct can be thought of as an oriented edge, where the operator<() compares it like an unordered edge, based on the pointer values. It consists of two different Point2 pointers, p0 and p1, ensuring p0 < p1. Despite this reordering, the original edge orientation is preserved internally by the bReverse flag.
This constructor takes two different Point2 pointers, pSource and pTarget, to initialize the members p0 and p1. If p0 > p1, the pointers are swapped, and bReverse is set to true to indicate that the orientation is reversed compared to the original order.
| [in] | pSource | Pointer to the source vertex. |
| [in] | pTarget | Pointer to the target vertex. |
|
inline |
Computes the squared 2.5D length of the edge.
p0 and *p1.
|
inline |
Computes the squared 2D length of the edge. The z-coordinate is ignored.
p0 and *p1.
|
inline |
Returns the source vertex pointer, determined by the bReverse flag.
p0 if bReverse is false; p1 otherwise.
|
inline |
Returns the target vertex pointer, determined by the bReverse flag.
p1 if bReverse is false; p0 otherwise.
|
inline |
Compares two VertexPair2 instances based on their vertex pointers.
| other | Another VertexPair2 instance to compare against. |
true if this pair of pointers is lexicographically less than the other pair.
|
inline |
Checks if the vertex pointers of the other vertex pair are identical.
| other | Another VertexPair2 instance to compare against. |
true if both pairs are identical, false otherwise.
|
friend |
Prints the VertexPair2.
| stream | Output stream. |
| pr | The VertexPair2 instance to print. |