diff options
author | Tim Kuipers <t.kuipers@ultimaker.com> | 2021-11-02 11:39:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 11:39:47 +0300 |
commit | 0502ce40ede800efb9f25f96d8dc4d226358043a (patch) | |
tree | 15718c6c121a528584b20c751be99e0b9efa5455 /src | |
parent | 2ce9cfa7d62f0ab4ebe2977253a9b34580586f34 (diff) |
Fix fuzzy skin overshoots
The logic for dealing with the edge-case that there are no sampled points on a segment was wrong.
Diffstat (limited to 'src')
-rw-r--r-- | src/FffPolygonGenerator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/FffPolygonGenerator.cpp b/src/FffPolygonGenerator.cpp index b96e0e7da..997819b2d 100644 --- a/src/FffPolygonGenerator.cpp +++ b/src/FffPolygonGenerator.cpp @@ -1176,17 +1176,17 @@ void FffPolygonGenerator::processFuzzyWalls(SliceMeshStorage& mesh) { // 'a' is the (next) new point between p0 and p1 Point p0p1 = p1 - *p0; int64_t p0p1_size = vSize(p0p1); - int64_t dist_last_point = p0p1_size * 2 - dist_left_over; // so that p0p1_size - dist_last_point evaulates to dist_left_over - p0p1_size - for (int64_t p0pa_dist = dist_left_over; p0pa_dist < p0p1_size; p0pa_dist += min_dist_between_points + rand() % range_random_point_dist) + int64_t p0pa_dist = dist_left_over; + for (; p0pa_dist < p0p1_size; p0pa_dist += min_dist_between_points + rand() % range_random_point_dist) { int r = rand() % (fuzziness * 2) - fuzziness; Point perp_to_p0p1 = turn90CCW(p0p1); Point fuzz = normal(perp_to_p0p1, r); Point pa = *p0 + normal(p0p1, p0pa_dist) + fuzz; result.add(pa); - dist_last_point = p0pa_dist; } - dist_left_over = p0p1_size - dist_last_point; + // p0pa_dist > p0p1_size now because we broke out of the for-loop + dist_left_over = p0pa_dist - p0p1_size; p0 = &p1; } |