GraphEdgeBase< NODE > Class Template Reference

#include <graphbase.h>

Detailed Description

template<typename NODE>
class maxon::GraphEdgeBase< NODE >

Basic edge template for a graph, in case of custom implementation have to be frowarded to the node type.

Template Parameters
NODEThe node type in the graph.

Public Types

typedef GraphEdgeBase< NODE > EdgeType
 

Public Member Functions

 GraphEdgeBase (NODE *p1=nullptr, NODE *p2=nullptr)
 
 ~GraphEdgeBase ()
 
 GraphEdgeBase (GraphEdgeBase &&src)
 
Result< void > CopyFrom (const GraphEdgeBase &src)
 
Result< void > UpdateNodes (NODE *p1, NODE *p2)
 
Bool IsValid () const
 
Result< void > GetNodes (NODE &p1, NODE &p2) const
 
Result< void > GetNodesPointer (NODE *&p1, NODE *&p2) const
 
Result< void > GetNodesPos (Vector &p1, Vector &p2) const
 
Float GetLength () const
 
Result< NODE * > GetOtherHand (NODE *point, Bool *secondPoint=nullptr) const
 
Bool IsEqual (NODE *p1, NODE *p2) const
 
void Reset ()
 

Protected Attributes

NODE * _p1
 
NODE * _p2
 

Member Typedef Documentation

◆ EdgeType

typedef GraphEdgeBase<NODE> EdgeType

Constructor & Destructor Documentation

◆ GraphEdgeBase() [1/2]

GraphEdgeBase ( NODE *  p1 = nullptr,
NODE *  p2 = nullptr 
)
explicit

◆ ~GraphEdgeBase()

◆ GraphEdgeBase() [2/2]

GraphEdgeBase ( GraphEdgeBase< NODE > &&  src)

Member Function Documentation

◆ CopyFrom()

Result<void> CopyFrom ( const GraphEdgeBase< NODE > &  src)

◆ UpdateNodes()

Result<void> UpdateNodes ( NODE *  p1,
NODE *  p2 
)

Update node pointers used after consistency check.

Parameters
[in]p1First edge node.
[in]p2Second edge node.
Returns
OK if both nodes are not nullptr otherwise error.

◆ IsValid()

Bool IsValid ( ) const

Check if the edge is in between 2 valid points.

Returns
True if edge is valid otherwise false.

◆ GetNodes()

Result<void> GetNodes ( NODE &  p1,
NODE &  p2 
) const

Get the tow main nodes for this edge (copy all data).

Parameters
[out]p1First node to be filled.
[out]p2Second node to be filled.
Returns
OK if both nodes are not nullptr otherwise error.

◆ GetNodesPointer()

Result<void> GetNodesPointer ( NODE *&  p1,
NODE *&  p2 
) const

Get the tow main ndoes for this edge.

Parameters
[out]p1First node to be filled.
[out]p2Second node to be filled.
Returns
OK if both nodes are not nullptr otherwise error.

◆ GetNodesPos()

Result<void> GetNodesPos ( Vector p1,
Vector p2 
) const

Get the tow main node position for this edge.

Parameters
[out]p1First node to be filled.
[out]p2Second node to be filled.
Returns
OK if both nodes are not nullptr otherwise error.

◆ GetLength()

Float GetLength ( ) const

Calculate the distance in between _p1 and _p2.

Returns
The stroke length.

◆ GetOtherHand()

Result<NODE*> GetOtherHand ( NODE *  point,
Bool secondPoint = nullptr 
) const

Return a node pointer on opposite side of the edge.

Parameters
[in]pointThe original point.
[out]secondPointIf passed the function set it true if the other hand is _p2 otherwise false.
Returns
The opposite side of edge otherwise error.

◆ IsEqual()

Bool IsEqual ( NODE *  p1,
NODE *  p2 
) const

Return true if the edge is in between p1 and p2.

Parameters
[in]p1First edge point to check.
[in]p2Second edge point to check.
Returns
True if this edge is in between p1 and p2. otherwise false.

◆ Reset()

void Reset ( )

Free memory and reset all values.

Member Data Documentation

◆ _p1

NODE* _p1
protected

◆ _p2

NODE* _p2
protected