Seam: use scarf joint to minimize seam visiblity (#3839)

* Remember z of previous layer

* Support travel to middle of the layer z

* Support sloped extrusion

* Implement sloped seam

* Reduce extra movements

* Don't clip loop if sloped seam is enabled

* Fix wipe

* Ensure `slope_max_segment_length`

* Add options

* Limit slope length to perimeter length

* Fix slope segmentation

* Rename the option to scarf joint seam

* Don't modify the slope option when turning on spiral vase

* Add a few suggestions when turnning on scarf joint

* Add option to add scarf joint to inner walls

* Apply seam gap at the end of the slope

* Add option to explicitly use the entire loop as scarf length

* Fix layer number

* Increase default scarf length to 20mm

* Better way of storing the global scarf state

* Better vase mode layer height recognition

* Move id should exclude seams

* Fix slope height with independent support layer height

* Fix linux build

* Allow controlling the scarf with modifier

* Scarf start height default to 0

* Allow enable scarf seam on contour only

* Fix type error

* Move the creation of sloped loop into ExtrusionEntity.cpp

* Fix error "vector too long"

* Detect seams properly

* The correct way of calculating the rate limit

* The correct way of calculating the rate limit

(cherry picked from commit 05961f7c98)

* Add pressure equalizer in print by object mode

* Remove the settings recommendation as it varies a lot depends on printer & filament

* Add a beta suffix

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Noisyfox 2024-03-02 23:25:02 +08:00 committed by GitHub
parent ab1b0e0ebc
commit 924a2b4551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 533 additions and 54 deletions

View file

@ -309,6 +309,53 @@ bool Polyline::split_at_index(const size_t index, Polyline* p1, Polyline* p2) co
return true;
}
bool Polyline::split_at_length(const double length, Polyline* p1, Polyline* p2) const
{
if (this->points.empty()) return false;
if (length < 0 || length > this->length()) {
return false;
}
if (length < SCALED_EPSILON) {
p1->clear();
p1->append(this->first_point());
*p2 = *this;
} else if (is_approx(length, this->length(), SCALED_EPSILON)) {
p2->clear();
p2->append(this->last_point());
*p1 = *this;
} else {
// 1 find the line to split at
size_t line_idx = 0;
double acc_length = 0;
Point p = this->first_point();
for (const auto& l : this->lines()) {
p = l.b;
const double current_length = l.length();
if (acc_length + current_length >= length) {
p = lerp(l.a, l.b, (length - acc_length) / current_length);
break;
}
acc_length += current_length;
line_idx++;
}
//2 judge whether the cloest point is one vertex of polyline.
// and spilit the polyline at different index
int index = this->find_point(p);
if (index != -1) {
this->split_at_index(index, p1, p2);
} else {
Polyline temp;
this->split_at_index(line_idx, p1, &temp);
p1->append(p);
this->split_at_index(line_idx + 1, &temp, p2);
p2->append_before(p);
}
}
return true;
}
bool Polyline::is_straight() const
{