ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE -> Small refactoring
This commit is contained in:
parent
67b8506800
commit
643b26a0f3
3 changed files with 10 additions and 10 deletions
|
@ -267,7 +267,7 @@ std::vector<coordf_t> layer_height_profile_adaptive(
|
||||||
int current_facet = 0;
|
int current_facet = 0;
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
||||||
while (slice_z <= slicing_params.object_print_z_height()) {
|
while (slice_z <= slicing_params.object_print_z_height()) {
|
||||||
double height = 999.0;
|
double height = slicing_params.max_layer_height;
|
||||||
#else
|
#else
|
||||||
double height = slicing_params.first_object_layer_height;
|
double height = slicing_params.first_object_layer_height;
|
||||||
while ((slice_z - height) <= slicing_params.object_print_z_height()) {
|
while ((slice_z - height) <= slicing_params.object_print_z_height()) {
|
||||||
|
|
|
@ -94,8 +94,8 @@ float SlicingAdaptive::cusp_height(float z, float cusp_value, int ¤t_facet
|
||||||
continue;
|
continue;
|
||||||
// compute cusp-height for this facet and store minimum of all heights
|
// compute cusp-height for this facet and store minimum of all heights
|
||||||
float normal_z = m_face_normal_z[ordered_id];
|
float normal_z = m_face_normal_z[ordered_id];
|
||||||
height = std::min(height, (normal_z == 0.f) ? 9999.f : std::abs(cusp_value / normal_z));
|
height = std::min(height, (normal_z == 0.0f) ? (float)m_slicing_params.max_layer_height : std::abs(cusp_value / normal_z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lower height limit due to printer capabilities
|
// lower height limit due to printer capabilities
|
||||||
|
@ -115,13 +115,13 @@ float SlicingAdaptive::cusp_height(float z, float cusp_value, int ¤t_facet
|
||||||
|
|
||||||
// Compute cusp-height for this facet and check against height.
|
// Compute cusp-height for this facet and check against height.
|
||||||
float normal_z = m_face_normal_z[ordered_id];
|
float normal_z = m_face_normal_z[ordered_id];
|
||||||
float cusp = (normal_z == 0) ? 9999 : abs(cusp_value / normal_z);
|
float cusp = (normal_z == 0.0f) ? (float)m_slicing_params.max_layer_height : abs(cusp_value / normal_z);
|
||||||
|
|
||||||
float z_diff = zspan.first - z;
|
float z_diff = zspan.first - z;
|
||||||
|
|
||||||
// handle horizontal facets
|
// handle horizontal facets
|
||||||
if (m_face_normal_z[ordered_id] > 0.999) {
|
if (normal_z > 0.999f) {
|
||||||
// Slic3r::debugf "cusp computation, height is reduced from %f", $height;
|
// Slic3r::debugf "cusp computation, height is reduced from %f", $height;
|
||||||
height = z_diff;
|
height = z_diff;
|
||||||
// Slic3r::debugf "to %f due to near horizontal facet\n", $height;
|
// Slic3r::debugf "to %f due to near horizontal facet\n", $height;
|
||||||
} else if (cusp > z_diff) {
|
} else if (cusp > z_diff) {
|
||||||
|
@ -139,7 +139,7 @@ float SlicingAdaptive::cusp_height(float z, float cusp_value, int ¤t_facet
|
||||||
// lower height limit due to printer capabilities again
|
// lower height limit due to printer capabilities again
|
||||||
height = std::max(height, float(m_slicing_params.min_layer_height));
|
height = std::max(height, float(m_slicing_params.min_layer_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slic3r::debugf "cusp computation, layer-bottom at z:%f, cusp_value:%f, resulting layer height:%f\n", unscale $z, $cusp_value, $height;
|
// Slic3r::debugf "cusp computation, layer-bottom at z:%f, cusp_value:%f, resulting layer height:%f\n", unscale $z, $cusp_value, $height;
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,8 +278,8 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
float widget_align = ImGui::GetCursorPosX();
|
float widget_align = ImGui::GetCursorPosX();
|
||||||
ImGui::PushItemWidth(120.0f);
|
ImGui::PushItemWidth(120.0f);
|
||||||
m_adaptive_cusp = std::min(m_adaptive_cusp, (float)m_slicing_parameters->max_layer_height);
|
m_adaptive_cusp = clamp((float)m_slicing_parameters->min_layer_height, (float)m_slicing_parameters->max_layer_height, m_adaptive_cusp);
|
||||||
ImGui::SliderFloat("", &m_adaptive_cusp, 0.0f, (float)m_slicing_parameters->max_layer_height, "%.2f");
|
ImGui::SliderFloat("", &m_adaptive_cusp, (float)m_slicing_parameters->min_layer_height, (float)m_slicing_parameters->max_layer_height, "%.2f");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (imgui.button(_(L("Smooth"))))
|
if (imgui.button(_(L("Smooth"))))
|
||||||
|
|
Loading…
Reference in a new issue