From e9a325c9ca7203161282eedfe134bd7ff0563adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Thu, 10 Sep 2020 22:30:49 +0200 Subject: [PATCH 1/3] Fix rotation in support cubic infill --- src/libslic3r/Fill/FillAdaptive.cpp | 6 +++--- src/libslic3r/Fill/FillAdaptive.hpp | 2 +- src/libslic3r/PrintObject.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/Fill/FillAdaptive.cpp b/src/libslic3r/Fill/FillAdaptive.cpp index fb8c665eb..f1fa56c5b 100644 --- a/src/libslic3r/Fill/FillAdaptive.cpp +++ b/src/libslic3r/Fill/FillAdaptive.cpp @@ -392,7 +392,7 @@ void FillAdaptive_Internal::Octree::propagate_point( Octree::propagate_point(point, child, (depth - 1), cubes_properties); } -std::unique_ptr FillSupportCubic::build_octree_for_adaptive_support( +std::unique_ptr FillSupportCubic::build_octree( TriangleMesh & triangle_mesh, coordf_t line_spacing, const Vec3d & cube_center, @@ -434,7 +434,7 @@ std::unique_ptr FillSupportCubic::build_octree_fo auto octree = std::make_unique(std::make_unique(cube_center), cube_center, cubes_properties); - double cube_edge_length = line_spacing; + double cube_edge_length = line_spacing / 2.0; size_t max_depth = octree->cubes_properties.size() - 1; BoundingBoxf3 mesh_bb = triangle_mesh.bounding_box(); Vec3f vertical(0, 0, 1); @@ -497,7 +497,7 @@ std::unique_ptr FillSupportCubic::build_octree_fo if(intersect_triangle(cube_center_absolute_arr, dir, vert_0, vert_1, vert_2, &distance, &cord_u, &cord_v) && distance > 0 && distance <= cube_edge_length) { Vec3d cube_center_transformed(cube_center_absolute.x(), cube_center_absolute.y(), cube_center_absolute.z() + (cube_edge_length / 2.0)); - Octree::propagate_point(cube_center_transformed, octree->root_cube.get(), max_depth, octree->cubes_properties); + Octree::propagate_point(rotation_matrix * cube_center_transformed, octree->root_cube.get(), max_depth, octree->cubes_properties); } } } diff --git a/src/libslic3r/Fill/FillAdaptive.hpp b/src/libslic3r/Fill/FillAdaptive.hpp index 45bfde802..96f446773 100644 --- a/src/libslic3r/Fill/FillAdaptive.hpp +++ b/src/libslic3r/Fill/FillAdaptive.hpp @@ -120,7 +120,7 @@ protected: Polylines &polylines_out); public: - static std::unique_ptr build_octree_for_adaptive_support( + static std::unique_ptr build_octree_for( TriangleMesh & triangle_mesh, coordf_t line_spacing, const Vec3d & cube_center, diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index a102c3281..2df7994ee 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -491,14 +491,14 @@ std::pair, std::unique_ptr Date: Thu, 10 Sep 2020 22:38:37 +0200 Subject: [PATCH 2/3] Fix typo in function build_octree --- src/libslic3r/Fill/FillAdaptive.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/Fill/FillAdaptive.hpp b/src/libslic3r/Fill/FillAdaptive.hpp index 96f446773..4bb80fa06 100644 --- a/src/libslic3r/Fill/FillAdaptive.hpp +++ b/src/libslic3r/Fill/FillAdaptive.hpp @@ -120,7 +120,7 @@ protected: Polylines &polylines_out); public: - static std::unique_ptr build_octree_for( + static std::unique_ptr build_octree( TriangleMesh & triangle_mesh, coordf_t line_spacing, const Vec3d & cube_center, From 137e7a0712923080ca93949e73ab139fd04c5b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Thu, 10 Sep 2020 22:57:58 +0200 Subject: [PATCH 3/3] Fix compiler warnings and failing compilation on macOS --- src/libslic3r/Fill/FillAdaptive.cpp | 14 +++++++------- src/libslic3r/PrintObject.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Fill/FillAdaptive.cpp b/src/libslic3r/Fill/FillAdaptive.cpp index f1fa56c5b..3b9212230 100644 --- a/src/libslic3r/Fill/FillAdaptive.cpp +++ b/src/libslic3r/Fill/FillAdaptive.cpp @@ -435,7 +435,7 @@ std::unique_ptr FillSupportCubic::build_octree( auto octree = std::make_unique(std::make_unique(cube_center), cube_center, cubes_properties); double cube_edge_length = line_spacing / 2.0; - size_t max_depth = octree->cubes_properties.size() - 1; + int max_depth = int(octree->cubes_properties.size()) - 1; BoundingBoxf3 mesh_bb = triangle_mesh.bounding_box(); Vec3f vertical(0, 0, 1); @@ -462,13 +462,13 @@ std::unique_ptr FillSupportCubic::build_octree( Vec3d triangle_end_relative = triangle_bb.max - mesh_bb.min; Vec3crd triangle_start_idx = Vec3crd( - std::floor(triangle_start_relative.x() / cube_edge_length), - std::floor(triangle_start_relative.y() / cube_edge_length), - std::floor(triangle_start_relative.z() / cube_edge_length)); + int(std::floor(triangle_start_relative.x() / cube_edge_length)), + int(std::floor(triangle_start_relative.y() / cube_edge_length)), + int(std::floor(triangle_start_relative.z() / cube_edge_length))); Vec3crd triangle_end_idx = Vec3crd( - std::floor(triangle_end_relative.x() / cube_edge_length), - std::floor(triangle_end_relative.y() / cube_edge_length), - std::floor(triangle_end_relative.z() / cube_edge_length)); + int(std::floor(triangle_end_relative.x() / cube_edge_length)), + int(std::floor(triangle_end_relative.y() / cube_edge_length)), + int(std::floor(triangle_end_relative.z() / cube_edge_length))); for (int z = triangle_start_idx.z(); z <= triangle_end_idx.z(); ++z) { diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 2df7994ee..e2dba5bb2 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -377,7 +377,7 @@ void PrintObject::infill() BOOST_LOG_TRIVIAL(debug) << "Filling layers in parallel - start"; tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), - [this, &adaptive_fill_octree, &support_fill_octree](const tbb::blocked_range& range) { + [this, &adaptive_fill_octree = adaptive_fill_octree, &support_fill_octree = support_fill_octree](const tbb::blocked_range& range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) { m_print->throw_if_canceled(); m_layers[layer_idx]->make_fills(adaptive_fill_octree.get(), support_fill_octree.get());