Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save a step in PathFindingSurface constructor #520

Merged
merged 2 commits into from
Jan 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions path_finding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class PathFindingSurface {
return;
}
if (keep_in) {
multi_polygon_type_fp total_keep_in;
total_keep_in = *keep_in;
total_keep_in = total_keep_in - keep_out;
multi_polygon_type_fp total_keep_in = *keep_in - keep_out;

for (const auto& poly : total_keep_in) {
for (const auto& point : poly.outer()) {
Expand Down Expand Up @@ -63,16 +61,10 @@ class PathFindingSurface {
}

sort(all_vertices.begin(),
all_vertices.end(),
[](const point_type_fp& a, const point_type_fp& b) {
return std::tie(a.x(), a.y()) < std::tie(b.x(), b.y());
});
all_vertices.end());
all_vertices.erase(
std::unique(all_vertices.begin(),
all_vertices.end(),
[](const point_type_fp& a, const point_type_fp& b) {
return std::tie(a.x(), a.y()) == std::tie(b.x(), b.y());
}),
all_vertices.end()),
all_vertices.end());
for (const auto& v : all_vertices) {
bg::expand(all_vertices_box, v);
Expand Down