forked from 1b-agent/opencadstudio-upstream
fix(render): miter the joints of wide polyline bands
Each band segment was a rectangle ending square at its vertex, so the outer corner of every joint showed a notch. Every segment end now carries the tangent of half its turn, and the shader slides that end's corners onto the joint's bisector so neighbours meet in a miter. Turns sharper than the limit keep butt ends. Constant-width runs inside a polyline split around its arcs no longer count as tapered, which had kept them unmitred. Fixes #1565 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4cfcc9dc38
commit
d6dfd0d46d
6 files changed
+161
-23
No files matched your search
@@ -495,10 +495,17 @@ fn split_mixed_polyline(
|
||||
.iter()
|
||||
.copied()
|
||||
.fold(0.0f32, f32::max);
|
||||
let has_line_taper = straight_widths
|
||||
.first()
|
||||
.map_or(false, |&w0| straight_widths.iter().any(|&w| (w - w0).abs() > 1e-6));
|
||||
let taper_widths = if has_line_taper || straight_widths.iter().any(|&w| w > 1e-6) {
|
||||
// NaN breaks carry a 0 width; only real points decide whether the
|
||||
// band tapers, so a constant-width run keeps its mitered joints.
|
||||
let mut real_widths = line_pts
|
||||
.iter()
|
||||
.zip(&straight_widths)
|
||||
.filter(|(p, _)| p[0].is_finite())
|
||||
.map(|(_, &w)| w);
|
||||
let has_line_taper = real_widths
|
||||
.next()
|
||||
.map_or(false, |w0| real_widths.any(|w| (w - w0).abs() > 1e-6));
|
||||
let taper_widths = if has_line_taper {
|
||||
straight_widths
|
||||
} else {
|
||||
Vec::new()
|
||||
|
||||
Reference in new issue
Block a user