Fixed the cubic infill: The cubic infill was 30% flatter than it should

have been.
This commit is contained in:
bubnikv 2017-10-03 11:29:13 +02:00
parent a52a04550e
commit 1958673806
2 changed files with 8 additions and 6 deletions

View File

@ -1456,10 +1456,11 @@ Polylines FillCubic::fill_surface(const Surface *surface, const FillParams &para
FillParams params2 = params;
params2.density *= 0.333333333f;
Polylines polylines_out;
if (! fill_surface_by_lines(surface, params2, 0.f, z, polylines_out) ||
! fill_surface_by_lines(surface, params2, float(M_PI / 3.), -z, polylines_out) ||
coordf_t dx = sqrt(0.5) * z;
if (! fill_surface_by_lines(surface, params2, 0.f, dx, polylines_out) ||
! fill_surface_by_lines(surface, params2, float(M_PI / 3.), - dx, polylines_out) ||
// Rotated by PI*2/3 + PI to achieve reverse sloping wall.
! fill_surface_by_lines(surface, params2, float(M_PI * 2. / 3.), z, polylines_out)) {
! fill_surface_by_lines(surface, params2, float(M_PI * 2. / 3.), dx, polylines_out)) {
printf("FillCubic::fill_surface() failed to fill a region.\n");
}
return polylines_out;

View File

@ -1630,9 +1630,10 @@ Polylines FillCubic3::fill_surface(const Surface *surface, const FillParams &par
params2.density *= 0.333333333f;
Polylines polylines_out;
std::vector<FillDirParams> fill_dir_params;
fill_dir_params.emplace_back(FillDirParams(this->spacing, 0., z));
fill_dir_params.emplace_back(FillDirParams(this->spacing, M_PI / 3., -z));
fill_dir_params.emplace_back(FillDirParams(this->spacing, 2. * M_PI / 3., z));
coordf_t dx = sqrt(0.5) * z;
fill_dir_params.emplace_back(FillDirParams(this->spacing, 0., dx));
fill_dir_params.emplace_back(FillDirParams(this->spacing, M_PI / 3., -dx));
fill_dir_params.emplace_back(FillDirParams(this->spacing, 2. * M_PI / 3., dx));
if (! fill_surface_by_lines(surface, params2, fill_dir_params, polylines_out))
printf("FillCubic3::fill_surface() failed to fill a region.\n");
return polylines_out;