Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2021-12-20 20:25:19 +0300
committersupermerill <merill@free.fr>2021-12-20 20:25:33 +0300
commit91d3862ead68915cc6c64617f8cb5fa32183d5e3 (patch)
tree2aca3e36fc4b9c9d9e2cadc41395d752989917e3 /src
parent2f4b55ed3cd790d5f7df3d8f639da07b80f8e5b3 (diff)
Fix 'merge thin walls with perimeter' (unneeded travels)
also now use coincide_with_epsilon for most of medial_axis, as I have the proof the position can vary by 1 unit in an intersection. supermerill/SuperSlicer#2092
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/MedialAxis.cpp151
-rw-r--r--src/libslic3r/PerimeterGenerator.cpp26
-rw-r--r--src/libslic3r/Point.hpp2
-rw-r--r--src/libslic3r/Polyline.cpp18
4 files changed, 110 insertions, 87 deletions
diff --git a/src/libslic3r/MedialAxis.cpp b/src/libslic3r/MedialAxis.cpp
index 54c2beace..db05fbd17 100644
--- a/src/libslic3r/MedialAxis.cpp
+++ b/src/libslic3r/MedialAxis.cpp
@@ -465,7 +465,7 @@ get_coeff_from_angle_countour(Point &point, const ExPolygon &contour, coord_t mi
if (angle >= PI) angle = 2 * PI - angle; // smaller angle
//compute the diff from 90°
angle = abs(angle - PI / 2);
- if (point_near.coincides_with(point_nearest) && std::max(nearest_dist, near_dist) + SCALED_EPSILON < point_nearest.distance_to(point_near)) {
+ if (point_near.coincides_with_epsilon(point_nearest) && std::max(nearest_dist, near_dist) + SCALED_EPSILON < point_nearest.distance_to(point_near)) {
//not only nearest
Point point_before = id_near == 0 ? contour.contour.points.back() : contour.contour.points[id_near - 1];
Point point_after = id_near == contour.contour.points.size() - 1 ? contour.contour.points.front() : contour.contour.points[id_near + 1];
@@ -532,13 +532,13 @@ MedialAxis::fusion_curve(ThickPolylines &pp)
for (size_t j = 0; j < pp.size(); ++j) {
if (j == i) continue;
ThickPolyline& other = pp[j];
- if (polyline.first_point().coincides_with(other.last_point())) {
+ if (polyline.first_point().coincides_with_epsilon(other.last_point())) {
other.reverse();
crosspoint.push_back(j);
double dot_temp = dot(Line(polyline.points[0], polyline.points[1]), (Line(other.points[0], other.points[1])));
min_dot = std::min(min_dot, abs(dot_temp));
sum_dot += dot_temp;
- } else if (polyline.first_point().coincides_with(other.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.first_point())) {
crosspoint.push_back(j);
double dot_temp = dot(Line(polyline.points[0], polyline.points[1]), (Line(other.points[0], other.points[1])));
min_dot = std::min(min_dot, abs(dot_temp));
@@ -616,10 +616,10 @@ MedialAxis::remove_bits(ThickPolylines &pp)
for (size_t j = 0; j < pp.size(); ++j) {
if (j == i) continue;
ThickPolyline& other = pp[j];
- if (polyline.first_point().coincides_with(other.last_point())) {
+ if (polyline.first_point().coincides_with_epsilon(other.last_point())) {
other.reverse();
crosspoint.push_back(j);
- } else if (polyline.first_point().coincides_with(other.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.first_point())) {
crosspoint.push_back(j);
}
}
@@ -675,10 +675,10 @@ MedialAxis::fusion_corners(ThickPolylines &pp)
for (size_t j = 0; j < pp.size(); ++j) {
if (j == i) continue;
ThickPolyline& other = pp[j];
- if (polyline.first_point().coincides_with(other.last_point())) {
+ if (polyline.first_point().coincides_with_epsilon(other.last_point())) {
other.reverse();
crosspoint.push_back(j);
- } else if (polyline.first_point().coincides_with(other.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.first_point())) {
crosspoint.push_back(j);
}
}
@@ -912,13 +912,13 @@ MedialAxis::main_fusion(ThickPolylines& pp)
// find another polyline starting here
for (size_t j = i + 1; j < pp.size(); ++j) {
ThickPolyline& other = pp[j];
- if (polyline.last_point().coincides_with(other.last_point())) {
+ if (polyline.last_point().coincides_with_epsilon(other.last_point())) {
polyline.reverse();
other.reverse();
- } else if (polyline.first_point().coincides_with(other.last_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.last_point())) {
other.reverse();
- } else if (polyline.first_point().coincides_with(other.first_point())) {
- } else if (polyline.last_point().coincides_with(other.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.first_point())) {
+ } else if (polyline.last_point().coincides_with_epsilon(other.first_point())) {
polyline.reverse();
} else {
continue;
@@ -978,7 +978,7 @@ MedialAxis::main_fusion(ThickPolylines& pp)
//std::cout << "try to find main : " << k << " ? " << i << " " << j << " ";
if (k == i || k == j) continue;
ThickPolyline& main = pp[k];
- if (polyline.first_point().coincides_with(main.last_point())) {
+ if (polyline.first_point().coincides_with_epsilon(main.last_point())) {
main.reverse();
if (!main.endpoints.second)
find_main_branch = true;
@@ -986,7 +986,7 @@ MedialAxis::main_fusion(ThickPolylines& pp)
biggest_main_branch_id = k;
biggest_main_branch_length = (coord_t)main.length();
}
- } else if (polyline.first_point().coincides_with(main.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(main.first_point())) {
if (!main.endpoints.second)
find_main_branch = true;
else if (biggest_main_branch_length < main.length()) {
@@ -1291,14 +1291,14 @@ MedialAxis::concatenate_polylines_with_crossing(ThickPolylines& pp)
if (other.endpoints.first && other.endpoints.second) continue;
bool me_reverse = false;
bool other_reverse = false;
- if (polyline.last_point().coincides_with(other.last_point())) {
+ if (polyline.last_point().coincides_with_epsilon(other.last_point())) {
other_reverse = true;
- } else if (polyline.first_point().coincides_with(other.last_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.last_point())) {
me_reverse = true;
other_reverse = true;
- } else if (polyline.first_point().coincides_with(other.first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(other.first_point())) {
me_reverse = true;
- } else if (!polyline.last_point().coincides_with(other.first_point())) {
+ } else if (!polyline.last_point().coincides_with_epsilon(other.first_point())) {
continue;
}
@@ -1316,12 +1316,12 @@ MedialAxis::concatenate_polylines_with_crossing(ThickPolylines& pp)
}
}
if (best_candidate != nullptr && best_candidate->points.size() > 1) {
- if (polyline.last_point().coincides_with(best_candidate->last_point())) {
+ if (polyline.last_point().coincides_with_epsilon(best_candidate->last_point())) {
best_candidate->reverse();
- } else if (polyline.first_point().coincides_with(best_candidate->last_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(best_candidate->last_point())) {
polyline.reverse();
best_candidate->reverse();
- } else if (polyline.first_point().coincides_with(best_candidate->first_point())) {
+ } else if (polyline.first_point().coincides_with_epsilon(best_candidate->first_point())) {
polyline.reverse();
}
//intersections may create over-extrusion because the included circle can be a bit larger. We have to make it short again if needed.
@@ -1415,18 +1415,18 @@ MedialAxis::remove_too_short_polylines(ThickPolylines& pp, const coord_t min_siz
// if (endpoint_not_used[idx_endpoint]) {
// int nb_endpoints;
// Point pt = idx_endpoint % 2 == 0 ? polyline.first_point() : polyline.last_point();
- // if (idx_endpoint % 2 == 0 && pt.coincides_with(polyline.last_point())) {
+ // if (idx_endpoint % 2 == 0 && pt.coincides_with_epsilon(polyline.last_point())) {
// nb_endpoints++;
// endpoint_not_used[(idx_endpoint / 2) + 1] = false;
// }
// //good, now find other points
// for (size_t idx_other_pp = (idx_endpoint / 2) + 1; idx_other_pp < pp.size(); idx_other_pp++) {
// ThickPolyline& other = pp[idx_other_pp];
- // if (pt.coincides_with(other.first_point())) {
+ // if (pt.coincides_with_epsilon(other.first_point())) {
// nb_endpoints++;
// endpoint_not_used[idx_other_pp * 2] = false;
// }
- // if (pt.coincides_with(other.last_point())) {
+ // if (pt.coincides_with_epsilon(other.last_point())) {
// nb_endpoints++;
// endpoint_not_used[idx_other_pp * 2 + 1] = false;
// }
@@ -1438,7 +1438,7 @@ MedialAxis::remove_too_short_polylines(ThickPolylines& pp, const coord_t min_siz
// std::cout << "reduce " << reduction << " points!\n";
// if (idx_endpoint % 2 == 0 ) {
// polyline.width.front() *= reduction;
- // if(pt.coincides_with(polyline.last_point()))
+ // if(pt.coincides_with_epsilon(polyline.last_point()))
// polyline.width.back() *= reduction;
// } else {
// polyline.width.back() *= reduction;
@@ -1446,10 +1446,10 @@ MedialAxis::remove_too_short_polylines(ThickPolylines& pp, const coord_t min_siz
// //good, now find other points
// for (size_t idx_other_pp = (idx_endpoint / 2) + 1; idx_other_pp < pp.size(); idx_other_pp++) {
// ThickPolyline& other = pp[idx_other_pp];
- // if (pt.coincides_with(other.first_point())) {
+ // if (pt.coincides_with_epsilon(other.first_point())) {
// other.width.front() *= reduction;
// }
- // if (pt.coincides_with(other.last_point())) {
+ // if (pt.coincides_with_epsilon(other.last_point())) {
// other.width.back() *= reduction;
// }
// }
@@ -1697,7 +1697,7 @@ MedialAxis::build(ThickPolylines &polylines_out)
{
//static int id = 0;
//id++;
- //std::cout << this->id << "\n";
+ //std::cout << id << "\n";
//{
// std::stringstream stri;
// stri << "medial_axis_0_enter_" << id << ".svg";
@@ -1710,8 +1710,8 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_0.5_simplified_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(bounds);
- // svg.draw(this->expolygon);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
// svg.Close();
//}
//safety check
@@ -1778,9 +1778,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_0.9_voronoi_" << id << ".svg";
// SVG svg(stri.str());
- // //svg.draw(bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1805,9 +1805,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_1_voronoi_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1820,9 +1820,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_1_voronoi_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1846,9 +1846,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_2_curve_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1863,9 +1863,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_3_fusion_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1875,6 +1875,15 @@ MedialAxis::build(ThickPolylines &polylines_out)
// Loop through all returned polylines in order to extend their endpoints to the
// expolygon boundaries (if done here, it may be cut later if not thick enough)
if (stop_at_min_width) {
+ //{
+ // std::stringstream stri;
+ // stri << "medial_axis_3_3_extends_" << id << ".svg";
+ // SVG svg(stri.str());
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
+ // svg.Close();
+ //}
extends_line_both_side(pp);
}
@@ -1886,14 +1895,24 @@ MedialAxis::build(ThickPolylines &polylines_out)
std::cout << "\n";
}*/
//reduce extrusion when it's too thin to be printable
+ //{
+ // std::stringstream stri;
+ // stri << "medial_axis_3_6_remove_thin_" << id << ".svg";
+ // SVG svg(stri.str());
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
+ // svg.Close();
+ //}
+
remove_too_thin_extrusion(pp);
//{
// std::stringstream stri;
// stri << "medial_axis_4_thinok_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1902,9 +1921,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_5.0_thuinner_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1917,9 +1936,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_5_expand_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
//TODO: reduce the flow at the intersection ( + ) points on crossing?
@@ -1928,9 +1947,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_6_concat_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1939,9 +1958,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_8_tooshort_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -1950,9 +1969,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_9.1_end_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
if (nozzle_diameter != min_width) {
@@ -1965,9 +1984,9 @@ MedialAxis::build(ThickPolylines &polylines_out)
// std::stringstream stri;
// stri << "medial_axis_9.9_endnwithtaper_" << id << ".svg";
// SVG svg(stri.str());
- // svg.draw(*bounds);
- // svg.draw(this->expolygon);
- // svg.draw(pp);
+ // svg.draw(*bounds, "grey");
+ // svg.draw(this->expolygon, "green");
+ // svg.draw(pp, "red");
// svg.Close();
//}
@@ -2136,7 +2155,7 @@ thin_variable_width(const ThickPolylines &polylines, ExtrusionRole role, Flow fl
// Append paths to collection.
if (!paths.empty()) {
- if (paths.front().first_point().coincides_with(paths.back().last_point())) {
+ if (paths.front().first_point().coincides_with_epsilon(paths.back().last_point())) {
coll.append(ExtrusionLoop(paths));
} else {
if (role == erThinWall){
diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp
index 3aeed59da..aba01cfd1 100644
--- a/src/libslic3r/PerimeterGenerator.cpp
+++ b/src/libslic3r/PerimeterGenerator.cpp
@@ -462,7 +462,7 @@ void PerimeterGenerator::process()
// In case no perimeters are to be generated, loop_number will equal to -1.
std::vector<PerimeterGeneratorLoops> contours(loop_number + 1); // depth => loops
std::vector<PerimeterGeneratorLoops> holes(loop_number + 1); // depth => loops
- ThickPolylines thin_walls;
+ ThickPolylines thin_walls_thickpolys;
ExPolygons no_last_gapfill;
// we loop one time more than needed in order to find gaps after the last perimeter was applied
for (int i = 0;; ++i) { // outer loop is 0
@@ -562,7 +562,7 @@ void PerimeterGenerator::process()
ma.use_bounds(bound)
.use_min_real_width(scale_t(this->ext_perimeter_flow.nozzle_diameter))
.use_tapers(thin_walls_overlap)
- .build(thin_walls);
+ .build(thin_walls_thickpolys);
}
break;
}
@@ -937,20 +937,23 @@ void PerimeterGenerator::process()
}
// append thin walls
- if (!thin_walls.empty()) {
- ExtrusionEntityCollection tw = thin_variable_width
- (thin_walls, erThinWall, this->ext_perimeter_flow, std::max(ext_perimeter_width/4, scale_t(this->print_config->resolution)));
-
- entities.append(tw.entities);
- thin_walls.clear();
+ if (!thin_walls_thickpolys.empty()) {
+ if (this->object_config->thin_walls_merge) {
+ _merge_thin_walls(entities, thin_walls_thickpolys);
+ } else {
+ ExtrusionEntityCollection tw = thin_variable_width
+ (thin_walls_thickpolys, erThinWall, this->ext_perimeter_flow, std::max(ext_perimeter_width / 4, scale_t(this->print_config->resolution)));
+ entities.append(tw.entities);
+ }
+ thin_walls_thickpolys.clear();
}
} else {
if (this->object_config->thin_walls_merge) {
ThickPolylines no_thin_walls;
entities = this->_traverse_loops(contours.front(), no_thin_walls);
- _merge_thin_walls(entities, thin_walls);
+ _merge_thin_walls(entities, thin_walls_thickpolys);
} else {
- entities = this->_traverse_loops(contours.front(), thin_walls);
+ entities = this->_traverse_loops(contours.front(), thin_walls_thickpolys);
}
}
@@ -1697,11 +1700,12 @@ void PerimeterGenerator::_merge_thin_walls(ExtrusionEntityCollection &extrusions
} else {
//first add the return path
ExtrusionEntityCollection tws_second = tws;
- tws_second.reverse();
change_flow.percent_extrusion = 0.1f;
change_flow.use(tws_second);
+ //force reverse
for (ExtrusionPath &path : change_flow.paths)
path.reverse();
+ std::reverse(change_flow.paths.begin(), change_flow.paths.end());
//std::reverse(change_flow.paths.begin(), change_flow.paths.end());
searcher.search_result.loop->paths.insert(searcher.search_result.loop->paths.begin() + 1 + searcher.search_result.idx_path,
change_flow.paths.begin(), change_flow.paths.end());
diff --git a/src/libslic3r/Point.hpp b/src/libslic3r/Point.hpp
index aaf1e7e48..b6a511b88 100644
--- a/src/libslic3r/Point.hpp
+++ b/src/libslic3r/Point.hpp
@@ -155,7 +155,7 @@ public:
double distance_to(const Line &line) const;
bool coincides_with(const Point &point) const { return this->x() == point.x() && this->y() == point.y(); }
bool coincides_with_epsilon(const Point &point) const {
- return std::abs(this->x() - point.x()) < SCALED_EPSILON && std::abs(this->y() - point.y()) < SCALED_EPSILON;
+ return std::abs(this->x() - point.x()) < SCALED_EPSILON/2 && std::abs(this->y() - point.y()) < SCALED_EPSILON/2;
}
};
diff --git a/src/libslic3r/Polyline.cpp b/src/libslic3r/Polyline.cpp
index 8f294f162..c7cf15c75 100644
--- a/src/libslic3r/Polyline.cpp
+++ b/src/libslic3r/Polyline.cpp
@@ -273,7 +273,7 @@ void concatThickPolylines(ThickPolylines& pp) {
//concat polyline if only 2 polyline at a point
for (size_t i = 0; i < pp.size(); ++i) {
ThickPolyline *polyline = &pp[i];
- if (polyline->first_point().coincides_with(polyline->last_point())) {
+ if (polyline->first_point().coincides_with_epsilon(polyline->last_point())) {
polyline->endpoints.first = false;
polyline->endpoints.second = false;
continue;
@@ -287,25 +287,25 @@ void concatThickPolylines(ThickPolylines& pp) {
for (size_t j = 0; j < pp.size(); ++j) {
if (j == i) continue;
ThickPolyline *other = &pp[j];
- if (polyline->last_point().coincides_with(other->last_point())) {
+ if (polyline->last_point().coincides_with_epsilon(other->last_point())) {
id_candidate_last_point = j;
nbCandidate_last_point++;
}
- if (polyline->last_point().coincides_with(other->first_point())) {
+ if (polyline->last_point().coincides_with_epsilon(other->first_point())) {
id_candidate_last_point = j;
nbCandidate_last_point++;
}
- if (polyline->first_point().coincides_with(other->last_point())) {
+ if (polyline->first_point().coincides_with_epsilon(other->last_point())) {
id_candidate_first_point = j;
nbCandidate_first_point++;
}
- if (polyline->first_point().coincides_with(other->first_point())) {
+ if (polyline->first_point().coincides_with_epsilon(other->first_point())) {
id_candidate_first_point = j;
nbCandidate_first_point++;
}
}
if (id_candidate_last_point == id_candidate_first_point && nbCandidate_first_point == 1 && nbCandidate_last_point == 1) {
- if (polyline->first_point().coincides_with(pp[id_candidate_first_point].first_point())) pp[id_candidate_first_point].reverse();
+ if (polyline->first_point().coincides_with_epsilon(pp[id_candidate_first_point].first_point())) pp[id_candidate_first_point].reverse();
// it's a trap! it's a loop!
polyline->points.insert(polyline->points.end(), pp[id_candidate_first_point].points.begin() + 1, pp[id_candidate_first_point].points.end());
polyline->width.insert(polyline->width.end(), pp[id_candidate_first_point].width.begin() + 1, pp[id_candidate_first_point].width.end());
@@ -316,7 +316,7 @@ void concatThickPolylines(ThickPolylines& pp) {
} else {
if (nbCandidate_first_point == 1) {
- if (polyline->first_point().coincides_with(pp[id_candidate_first_point].first_point())) pp[id_candidate_first_point].reverse();
+ if (polyline->first_point().coincides_with_epsilon(pp[id_candidate_first_point].first_point())) pp[id_candidate_first_point].reverse();
//concat at front
polyline->width[0] = std::max(polyline->width.front(), pp[id_candidate_first_point].width.back());
polyline->points.insert(polyline->points.begin(), pp[id_candidate_first_point].points.begin(), pp[id_candidate_first_point].points.end() - 1);
@@ -336,7 +336,7 @@ void concatThickPolylines(ThickPolylines& pp) {
polyline->endpoints.first = true;
}
if (nbCandidate_last_point == 1) {
- if (polyline->last_point().coincides_with(pp[id_candidate_last_point].last_point())) pp[id_candidate_last_point].reverse();
+ if (polyline->last_point().coincides_with_epsilon(pp[id_candidate_last_point].last_point())) pp[id_candidate_last_point].reverse();
//concat at back
polyline->width[polyline->width.size() - 1] = std::max(polyline->width.back(), pp[id_candidate_last_point].width.front());
polyline->points.insert(polyline->points.end(), pp[id_candidate_last_point].points.begin() + 1, pp[id_candidate_last_point].points.end());
@@ -353,7 +353,7 @@ void concatThickPolylines(ThickPolylines& pp) {
polyline->endpoints.second = true;
}
- if (polyline->last_point().coincides_with(polyline->first_point())) {
+ if (polyline->last_point().coincides_with_epsilon(polyline->first_point())) {
//the concat has created a loop : update endpoints
polyline->endpoints.first = false;
polyline->endpoints.second = false;