OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::DilationKernel Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Feature/Interlocking/VoxelUtils.hpp>

Collaboration diagram for Slic3r::DilationKernel:

Public Types

enum class  Type { CUBE , DIAMOND , PRISM }

Public Member Functions

 DilationKernel (GridPoint3 kernel_size, Type type)

Public Attributes

GridPoint3 kernel_size_
 Size of the kernel in number of voxel cells.
Type type_
std::vector< GridPoint3 > relative_cells_
 All offset positions relative to some reference cell which is to be dilated.

Detailed Description

Class for holding the relative positiongs wrt a reference cell on which to perform a dilation.

Member Enumeration Documentation

◆ Type

enum class Slic3r::DilationKernel::Type
strong

A cubic kernel checks all voxels in a cube around a reference voxel.


|\ ___\ | | | |____|

A diamond kernel uses a manhattan distance to create a diamond shape around a reference voxel. /|\ /_|_\ \ | / |/

A prism kernel is diamond in XY, but extrudes straight in Z around a reference voxel. / \ / \ |\ /| | \ / | | | | \ | / |/

Enumerator
CUBE 
DIAMOND 
PRISM 
50 {
51 CUBE,
52 DIAMOND,
53 PRISM
54 };

Constructor & Destructor Documentation

◆ DilationKernel()

Slic3r::DilationKernel::DilationKernel ( GridPoint3 kernel_size,
DilationKernel::Type type )
25 : kernel_size_(kernel_size)
26 , type_(type)
27{
28 coord_t mult = kernel_size.x() * kernel_size.y() * kernel_size.z(); // multiplier for division to avoid rounding and to avoid use of floating point numbers
29 relative_cells_.reserve(mult);
30 GridPoint3 half_kernel = kernel_size / 2;
31
32 GridPoint3 start = -half_kernel;
33 GridPoint3 end = kernel_size - half_kernel;
34 for (coord_t x = start.x(); x < end.x(); x++)
35 {
36 for (coord_t y = start.y(); y < end.y(); y++)
37 {
38 for (coord_t z = start.z(); z < end.z(); z++)
39 {
40 GridPoint3 current(x, y, z);
41 if (type != Type::CUBE)
42 {
43 GridPoint3 limit((x < 0) ? start.x() : end.x() - 1, (y < 0) ? start.y() : end.y() - 1, (z < 0) ? start.z() : end.z() - 1);
44 if (limit.x() == 0)
45 limit.x() = 1;
46 if (limit.y() == 0)
47 limit.y() = 1;
48 if (limit.z() == 0)
49 limit.z() = 1;
50 const GridPoint3 rel_dists = (mult * current).array() / limit.array();
51 if ((type == Type::DIAMOND && rel_dists.x() + rel_dists.y() + rel_dists.z() > mult) || (type == Type::PRISM && rel_dists.x() + rel_dists.y() > mult))
52 {
53 continue; // don't consider this cell
54 }
55 }
56 relative_cells_.emplace_back(x, y, z);
57 }
58 }
59 }
60}
int64_t coord_t
Definition libslic3r.h:48
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:841
Vec3crd GridPoint3
Definition VoxelUtils.hpp:20
GridPoint3 kernel_size_
Size of the kernel in number of voxel cells.
Definition VoxelUtils.hpp:55
Type type_
Definition VoxelUtils.hpp:56
@ PRISM
Definition VoxelUtils.hpp:53
@ DIAMOND
Definition VoxelUtils.hpp:52
@ CUBE
Definition VoxelUtils.hpp:51
std::vector< GridPoint3 > relative_cells_
All offset positions relative to some reference cell which is to be dilated.
Definition VoxelUtils.hpp:57

References kernel_size_, relative_cells_, and type_.

Member Data Documentation

◆ kernel_size_

GridPoint3 Slic3r::DilationKernel::kernel_size_

Size of the kernel in number of voxel cells.

Referenced by DilationKernel(), Slic3r::VoxelUtils::walkDilatedAreas(), and Slic3r::VoxelUtils::walkDilatedPolygons().

◆ relative_cells_

std::vector<GridPoint3> Slic3r::DilationKernel::relative_cells_

All offset positions relative to some reference cell which is to be dilated.

Referenced by DilationKernel(), and Slic3r::VoxelUtils::dilate().

◆ type_

Type Slic3r::DilationKernel::type_

Referenced by DilationKernel().


The documentation for this struct was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Feature/Interlocking/VoxelUtils.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Feature/Interlocking/VoxelUtils.cpp