diff --git a/src/libslic3r/Measure.cpp b/src/libslic3r/Measure.cpp index ffff12bab..ef685b15d 100644 --- a/src/libslic3r/Measure.cpp +++ b/src/libslic3r/Measure.cpp @@ -682,16 +682,16 @@ MeasurementResult get_measurement(const SurfaceFeature& a, const SurfaceFeature& if (f2.get_type() == SurfaceFeatureType::Edge) { std::vector distances; -// auto add_point_edge_distance = [&distances](const Vec3d& v, const std::pair& e) { -// const MeasurementResult res = get_measurement(SurfaceFeature(v), SurfaceFeature(SurfaceFeatureType::Edge, e.first, e.second)); -// double distance = res.distance_strict->dist; -// Vec3d v2 = res.distance_strict->to; -// -// const Vec3d e1e2 = e.second - e.first; -// const Vec3d e1v2 = v2 - e.first; -// if (e1v2.dot(e1e2) >= 0.0 && e1v2.norm() < e1e2.norm()) -// distances.emplace_back(distance, v, v2); -// }; + auto add_point_edge_distance = [&distances](const Vec3d& v, const std::pair& e) { + const MeasurementResult res = get_measurement(SurfaceFeature(v), SurfaceFeature(SurfaceFeatureType::Edge, e.first, e.second)); + double distance = res.distance_strict->dist; + Vec3d v2 = res.distance_strict->to; + + const Vec3d e1e2 = e.second - e.first; + const Vec3d e1v2 = v2 - e.first; + if (e1v2.dot(e1e2) >= 0.0 && e1v2.norm() < e1e2.norm()) + distances.emplace_back(distance, v, v2); + }; std::pair e1 = f1.get_edge(); std::pair e2 = f2.get_edge(); @@ -700,10 +700,10 @@ MeasurementResult get_measurement(const SurfaceFeature& a, const SurfaceFeature& distances.emplace_back((e2.second - e1.first).norm(), e1.first, e2.second); distances.emplace_back((e2.first - e1.second).norm(), e1.second, e2.first); distances.emplace_back((e2.second - e1.second).norm(), e1.second, e2.second); -// add_point_edge_distance(e1.first, e2); -// add_point_edge_distance(e1.second, e2); -// add_point_edge_distance(e2.first, e1); -// add_point_edge_distance(e2.second, e1); + add_point_edge_distance(e1.first, e2); + add_point_edge_distance(e1.second, e2); + add_point_edge_distance(e2.first, e1); + add_point_edge_distance(e2.second, e1); auto it = std::min_element(distances.begin(), distances.end(), [](const DistAndPoints& item1, const DistAndPoints& item2) { return item1.dist < item2.dist;