diff --git a/xs/src/libslic3r/Fill/FillRectilinear2.cpp b/xs/src/libslic3r/Fill/FillRectilinear2.cpp index e807a2164..58d9093af 100644 --- a/xs/src/libslic3r/Fill/FillRectilinear2.cpp +++ b/xs/src/libslic3r/Fill/FillRectilinear2.cpp @@ -1456,10 +1456,11 @@ Polylines FillCubic::fill_surface(const Surface *surface, const FillParams ¶ 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; diff --git a/xs/src/libslic3r/Fill/FillRectilinear3.cpp b/xs/src/libslic3r/Fill/FillRectilinear3.cpp index f4b198ade..1e7e3a1cd 100644 --- a/xs/src/libslic3r/Fill/FillRectilinear3.cpp +++ b/xs/src/libslic3r/Fill/FillRectilinear3.cpp @@ -1630,9 +1630,10 @@ Polylines FillCubic3::fill_surface(const Surface *surface, const FillParams &par params2.density *= 0.333333333f; Polylines polylines_out; std::vector 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;