Locus No Pilotus
Project of four first grade MIPT DAFE/RSE students (for engineering practical work in the second semester) in Qt C++
Loading...
Searching...
No Matches
math::PathWayGraph Struct Reference

Граф вершин между контрольными точками More...

#include <path_graph.h>

Collaboration diagram for math::PathWayGraph:

Public Member Functions

void AddEdge (std::size_t node_1, std::size_t node_2, double length)
 
void AddNode (PathWayNode *new_node)
 
void RemoveNonConstantNodes ()
 

Public Attributes

std::vector< std::shared_ptr< PathWayNode > > nodes
 

Detailed Description

Граф вершин между контрольными точками

Member Function Documentation

◆ 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
Here is the caller graph for this function:

◆ AddNode()

void math::PathWayGraph::AddNode ( PathWayNode * new_node)
inline
51{ nodes.emplace_back(new_node); }
Here is the caller graph for this function:

◆ 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 }
73 nodes.erase(nodes.begin() + i);
74 }
75 }
Here is the caller graph for this function:

Member Data Documentation

◆ nodes

std::vector<std::shared_ptr<PathWayNode> > math::PathWayGraph::nodes

The documentation for this struct was generated from the following file: