-
首页
-
C4D R23.110 C++ SDK
GraphBase< NODE, EDGE > Class Template Reference
#include <graphbase.h>
详细描述
template<typename NODE, typename EDGE>
class maxon::GraphBase< NODE, EDGE >
Basic undirected graph template.
-
Template Parameters
-
NODE
|
The node type in the graph.
|
EDGE
|
The edge type in the graph.
|
公共成员函数
|
|
GraphBase
()
|
|
~GraphBase
()
|
|
GraphBase
(
GraphBase
&&
src
)
|
Result
< void >
|
CopyFrom
(const
GraphBase
&
src
)
|
Result
< void >
|
AppendGraph
(const
GraphBase
&
src
)
|
GRAPH_TYPE
|
GetType
() const
|
void
|
SetType
(
GRAPH_TYPE
type)
|
Int
|
GetNodesCount
(
Bool
subPoint=false) const
|
Int
|
GetEdgesCount
() const
|
NODE *
|
GetFirstNode
()
|
NODE *
|
GetLastNode
()
|
NODE *
|
FindNodeByPosition
(const
向量
&position,
Float
tolerance=0.0)
|
const NODE *
|
FindNodeByPosition
(const
向量
&position,
Float
tolerance=0.0) const
|
Result
< NODE * >
|
GetNode
(
Int
idx)
|
Result
< const NODE * >
|
GetNode
(
Int
idx) const
|
Result
< NODE * >
|
GetSuccessor
(NODE *node)
|
Result
< NODE * >
|
GetPredecessor
(NODE *node)
|
Result
< EDGE * >
|
GetSuccessorEdge
(NODE *node)
|
Result
< EDGE * >
|
GetPredecessorEdge
(NODE *node)
|
Int
|
FindNode
(NODE *node)
|
Result
< EDGE * >
|
GetEdge
(
Int
idx)
|
Result
< const EDGE * >
|
GetEdge
(
Int
idx) const
|
Int
|
FindEdge
(EDGE *edge)
|
Result
< EDGE * >
|
GetEdgeByPoints
(
NodeType
*p1,
NodeType
*p2) const
|
Result
< NODE * >
|
AddNode
(const
NodeType
&node,
Int
pos=
NOTOK
)
|
Result
< EDGE * >
|
AddEdge
(
NodeType
*p1,
NodeType
*p2,
Int
pos=
NOTOK
)
|
Result
< NODE * >
|
SplitEdge
(const NODE &node,
EdgeType
*edge)
|
Result
< EDGE * >
|
SplitEdge
(
NodeType
*node,
EdgeType
*edge)
|
Result
< void >
|
DeleteNode
(
NodeType
*node,
Bool
replaceEdge=true)
|
Result
< void >
|
DeleteNode
(
Int
pos,
Bool
replaceEdge=true)
|
Result
< void >
|
DeleteEdge
(
EdgeType
*edge,
Bool
nodes=false)
|
Result
< void >
|
DeleteEdge
(
Int
pos,
Bool
nodes=false)
|
Result
< void >
|
WeldNodes
(
NodeType
*p1,
NodeType
*p2)
|
Result
< void >
|
MeltEdge
(
EdgeType
*edge)
|
Result
< void >
|
MeltEdge
(
Int
pos)
|
void
|
重置
()
|
Member Typedef Documentation
◆
Super
◆
NodeType
◆
EdgeType
构造函数 & 析构函数文档编制
◆
GraphBase()
[1/2]
◆
~GraphBase()
◆
GraphBase()
[2/2]
成员函数文档编制
◆
CopyFrom()
◆
AppendGraph()
Append src graph t this graph, the existing graph is mantained.
-
参数
-
[in]
|
src
|
The graph to append.
|
-
返回
-
OK on success.
◆
GetType()
Get The graph type.
-
返回
-
The graph type.
◆
SetType()
Set The graph type.
-
参数
-
[in]
|
type
|
The new graph type.
|
◆
GetNodesCount()
Int
GetNodesCount
|
(
|
Bool
|
subPoint
=
false
|
)
|
const
|
Get All nodes count in the graph.
-
返回
-
The main point count in the graph.
◆
GetEdgesCount()
Int
GetEdgesCount
|
(
|
|
)
|
const
|
Get All edge count in the graph.
-
返回
-
The stroke count in the graph.
◆
GetFirstNode()
Get a pointer to the first node.
-
返回
-
A pointer to the first node.
◆
GetLastNode()
Get a pointer to the last node.
-
返回
-
A pointer to the last node.
◆
FindNodeByPosition()
[1/2]
NODE* FindNodeByPosition
|
(
|
const
向量
&
|
position
,
|
|
|
Float
|
tolerance
=
0.0
|
|
)
|
|
|
Serch a node with at passed position.
-
参数
-
[in]
|
position
|
The 3d position where search the node.
|
[in]
|
tolerance
|
Search can be tolerat if passed value is != 0.
|
-
返回
-
A pointer to the node if found at position otherwise false.
◆
FindNodeByPosition()
[2/2]
const NODE* FindNodeByPosition
|
(
|
const
向量
&
|
position
,
|
|
|
Float
|
tolerance
=
0.0
|
|
)
|
|
const
|
Serch a node with at passed position.
-
参数
-
[in]
|
position
|
The 3d position where search the node.
|
[in]
|
tolerance
|
Search can be tolerat if passed value is != 0.
|
-
返回
-
A pointer to the node if found at position otherwise false.
◆
GetNode()
[1/2]
Get a node in the list.
-
参数
-
[in]
|
idx
|
The node index in the list.
|
-
返回
-
A pointer to the entry in the list otherwise error.
◆
GetNode()
[2/2]
Result
<const NODE*> GetNode
|
(
|
Int
|
idx
|
)
|
const
|
Get a node in the list.
-
参数
-
[in]
|
idx
|
The node index in the list.
|
-
返回
-
A pointer to the entry in the list otherwise error.
◆
GetSuccessor()
Result
<NODE*> GetSuccessor
|
(
|
NODE *
|
node
|
)
|
|
Get the successor node, valid only in continuos graph case.
-
参数
-
-
返回
-
A pointer to the successor node otherwise an error.
◆
GetPredecessor()
Result
<NODE*> GetPredecessor
|
(
|
NODE *
|
node
|
)
|
|
Get the predecessor node, valid only in continuos graph case.
-
参数
-
-
返回
-
A pointer to the Predecessor node otherwise an error.
◆
GetSuccessorEdge()
Result
<EDGE*> GetSuccessorEdge
|
(
|
NODE *
|
node
|
)
|
|
Get the successor edge, valid only in continuos graph case.
-
参数
-
-
返回
-
A pointer to the successor edge otherwise an error.
◆
GetPredecessorEdge()
Result
<EDGE*> GetPredecessorEdge
|
(
|
NODE *
|
node
|
)
|
|
Get the predecessor edge, valid only in continuos graph case.
-
参数
-
-
返回
-
A pointer to the Predecessor edge otherwise an error.
◆
FindNode()
Int
FindNode
|
(
|
NODE *
|
node
|
)
|
|
Check if node exist in the node list and return the index.
-
参数
-
[in]
|
node
|
The node to check for.
|
-
返回
-
The node index if found or NOTOK if the node is not in to the list.
◆
GetEdge()
[1/2]
Get a edge at idx in the list.
-
参数
-
[in]
|
idx
|
The edge index in the list.
|
-
返回
-
A pointer to the entry in the list otherwise error.
◆
GetEdge()
[2/2]
Result
<const EDGE*> GetEdge
|
(
|
Int
|
idx
|
)
|
const
|
Get a edge at idx in the list.
-
参数
-
[in]
|
idx
|
The edge index in the list.
|
-
返回
-
A pointer to the entry in the list otherwise error.
◆
FindEdge()
Int
FindEdge
|
(
|
EDGE *
|
edge
|
)
|
|
Check if edge exist in the edge list and return the index.
-
参数
-
[in]
|
edge
|
The edge to check for.
|
-
返回
-
The edge index if found or NOTOK if the edge is not in to the list.
◆
GetEdgeByPoints()
Check if exist a edge in between p1 and p2, if yes return the pointer.
-
参数
-
[in]
|
p1
|
First edge point.
|
[in]
|
p2
|
Second edge point.
|
-
返回
-
A pointer to the edge otherwise error.
◆
AddNode()
Add a new node to the list.
-
参数
-
[in]
|
node
|
The new pen node to add.
|
[in]
|
pos
|
Optional position in to the array if NOTOK or not passed the point is added at the end of the list.
|
-
返回
-
A pointer to the added entry otherwise error.
◆
AddEdge()
Add a new edge in between p1 and p2 with type and initialize it. Automatically map the stoke to the points list.
-
参数
-
[in]
|
p1
|
First edge node.
|
[in]
|
p2
|
Second edge node.
|
[in]
|
pos
|
If not NOTOK new stroke will be inserted at pos in the list.
|
-
返回
-
A pointer to the new stroke added to the list otherwise error.
◆
SplitEdge()
[1/2]
Split edge in 2 parts by adding the new node.
-
参数
-
[in]
|
node
|
The new node to insert in to the list.
|
[in]
|
edge
|
The edge to split.
|
-
返回
-
A pointer to the new created node otherwise error.
◆
SplitEdge()
[2/2]
Split edge in 2 parts by attaching it to an existing node.
-
参数
-
[in]
|
node
|
The node to attach the strokes.
|
[in]
|
edge
|
The edge to split.
|
-
返回
-
The new added edge pointer otherwise error.
◆
DeleteNode()
[1/2]
Remove node and the connected edges.
-
参数
-
[in]
|
node
|
The node to be removed.
|
[in]
|
replaceEdge
|
If true a new edge will be added to fill the gap, just if the graph is not sparse (max 2 edges per node).
|
-
返回
-
OK on success.
◆
DeleteNode()
[2/2]
Remove node at pos and the connected edges.
-
参数
-
[in]
|
pos
|
The index position of node to be removed.
|
[in]
|
replaceEdge
|
If true a new edge will be added to fill the gap, just if the graph is not sparse (max 2 edges per node).
|
-
返回
-
OK on success.
◆
DeleteEdge()
[1/2]
Remove the edge and adjust the nodes<->edges mapping.
-
参数
-
[in]
|
edge
|
The edge to be removed.
|
[in]
|
nodes
|
If True also node will be deleted if any other edge use it.
|
-
返回
-
OK on success.
◆
DeleteEdge()
[2/2]
Remove the edge and adjust the nodes<->edges mapping.
-
参数
-
[in]
|
pos
|
The position in to edge list.
|
[in]
|
nodes
|
If True also nodes will be deleted if any other edge use it.
|
-
返回
-
OK on success.
◆
WeldNodes()
Weld disconnected nodes.
-
参数
-
[in]
|
p1
|
First node, this node will be stay alive.
|
[in]
|
p2
|
Second node.
|
-
返回
-
OK on success.
◆
MeltEdge()
[1/2]
Shrink edge to a single node and refresh the graph.
-
参数
-
[in]
|
edge
|
The edge to be removed.
|
-
返回
-
OK on success.
◆
MeltEdge()
[2/2]
Shrink edge at pos to a single node and refresh the graph.
-
参数
-
[in]
|
pos
|
The position in to edge list.
|
-
返回
-
OK on success.
◆
Reset()
Free memory and reset all values.
Member Data Documentation
◆
_type
◆
_nodes
◆
_edges