#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Feature/Interlocking/InterlockingGenerator.hpp>
Static Public Member Functions | |
| static void | generate_interlocking_structure (PrintObject *print_object, const std::function< void()> &throw_on_cancel) |
Private Member Functions | |
| void | generateInterlockingStructure () const |
| InterlockingGenerator (PrintObject &print_object, const size_t region_a_index, const size_t region_b_index, const coord_t beam_width, const coord_t boundary_avoidance, const float rotation, const Vec3crd &cell_size, const coord_t beam_layer_count, const DilationKernel &interface_dilation, const DilationKernel &air_dilation, const bool air_filtering, const std::function< void()> &throw_on_cancel) | |
| std::pair< ExPolygons, ExPolygons > | growBorderAreasPerpendicular (const ExPolygons &a, const ExPolygons &b, const coord_t &detect) const |
| void | handleThinAreas (const std::unordered_set< GridPoint3 > &has_all_meshes) const |
| std::vector< std::unordered_set< GridPoint3 > > | getShellVoxels (const DilationKernel &kernel) const |
| void | addBoundaryCells (const std::vector< ExPolygons > &layers, const DilationKernel &kernel, std::unordered_set< GridPoint3 > &cells) const |
| std::vector< ExPolygons > | computeUnionedVolumeRegions () const |
| std::vector< std::vector< ExPolygons > > | generateMicrostructure () const |
| void | applyMicrostructureToOutlines (const std::unordered_set< GridPoint3 > &cells, const std::vector< ExPolygons > &layer_regions) const |
Private Attributes | |
| PrintObject & | print_object |
| const size_t | region_a_index |
| const size_t | region_b_index |
| const coord_t | beam_width |
| const coord_t | boundary_avoidance |
| const VoxelUtils | vu |
| const float | rotation |
| const Vec3crd | cell_size |
| const coord_t | beam_layer_count |
| const DilationKernel | interface_dilation |
| const DilationKernel | air_dilation |
| const bool | air_filtering |
| const std::function< void()> & | throw_on_cancel |
Static Private Attributes | |
| static const coord_t | ignored_gap_ = 100u |
| Distance between models to be considered next to each other so that an interlocking structure will be generated there. | |
Class for generating an interlocking structure between two adjacent models of a different extruder.
The structure consists of horizontal beams of the two materials interlaced. In the z direction the direction of these beams is alternated with 90*.
Example with two materials # and O Even beams: Odd beams:
OOOOOO ##OO##OO
OOOOOO ##OO##OO
One material of a single cell of the structure looks like this: .-*-. .-* -. |-. -. | *-. *-. .- -. *-. *-. .- -. *-. .-| .-* .-* -. *-.- | |*-. .-* .-* -. | .- | -.- .-* -|- -. | .- -|-
We set up a voxel grid of (2*beam_w,2*beam_w,2*beam_h) and mark all the voxels which contain both meshes. We then remove all voxels which also contain air, so that the interlocking pattern will not be visible from the outside. We then generate and combine the polygons for each voxel and apply those areas to the outlines ofthe meshes.
|
inlineprivate |
Private class for storing some variables used in the computation of the interlocking structure between two meshes.
| region_a_index | The first region |
| region_b_index | The second region |
| rotation | The angle by which to rotate the interlocking pattern |
| cell_size | The size of a voxel cell in (coord_t, coord_t, layer_count) |
| beam_layer_count | The number of layers for the height of the beams |
| interface_dilation | The thicknening kernel for the interface |
| air_dilation | The thickening kernel applied to air so that cells near the outside of the model won't be generated |
| air_filtering | Whether to fully remove all of the interlocking cells which would be visible on the outside (i.e. touching air). If no air filtering then those cells will be cut off in the middle of a beam. |
References air_dilation, air_filtering, beam_layer_count, beam_width, boundary_avoidance, cell_size, interface_dilation, print_object, region_a_index, region_b_index, rotation, throw_on_cancel, and vu.
Referenced by generate_interlocking_structure().
|
private |
Compute the voxels overlapping with the shell of some layers. This includes the walls, but also top/bottom skin.
| layers | The layer outlines for which to compute the shell voxels | |
| kernel | The dilation kernel to give the returned voxel shell more thickness | |
| [out] | cells | The output cells which elong to the shell |
References cell_size, Slic3r::opening_ex(), throw_on_cancel, vu, and Slic3r::xor_ex().
Referenced by generateInterlockingStructure(), and getShellVoxels().
|
private |
Change the outlines of the meshes with the computed interlocking structure.
| cells | The cells where we want to apply the interlocking structure. |
| layer_regions | The total volume of the two meshes combined (and small gaps closed) |
References beam_layer_count, cell_size, Slic3r::diff_ex(), Slic3r::expolygons_append(), Slic3r::expolygons_rotate(), generateMicrostructure(), Slic3r::intersection_ex(), print_object, region_a_index, region_b_index, rotation, Slic3r::stInternal, throw_on_cancel, Slic3r::to_expolygons(), Slic3r::union_ex(), and vu.
Referenced by generateInterlockingStructure().
|
private |
Compute the regions occupied by both models.
A morphological close is performed so that we don't register small gaps between the two models as being separate.
References Slic3r::closing_ex(), Slic3r::expolygons_append(), Slic3r::expolygons_rotate(), ignored_gap_, print_object, region_a_index, region_b_index, rotation, and Slic3r::to_expolygons().
Referenced by generateInterlockingStructure().
|
static |
Generate an interlocking structure between each two adjacent meshes.
References InterlockingGenerator(), air_dilation, air_filtering, beam_layer_count, beam_width, boundary_avoidance, cell_size, Slic3r::Geometry::deg2rad(), EPSILON, Slic3r::PrintRegion::extruder(), Slic3r::frExternalPerimeter, generateInterlockingStructure(), interface_dilation, print_object, Slic3r::DilationKernel::PRISM, region_a_index, region_b_index, rotation, Slic3r::scaled(), and throw_on_cancel.
Referenced by Slic3r::PrintObject::slice_volumes().
|
private |
Generate an interlocking structure between two meshes
References addBoundaryCells(), air_dilation, air_filtering, applyMicrostructureToOutlines(), computeUnionedVolumeRegions(), getShellVoxels(), handleThinAreas(), and interface_dilation.
Referenced by generate_interlocking_structure().
|
private |
Generate the polygons for the beams of a single cell
References beam_width, cell_size, and Slic3r::offset().
Referenced by applyMicrostructureToOutlines().
|
private |
Compute the voxels overlapping with the shell of both models. This includes the walls, but also top/bottom skin.
| kernel | The dilation kernel to give the returned voxel shell more thickness |
References addBoundaryCells(), Slic3r::expolygons_rotate(), print_object, region_a_index, region_b_index, rotation, and Slic3r::to_expolygons().
Referenced by generateInterlockingStructure().
|
private |
Given two polygons, return the parts that border on air, and grow 'perpendicular' up to 'detect' distance.
| a | The first polygon. |
| b | The second polygon. |
| detec | The expand distance. (Not equal to offset, but a series of small offsets and differences). |
References Slic3r::diff_ex(), Slic3r::frExternalPerimeter, Slic3r::offset_ex(), print_object, region_a_index, region_b_index, and Slic3r::union_ex().
Referenced by handleThinAreas().
|
private |
Special handling for thin strips of material.
Expand the meshes into each other where they need it, namely when a thin strip of material needs to be attached.
| has_all_meshes | Only do this special handling if there's actually microstructure nearby that needs to be adhered to. |
References beam_width, boundary_avoidance, cell_size, Slic3r::closing(), Slic3r::closing_ex(), Slic3r::diff_ex(), Slic3r::expand(), Slic3r::frExternalPerimeter, growBorderAreasPerpendicular(), Slic3r::intersection_ex(), Slic3r::offset(), Slic3r::offset_ex(), Slic3r::opening_ex(), Slic3r::polygons_rotate(), print_object, region_a_index, region_b_index, rotation, Slic3r::stInternal, throw_on_cancel, Slic3r::to_expolygons(), Slic3r::union_(), Slic3r::union_ex(), and vu.
Referenced by generateInterlockingStructure().
|
private |
Referenced by InterlockingGenerator(), generate_interlocking_structure(), and generateInterlockingStructure().
|
private |
Referenced by InterlockingGenerator(), generate_interlocking_structure(), and generateInterlockingStructure().
|
private |
Referenced by InterlockingGenerator(), applyMicrostructureToOutlines(), and generate_interlocking_structure().
|
private |
Referenced by InterlockingGenerator(), generate_interlocking_structure(), generateMicrostructure(), and handleThinAreas().
|
private |
Referenced by InterlockingGenerator(), generate_interlocking_structure(), and handleThinAreas().
|
private |
|
staticprivate |
Distance between models to be considered next to each other so that an interlocking structure will be generated there.
Referenced by computeUnionedVolumeRegions().
|
private |
Referenced by InterlockingGenerator(), generate_interlocking_structure(), and generateInterlockingStructure().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by InterlockingGenerator(), addBoundaryCells(), applyMicrostructureToOutlines(), and handleThinAreas().