simplifed choice of seam spot in the next layer removed checks for similarity.

increased raycasting precision a little
smoothen the B-splines increasing the number of points per segment (from 8 to 14)
This commit is contained in:
PavelMikus 2022-05-10 16:54:06 +02:00
parent e42448d31b
commit faaaf4148e
2 changed files with 6 additions and 8 deletions

View File

@ -1112,9 +1112,8 @@ std::optional<std::pair<size_t, size_t>> SeamPlacer::find_next_seam_in_layer(
return {std::pair<size_t, size_t> {layer_idx, nearest_point.perimeter.seam_index}}; return {std::pair<size_t, size_t> {layer_idx, nearest_point.perimeter.seam_index}};
} }
// Next compare nearest and nearby point. If they are similar pick nearest, Otherwise expect curvy lines on smooth surfaces like chimney of benchy model // First try to align the nearest, then try the best nearby
if (comparator.are_similar(nearest_point, best_nearby_point) if (comparator.is_first_not_much_worse(nearest_point, next_layer_seam)) {
&& comparator.is_first_not_much_worse(nearest_point, next_layer_seam)) {
return {std::pair<size_t, size_t> {layer_idx, nearest_point_index}}; return {std::pair<size_t, size_t> {layer_idx, nearest_point_index}};
} }
// If nearest point is not good enough, try it with the best nearby point. // If nearest point is not good enough, try it with the best nearby point.
@ -1237,13 +1236,12 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl::
} }
} }
Vec2f back_attractor = 2.0f * unscaled(po->bounding_box().max).cast<float>();
//sort them before alignment. Alignment is sensitive to initializaion, this gives it better chance to choose something nice //sort them before alignment. Alignment is sensitive to initializaion, this gives it better chance to choose something nice
std::sort(seams.begin(), seams.end(), std::sort(seams.begin(), seams.end(),
[&comparator, &layers, &back_attractor](const std::pair<size_t, size_t> &left, [&comparator, &layers](const std::pair<size_t, size_t> &left,
const std::pair<size_t, size_t> &right) { const std::pair<size_t, size_t> &right) {
return comparator.is_first_better(layers[left.first].points[left.second], return comparator.is_first_better(layers[left.first].points[left.second],
layers[right.first].points[right.second], back_attractor); layers[right.first].points[right.second]);
} }
); );

View File

@ -113,7 +113,7 @@ class SeamPlacer {
public: public:
static constexpr size_t raycasting_decimation_target_triangle_count = 10000; static constexpr size_t raycasting_decimation_target_triangle_count = 10000;
// for subdivision, both following criteria are considered, and the one with less resulting triangles is used // for subdivision, both following criteria are considered, and the one with less resulting triangles is used
static constexpr size_t raycasting_subdivision_target_triangle_count = 15000; static constexpr size_t raycasting_subdivision_target_triangle_count = 20000;
static constexpr float raycasting_subdivision_target_length = 2.0f; static constexpr float raycasting_subdivision_target_length = 2.0f;
//square of number of rays per triangle //square of number of rays per triangle
static constexpr size_t sqr_rays_per_triangle = 7; static constexpr size_t sqr_rays_per_triangle = 7;
@ -140,7 +140,7 @@ public:
// minimum number of seams needed in cluster to make alignment happen // minimum number of seams needed in cluster to make alignment happen
static constexpr size_t seam_align_minimum_string_seams = 6; static constexpr size_t seam_align_minimum_string_seams = 6;
// points covered by spline; determines number of splines for the given string // points covered by spline; determines number of splines for the given string
static constexpr size_t seam_align_seams_per_segment = 8; static constexpr size_t seam_align_seams_per_segment = 14;
//The following data structures hold all perimeter points for all PrintObject. //The following data structures hold all perimeter points for all PrintObject.
std::unordered_map<const PrintObject*, PrintObjectSeamData> m_seam_per_object; std::unordered_map<const PrintObject*, PrintObjectSeamData> m_seam_per_object;