Skip to content

Commit

Permalink
fix connections between hills in graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Stargazer2005 committed May 15, 2024
1 parent 1b1aff5 commit 4572b96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions math/optimal_way/optimal_way.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ void OptimalWayCalculator::AddGraphTangentPoints() {
DistanceBetweenPoints(
graph_.nodes[graph_.nodes.size() - vertexes.size()]->point,
new_node->point));

for (std::size_t j = 0; j < graph_.nodes.size(); ++j) {
if ((graph_.nodes[j]->point.another_tangent_point) &&
(new_node->point == *graph_.nodes[j]->point.another_tangent_point))
graph_.AddEdge(
graph_.nodes[j]->number, new_node->number,
DistanceBetweenPoints(graph_.nodes[j]->point, new_node->point));
for (auto& tangent_point : poly.GetTangentPoints()) {
if (tangent_point != new_node->point) continue;
for (auto& node : graph_.nodes) {
if (*tangent_point.another_tangent_point != node->point) continue;
graph_.AddEdge(node->number, new_node->number,
DistanceBetweenPoints(node->point, new_node->point));
}
}
}
}
Expand Down

0 comments on commit 4572b96

Please sign in to comment.