Merge branch 'lh_adaptive_support_infill_fix'
This commit is contained in:
commit
50a6680dcd
@ -392,7 +392,7 @@ void FillAdaptive_Internal::Octree::propagate_point(
|
||||
Octree::propagate_point(point, child, (depth - 1), cubes_properties);
|
||||
}
|
||||
|
||||
std::unique_ptr<FillAdaptive_Internal::Octree> FillSupportCubic::build_octree_for_adaptive_support(
|
||||
std::unique_ptr<FillAdaptive_Internal::Octree> FillSupportCubic::build_octree(
|
||||
TriangleMesh & triangle_mesh,
|
||||
coordf_t line_spacing,
|
||||
const Vec3d & cube_center,
|
||||
@ -434,8 +434,8 @@ std::unique_ptr<FillAdaptive_Internal::Octree> FillSupportCubic::build_octree_fo
|
||||
|
||||
auto octree = std::make_unique<Octree>(std::make_unique<Cube>(cube_center), cube_center, cubes_properties);
|
||||
|
||||
double cube_edge_length = line_spacing;
|
||||
size_t max_depth = octree->cubes_properties.size() - 1;
|
||||
double cube_edge_length = line_spacing / 2.0;
|
||||
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<FillAdaptive_Internal::Octree> FillSupportCubic::build_octree_fo
|
||||
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)
|
||||
{
|
||||
@ -497,7 +497,7 @@ std::unique_ptr<FillAdaptive_Internal::Octree> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ protected:
|
||||
Polylines &polylines_out);
|
||||
|
||||
public:
|
||||
static std::unique_ptr<FillAdaptive_Internal::Octree> build_octree_for_adaptive_support(
|
||||
static std::unique_ptr<FillAdaptive_Internal::Octree> build_octree(
|
||||
TriangleMesh & triangle_mesh,
|
||||
coordf_t line_spacing,
|
||||
const Vec3d & cube_center,
|
||||
|
@ -377,7 +377,7 @@ void PrintObject::infill()
|
||||
BOOST_LOG_TRIVIAL(debug) << "Filling layers in parallel - start";
|
||||
tbb::parallel_for(
|
||||
tbb::blocked_range<size_t>(0, m_layers.size()),
|
||||
[this, &adaptive_fill_octree, &support_fill_octree](const tbb::blocked_range<size_t>& range) {
|
||||
[this, &adaptive_fill_octree = adaptive_fill_octree, &support_fill_octree = support_fill_octree](const tbb::blocked_range<size_t>& 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());
|
||||
@ -491,14 +491,14 @@ std::pair<std::unique_ptr<FillAdaptive_Internal::Octree>, std::unique_ptr<FillAd
|
||||
Vec3d rotation = Vec3d((5.0 * M_PI) / 4.0, Geometry::deg2rad(215.264), M_PI / 6.0);
|
||||
Transform3d rotation_matrix = Geometry::assemble_transform(Vec3d::Zero(), rotation, Vec3d::Ones(), Vec3d::Ones()).inverse();
|
||||
|
||||
// Rotate mesh and build octree on it with axis-aligned (standart base) cubes
|
||||
mesh.transform(rotation_matrix);
|
||||
|
||||
if (adaptive_line_spacing != 0.)
|
||||
if (adaptive_line_spacing != 0.) {
|
||||
// Rotate mesh and build octree on it with axis-aligned (standart base) cubes
|
||||
mesh.transform(rotation_matrix);
|
||||
adaptive_fill_octree = FillAdaptive::build_octree(mesh, adaptive_line_spacing, rotation_matrix * mesh_origin);
|
||||
}
|
||||
|
||||
if (support_line_spacing != 0.)
|
||||
support_fill_octree = FillSupportCubic::build_octree_for_adaptive_support(mesh, support_line_spacing, rotation_matrix * mesh_origin, rotation_matrix);
|
||||
support_fill_octree = FillSupportCubic::build_octree(mesh, support_line_spacing, rotation_matrix * mesh_origin, rotation_matrix);
|
||||
|
||||
return std::make_pair(std::move(adaptive_fill_octree), std::move(support_fill_octree));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user