diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp index 950b3d064..8b48d181c 100644 --- a/src/libslic3r/GCode/SeamPlacer.cpp +++ b/src/libslic3r/GCode/SeamPlacer.cpp @@ -839,7 +839,7 @@ struct SeamComparator { float weight(const SeamCandidate &a) const { if (setup == SeamPosition::spAligned && a.central_enforcer) { - return 3.0f; + return 2.0f; } return a.visibility + angle_importance * compute_angle_penalty(a.local_ccw_angle) / (1.0f + angle_importance); } @@ -1206,7 +1206,6 @@ std::vector> SeamPlacer::find_seam_string(const PrintO string_weight = 0.0f; const std::vector &layers = m_seam_per_object.find(po)->second.layers; int layer_idx = start_seam.first; - int seam_index = start_seam.second; //initialize searching for seam string - cluster of nearby seams on previous and next layers int next_layer = layer_idx + 1; @@ -1223,7 +1222,7 @@ std::vector> SeamPlacer::find_seam_string(const PrintO }; while (next_layer >= 0) { - if (next_layer >= layers.size()) { + if (next_layer >= int(layers.size())) { reverse_lookup_direction(); if (next_layer < 0) { break; @@ -1249,7 +1248,7 @@ std::vector> SeamPlacer::find_seam_string(const PrintO prev_point_index = seam_string.back(); //String added, prev_point_index updated Vec3f dir = (next_seam.position - prev_position); - straightening_dir = Vec3f(-dir.x()*0.7, -dir.y()*0.7, dir.z()); + straightening_dir = Vec3f(-dir.x()*0.0, -dir.y()*0.0, dir.z()); } else { if (step == 1) { reverse_lookup_direction(); @@ -1387,16 +1386,12 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl:: // Do alignment - compute fitted point for each point in the string from its Z coord, and store the position into // Perimeter structure of the point; also set flag aligned to true - auto sigmoid_angle_snapping_func = [](float angle){ - float steepness = 10.0f; - float exp_val = steepness * (abs(angle) - SeamPlacer::sharp_angle_snapping_threshold); - float sig_term = exp(exp_val); - return sig_term / (sig_term + 1.0f); - }; - for (size_t index = 0; index < seam_string.size(); ++index) { const auto &pair = seam_string[index]; - float t = sigmoid_angle_snapping_func(layers[pair.first].points[pair.second].local_ccw_angle); + const float t = + abs(layers[pair.first].points[pair.second].local_ccw_angle) + > SeamPlacer::sharp_angle_snapping_threshold + ? 1.0 : 0.0f; Vec3f current_pos = layers[pair.first].points[pair.second].position; Vec2f fitted_pos = curve.get_fitted_value(current_pos.z()); diff --git a/src/libslic3r/GCode/SeamPlacer.hpp b/src/libslic3r/GCode/SeamPlacer.hpp index 1a8be9bc2..3e2f348e0 100644 --- a/src/libslic3r/GCode/SeamPlacer.hpp +++ b/src/libslic3r/GCode/SeamPlacer.hpp @@ -127,8 +127,8 @@ public: static constexpr size_t sqr_rays_per_sample_point = 5; // arm length used during angles computation - static constexpr float polygon_local_angles_arm_distance = 0.3f; - static constexpr float sharp_angle_snapping_threshold = 0.3f * float(PI); + static constexpr float polygon_local_angles_arm_distance = 1.5f; + static constexpr float sharp_angle_snapping_threshold = 0.4f * float(PI); // max tolerable distance from the previous layer is overhang_distance_tolerance_factor * flow_width static constexpr float overhang_distance_tolerance_factor = 0.5f; @@ -150,7 +150,7 @@ public: // minimum number of seams needed in cluster to make alignment happen static constexpr size_t seam_align_minimum_string_seams = 6; // millimeters covered by spline; determines number of splines for the given string - static constexpr size_t seam_align_mm_per_segment = 8.0f; + static constexpr size_t seam_align_mm_per_segment = 4.0f; //The following data structures hold all perimeter points for all PrintObject. std::unordered_map m_seam_per_object;