Граф вершин между контрольными точками
More...
#include <path_graph.h>
Граф вершин между контрольными точками
◆ AddEdge()
void math::PathWayGraph::AddEdge |
( |
std::size_t | node_1, |
|
|
std::size_t | node_2, |
|
|
double | length ) |
|
inline |
78 {
79 std::shared_ptr<PathWayNode> node_ptr1, node_ptr2;
80
81 for (
auto node :
nodes) {
82 if (node->number == node_1)
83 node_ptr1 = node;
84 else if (node->number == node_2)
85 node_ptr2 = node;
86 }
87
88 node_ptr1->edges.push_back(node_ptr2);
89 node_ptr1->edges_lens.push_back(length);
90 node_ptr2->edges.push_back(node_ptr1);
91 node_ptr2->edges_lens.push_back(length);
92 }
std::vector< std::shared_ptr< PathWayNode > > nodes
Definition path_graph.h:48
◆ AddNode()
void math::PathWayGraph::AddNode |
( |
PathWayNode * | new_node | ) |
|
|
inline |
51{
nodes.emplace_back(new_node); }
◆ RemoveNonConstantNodes()
void math::PathWayGraph::RemoveNonConstantNodes |
( |
| ) |
|
|
inline |
54 {
55 std::size_t i = 0;
56 while (i <
nodes.size()) {
57 if (
nodes[i]->is_constant) {
58 ++i;
59 continue;
60 }
61 for (
const auto& other_node :
nodes[i]->edges) {
62 std::size_t j = 0;
63 while (j < other_node->edges.size()) {
64 if (
nodes[i]->point != other_node->edges[j]->point) {
65 ++j;
66 continue;
67 }
68 other_node->edges.erase(other_node->edges.begin() + j);
69 other_node->edges_lens.erase(other_node->edges_lens.begin() + j);
70 break;
71 }
72 }
74 }
75 }
◆ nodes
std::vector<std::shared_ptr<PathWayNode> > math::PathWayGraph::nodes |
The documentation for this struct was generated from the following file: