Add elephant foot compensation to SLA print

Work in progress


Convert efc input to the right scaling


Apply EFC on the slice index to make it visible in the preview.
This commit is contained in:
tamasmeszaros 2020-02-06 14:09:48 +01:00
parent f8c5855d55
commit 96d5c8c35d
8 changed files with 51 additions and 4 deletions

View file

@ -524,11 +524,10 @@ static inline void smooth_compensation_banded(const Points &contour, float band,
}
}
ExPolygon elephant_foot_compensation(const ExPolygon &input_expoly, const Flow &external_perimeter_flow, const double compensation)
ExPolygon elephant_foot_compensation(const ExPolygon &input_expoly, double min_contour_width, const double compensation)
{
// The contour shall be wide enough to apply the external perimeter plus compensation on both sides.
double min_contour_width = double(external_perimeter_flow.scaled_width() + external_perimeter_flow.scaled_spacing());
double scaled_compensation = scale_(compensation);
min_contour_width = scale_(min_contour_width);
double min_contour_width_compensated = min_contour_width + 2. * scaled_compensation;
// Make the search radius a bit larger for the averaging in contour_distance over a fan of rays to work.
double search_radius = min_contour_width_compensated + min_contour_width * 0.5;
@ -597,6 +596,13 @@ ExPolygon elephant_foot_compensation(const ExPolygon &input_expoly, const Flow &
return out;
}
ExPolygon elephant_foot_compensation(const ExPolygon &input, const Flow &external_perimeter_flow, const double compensation)
{
// The contour shall be wide enough to apply the external perimeter plus compensation on both sides.
double min_contour_width = double(external_perimeter_flow.width + external_perimeter_flow.spacing());
return elephant_foot_compensation(input, min_contour_width, compensation);
}
ExPolygons elephant_foot_compensation(const ExPolygons &input, const Flow &external_perimeter_flow, const double compensation)
{
ExPolygons out;
@ -606,4 +612,13 @@ ExPolygons elephant_foot_compensation(const ExPolygons &input, const Flow &exter
return out;
}
ExPolygons elephant_foot_compensation(const ExPolygons &input, double min_contour_width, const double compensation)
{
ExPolygons out;
out.reserve(input.size());
for (const ExPolygon &expoly : input)
out.emplace_back(elephant_foot_compensation(expoly, min_contour_width, compensation));
return out;
}
} // namespace Slic3r