22 std::vector<std::shared_ptr<PathWayNode>>
edges;
29 std::shared_ptr<PolygonObstacle>
poly_ptr =
nullptr;
48 std::vector<std::shared_ptr<PathWayNode>>
nodes;
56 while (i <
nodes.size()) {
57 if (
nodes[i]->is_constant) {
61 for (
const auto& other_node :
nodes[i]->edges) {
63 while (j < other_node->edges.size()) {
64 if (
nodes[i]->point != other_node->edges[j]->point) {
68 other_node->edges.erase(other_node->edges.begin() + j);
69 other_node->edges_lens.erase(other_node->edges_lens.begin() + j);
78 void AddEdge(std::size_t node_1, std::size_t node_2,
double length) {
79 std::shared_ptr<PathWayNode> node_ptr1, node_ptr2;
81 for (
auto node :
nodes) {
82 if (node->number == node_1)
84 else if (node->number == node_2)
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);
Реализация алгоритма Дейкстры
Definition path_graph.h:96
std::vector< std::size_t > Get_Min_Path() const
Definition path_graph.h:117
std::size_t first_point_
Definition path_graph.h:121
std::vector< std::size_t > min_path_
Definition path_graph.h:133
void Calculate_Min_Path()
Определяет длину кратчайшего пути из start_ в end_.
Definition path_graph.cpp:9
std::map< std::size_t, double > graphs_vertex_
Definition path_graph.h:136
std::vector< std::shared_ptr< PathWayNode > > path_nodes_
Definition path_graph.h:127
double min_length_
Definition path_graph.h:130
std::size_t second_point_
Definition path_graph.h:124
DijkstrasAlgorithm(PathWayGraph graph)
Инициализирует новый экземпляр Dijkstras_algorithm.
Definition path_graph.h:103
double Get_Min_Len() const
Definition path_graph.h:114
Definition adjacency_matrix.cpp:7
Граф вершин между контрольными точками
Definition path_graph.h:46
void AddNode(PathWayNode *new_node)
Definition path_graph.h:51
std::vector< std::shared_ptr< PathWayNode > > nodes
Definition path_graph.h:48
void AddEdge(std::size_t node_1, std::size_t node_2, double length)
Definition path_graph.h:78
void RemoveNonConstantNodes()
Definition path_graph.h:54
Вершина графа
Definition path_graph.h:12
bool is_visited
Definition path_graph.h:39
std::vector< double > edges_lens
Definition path_graph.h:25
std::shared_ptr< CircleObstacle > circle_ptr
Definition path_graph.h:27
PathWayNode(Point p, std::size_t n, bool is_const)
PathWayNode.
Definition path_graph.h:18
std::size_t number
Definition path_graph.h:35
Point point
Definition path_graph.h:32
std::shared_ptr< PolygonObstacle > poly_ptr
Definition path_graph.h:29
bool is_constant
Definition path_graph.h:42
std::vector< std::shared_ptr< PathWayNode > > edges
Definition path_graph.h:22
Точка с геометрическими связями
Definition obstacles.h:46