improve function name to reflect that it does unscaling (to_unscaled_linesf)

This commit is contained in:
Pavel Mikus 2022-10-06 12:19:33 +02:00
parent 8484f74967
commit c86deb92db
2 changed files with 12 additions and 6 deletions

View File

@ -125,7 +125,7 @@ inline Lines to_lines(const ExPolygons &src)
return lines;
}
inline std::vector<Linef> to_linesf(const ExPolygons &src)
inline std::vector<Linef> to_unscaled_linesf(const ExPolygons &src)
{
size_t n_lines = 0;
for (ExPolygons::const_iterator it_expoly = src.begin(); it_expoly != src.end(); ++ it_expoly) {
@ -138,9 +138,14 @@ inline std::vector<Linef> to_linesf(const ExPolygons &src)
for (ExPolygons::const_iterator it_expoly = src.begin(); it_expoly != src.end(); ++ it_expoly) {
for (size_t i = 0; i <= it_expoly->holes.size(); ++ i) {
const Points &points = ((i == 0) ? it_expoly->contour : it_expoly->holes[i - 1]).points;
for (Points::const_iterator it = points.begin(); it != points.end()-1; ++it)
lines.push_back(Linef(unscaled(*it), unscaled(*(it + 1))));
lines.push_back(Linef(unscaled(points.back()), unscaled(points.front())));
Vec2d unscaled_a = unscaled(points.front());
Vec2d unscaled_b = unscaled_a;
for (Points::const_iterator it = points.begin()+1; it != points.end(); ++it){
unscaled_b = unscaled(*(it));
lines.push_back(Linef(unscaled_a, unscaled_b));
unscaled_a = unscaled_b;
}
lines.push_back(Linef(unscaled_a, unscaled(points.front())));
}
}
return lines;

View File

@ -1054,7 +1054,7 @@ void SeamPlacer::calculate_overhangs_and_layer_embedding(const PrintObject *po)
[po, &layers](tbb::blocked_range<size_t> r) {
std::unique_ptr<PerimeterDistancer> prev_layer_distancer;
if (r.begin() > 0) { // previous layer exists
prev_layer_distancer = std::make_unique<PerimeterDistancer>(to_linesf(po->layers()[r.begin() - 1]->lslices));
prev_layer_distancer = std::make_unique<PerimeterDistancer>(to_unscaled_linesf(po->layers()[r.begin() - 1]->lslices));
}
for (size_t layer_idx = r.begin(); layer_idx < r.end(); ++layer_idx) {
@ -1065,7 +1065,8 @@ void SeamPlacer::calculate_overhangs_and_layer_embedding(const PrintObject *po)
}
};
bool should_compute_layer_embedding = regions_with_perimeter > 1;
std::unique_ptr<PerimeterDistancer> current_layer_distancer = std::make_unique<PerimeterDistancer>(to_linesf(po->layers()[layer_idx]->lslices));
std::unique_ptr<PerimeterDistancer> current_layer_distancer = std::make_unique<PerimeterDistancer>(
to_unscaled_linesf(po->layers()[layer_idx]->lslices));
for (SeamCandidate &perimeter_point : layers[layer_idx].points) {
Vec2f point = Vec2f { perimeter_point.position.head<2>() };