@@ -95,17 +95,18 @@ coord_t SlicingAdaptive::next_layer_height(const double print_z, double quality_
9595 // Calculate max surface deviation based on quality factor
9696 double max_surface_deviation;
9797 {
98- // Convert layer heights from microns to mm for calculation
99- double delta_min = m_slicing_params. min_layer_height / 1000.0 ;
100- double delta_mid = m_slicing_params. layer_height / 1000.0 ;
101- double delta_max = m_slicing_params. max_layer_height / 1000.0 ;
102-
103- max_surface_deviation = (quality_factor < 0.5 ) ? lerp (delta_min, delta_mid, 2.0 * quality_factor) : lerp (delta_max, delta_mid, 2.0 * (1.0 - quality_factor) );
98+ // Quality factor 0.0 = best quality (smallest surface deviation, thinner layers)
99+ // Quality factor 1.0 = fastest speed (larger surface deviation, thicker layers)
100+ const double min_surface_deviation = 0.01 ; // 0.01mm for highest quality
101+ const double max_surface_deviation_val = 0.2 ; // 0.2mm for fastest speed
102+
103+ max_surface_deviation = min_surface_deviation + quality_factor * (max_surface_deviation_val - min_surface_deviation );
104104 }
105105
106106 // Find all facets intersecting the slice layer
107107 size_t ordered_id = current_facet;
108108 bool first_hit = false ;
109+ bool found_influencing_geometry = false ;
109110
110111 for (; ordered_id < m_faces.size (); ++ordered_id)
111112 {
@@ -132,11 +133,22 @@ coord_t SlicingAdaptive::next_layer_height(const double print_z, double quality_
132133 // Compute cusp height for this facet and store minimum
133134 coord_t facet_height = layer_height_from_slope (m_faces[ordered_id], max_surface_deviation);
134135 height = std::min (height, facet_height);
136+ found_influencing_geometry = true ;
135137 }
136138 }
137139
138140 // Apply printer capability limits
139141 height = std::max (height, m_slicing_params.min_layer_height );
142+
143+ // If no geometry influenced the layer height, use quality-based default
144+ if (!found_influencing_geometry)
145+ {
146+ // Create a quality-based layer height when no geometry constraints exist
147+ // Quality 0.0 -> use minimum layer height, Quality 1.0 -> use maximum layer height
148+ coord_t quality_based_height = coord_t (m_slicing_params.min_layer_height +
149+ quality_factor * (m_slicing_params.max_layer_height - m_slicing_params.min_layer_height ));
150+ height = std::min (height, quality_based_height);
151+ }
140152
141153 // Check for sloped facets inside the determined layer and correct height if necessary
142154 if (height > m_slicing_params.min_layer_height )
0 commit comments