OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::BeltFloorContext Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Support/BeltFloorContext.hpp>

Public Member Functions

 BeltFloorContext ()=default
bool init (const SlicingParameters &sp, const PrintConfig &pcfg)
bool init_local (const SlicingParameters &sp, const PrintConfig &pcfg, double global_z_offset)
bool is_active () const
Polygons surface_polygon (coordf_t print_z) const
Polygons valid_region_polygon (coordf_t print_z) const
double floor_print_z (const Point &pos_slicing) const
coordf_t cutoff_u (coordf_t print_z) const
std::vector< Polygons > compute_per_layer_floors (size_t num_layers, const std::function< double(size_t)> &layer_print_z) const
double shear_factor () const
int from_axis () const
double z_shift () const
double floor_offset () const

Private Member Functions

Polygons half_plane (coordf_t print_z, bool belt_surface) const

Private Attributes

bool m_active = false
double m_shear_factor = 0.0
int m_from_axis = 1
double m_z_shift = 0.0
double m_floor_offset = 0.0

Detailed Description

Constructor & Destructor Documentation

◆ BeltFloorContext()

Slic3r::BeltFloorContext::BeltFloorContext ( )
default

Member Function Documentation

◆ compute_per_layer_floors()

std::vector< Polygons > Slic3r::BeltFloorContext::compute_per_layer_floors ( size_t num_layers,
const std::function< double(size_t)> & layer_print_z ) const
63{
64 std::vector<Polygons> result(num_layers);
65 if (!m_active)
66 return result;
67 for (size_t i = 0; i < num_layers; ++i)
68 result[i] = surface_polygon(layer_print_z(i));
69 return result;
70}
Polygons surface_polygon(coordf_t print_z) const
Definition BeltFloorContext.cpp:42
bool m_active
Definition BeltFloorContext.hpp:72

References m_active, and surface_polygon().

Referenced by Slic3r::TreeSupport3D::TreeModelVolumes::TreeModelVolumes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cutoff_u()

coordf_t Slic3r::BeltFloorContext::cutoff_u ( coordf_t print_z) const
inline
57 { return (print_z - m_z_shift - m_floor_offset) / m_shear_factor; }
double m_z_shift
Definition BeltFloorContext.hpp:75
double m_shear_factor
Definition BeltFloorContext.hpp:73
double m_floor_offset
Definition BeltFloorContext.hpp:76

References m_floor_offset, m_shear_factor, and m_z_shift.

Referenced by Slic3r::belt_brim_band_paths(), half_plane(), and Slic3r::make_belt_brim().

Here is the caller graph for this function:

◆ floor_offset()

double Slic3r::BeltFloorContext::floor_offset ( ) const
inline
69{ return m_floor_offset; }

References m_floor_offset.

Referenced by Slic3r::make_belt_brim().

Here is the caller graph for this function:

◆ floor_print_z()

double Slic3r::BeltFloorContext::floor_print_z ( const Point & pos_slicing) const
53{
54 if (!m_active)
55 return -std::numeric_limits<double>::infinity();
56 double pos = unscale<double>(m_from_axis == 0 ? pos_slicing.x() : pos_slicing.y());
58}
int m_from_axis
Definition BeltFloorContext.hpp:74
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
T unscale(Q v)
Definition libslic3r.h:138

References m_active, m_floor_offset, m_from_axis, m_shear_factor, m_z_shift, and Slic3r::unscale().

Referenced by Slic3r::belt_brim_band_paths(), Slic3r::TreeSupport::belt_floor_print_z(), Slic3r::TreeSupport::belt_node_landed(), and Slic3r::TreeSupport::belt_polygon_landed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ from_axis()

int Slic3r::BeltFloorContext::from_axis ( ) const
inline
67{ return m_from_axis; }

References m_from_axis.

Referenced by Slic3r::TreeSupport::detect_overhangs(), and Slic3r::make_belt_brim().

Here is the caller graph for this function:

◆ half_plane()

Polygons Slic3r::BeltFloorContext::half_plane ( coordf_t print_z,
bool belt_surface ) const
private
73{
74 if (!m_active)
75 return {};
76
77 const double cutoff = this->cutoff_u(print_z);
78 const coord_t cutoff_scaled = scale_(cutoff);
79 const coord_t large_bound = scale_(1e3);
80
81 // The belt surface is on one side of the cutoff line; the valid region
82 // is on the other side. Which side depends on shear_factor sign.
83 //
84 // belt_surface=true → the belt side (where support should NOT exist)
85 // belt_surface=false → the valid side (where support IS allowed)
86 //
87 // For shear_factor > 0: belt surface is from_axis >= cutoff
88 // For shear_factor < 0: belt surface is from_axis <= cutoff
89 bool high_side = (m_shear_factor > 0) == belt_surface;
90
92 if (m_from_axis == 0) {
93 if (high_side) {
94 // X >= cutoff
95 poly.points = {
96 Point(cutoff_scaled, -large_bound),
97 Point(large_bound, -large_bound),
98 Point(large_bound, large_bound),
99 Point(cutoff_scaled, large_bound)
100 };
101 } else {
102 // X < cutoff
103 poly.points = {
104 Point(-large_bound, -large_bound),
105 Point(cutoff_scaled, -large_bound),
106 Point(cutoff_scaled, large_bound),
107 Point(-large_bound, large_bound)
108 };
109 }
110 } else {
111 if (high_side) {
112 // Y >= cutoff
113 poly.points = {
114 Point(-large_bound, cutoff_scaled),
115 Point( large_bound, cutoff_scaled),
116 Point( large_bound, large_bound),
117 Point(-large_bound, large_bound)
118 };
119 } else {
120 // Y < cutoff
121 poly.points = {
122 Point(-large_bound, -large_bound),
123 Point( large_bound, -large_bound),
124 Point( large_bound, cutoff_scaled),
125 Point(-large_bound, cutoff_scaled)
126 };
127 }
128 }
129 return { poly };
130}
coordf_t cutoff_u(coordf_t print_z) const
Definition BeltFloorContext.hpp:56
#define scale_(val)
Definition libslic3r.h:106
int64_t coord_t
Definition libslic3r.h:48
void poly(std::vector< std::pair< Vec2d, Vec2d > > &out, std::initializer_list< Vec2d > p)
Definition DesignSketchTool.cpp:7751
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References cutoff_u(), m_active, m_from_axis, m_shear_factor, and scale_.

Referenced by surface_polygon(), and valid_region_polygon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

bool Slic3r::BeltFloorContext::init ( const SlicingParameters & sp,
const PrintConfig & pcfg )
17{
18 m_active = false;
19 m_shear_factor = sp.belt_floor_shear_factor;
20 m_from_axis = sp.belt_floor_from_axis;
21 m_z_shift = sp.belt_floor_z_shift;
22 m_floor_offset = pcfg.belt_support_floor_offset.value;
23
24 if (std::abs(m_shear_factor) < EPSILON)
25 return false;
26
27 m_active = true;
28 return true;
29}
#define EPSILON
Definition ColorUtils.cpp:64

References Slic3r::SlicingParameters::belt_floor_from_axis, Slic3r::SlicingParameters::belt_floor_shear_factor, Slic3r::SlicingParameters::belt_floor_z_shift, EPSILON, m_active, m_floor_offset, m_from_axis, m_shear_factor, and m_z_shift.

Referenced by Slic3r::TreeSupport::belt_floor_print_z(), Slic3r::belt_floor_surface_polygon(), Slic3r::belt_floor_valid_region_polygon(), Slic3r::TreeSupport::belt_node_landed(), Slic3r::TreeSupport::belt_polygon_landed(), Slic3r::TreeSupport::detect_overhangs(), Slic3r::TreeSupport::draw_circles(), Slic3r::TreeSupport::generate_toolpaths(), init_local(), Slic3r::make_belt_brim(), and Slic3r::trim_support_layers_by_belt_floor().

Here is the caller graph for this function:

◆ init_local()

bool Slic3r::BeltFloorContext::init_local ( const SlicingParameters & sp,
const PrintConfig & pcfg,
double global_z_offset )
33{
34 if (!init(sp, pcfg))
35 return false;
36 // Local Z: subtract the global Z offset so polygon computation
37 // works in the object's local coordinate space.
38 m_z_shift -= global_z_offset;
39 return true;
40}
bool init(const SlicingParameters &sp, const PrintConfig &pcfg)
Definition BeltFloorContext.cpp:16

References init(), and m_z_shift.

Referenced by Slic3r::TreeSupport3D::TreeModelVolumes::TreeModelVolumes(), and Slic3r::TreeSupport3D::generate_support_areas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_active()

bool Slic3r::BeltFloorContext::is_active ( ) const
inline
39{ return m_active; }

References m_active.

Referenced by Slic3r::TreeSupport3D::TreeModelVolumes::TreeModelVolumes(), and Slic3r::TreeSupport3D::generate_support_areas().

Here is the caller graph for this function:

◆ shear_factor()

double Slic3r::BeltFloorContext::shear_factor ( ) const
inline
66{ return m_shear_factor; }

References m_shear_factor.

Referenced by Slic3r::TreeSupport::belt_node_landed(), Slic3r::TreeSupport::detect_overhangs(), and Slic3r::make_belt_brim().

Here is the caller graph for this function:

◆ surface_polygon()

Polygons Slic3r::BeltFloorContext::surface_polygon ( coordf_t print_z) const
43{
44 return half_plane(print_z, /*belt_surface=*/true);
45}
Polygons half_plane(coordf_t print_z, bool belt_surface) const
Definition BeltFloorContext.cpp:72

References half_plane().

Referenced by Slic3r::belt_floor_surface_polygon(), and compute_per_layer_floors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_region_polygon()

Polygons Slic3r::BeltFloorContext::valid_region_polygon ( coordf_t print_z) const
48{
49 return half_plane(print_z, /*belt_surface=*/false);
50}

References half_plane().

Referenced by Slic3r::belt_floor_valid_region_polygon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ z_shift()

double Slic3r::BeltFloorContext::z_shift ( ) const
inline
68{ return m_z_shift; }

References m_z_shift.

Referenced by Slic3r::make_belt_brim().

Here is the caller graph for this function:

Member Data Documentation

◆ m_active

bool Slic3r::BeltFloorContext::m_active = false
private

◆ m_floor_offset

double Slic3r::BeltFloorContext::m_floor_offset = 0.0
private

◆ m_from_axis

int Slic3r::BeltFloorContext::m_from_axis = 1
private

◆ m_shear_factor

double Slic3r::BeltFloorContext::m_shear_factor = 0.0
private

◆ m_z_shift

double Slic3r::BeltFloorContext::m_z_shift = 0.0
private

The documentation for this class was generated from the following files: