forked from 1b-agent/opencadstudio-upstream
fix: open-issue sweep — drawing, plot, snap, layout and UI fixes
Fixes: - Font prompt no longer lists bundled ltypeshp/qcadshp shape files (#1626) - Wide polylines step at a discontinuous segment width; PEDIT marks the current vertex; keyword steps refresh the command preview (#1628) - Radius-0 fillet drops the zero-length segment it left, so the corner fillets again (#1422) - FILLET Trim / No trim option (#1558) - True-colour wires plot in their own colour; colour picker stores the value it shows (#1621) - Model tab keeps its page setup; "Save changes to layout" in Model (#1620) - QNEW default template in Options > Files; .dwt in the open dialog (#1134, #1113) - GRIDUNIT / GRIDMODE / PERSPECTIVE variables (#1618, #1524) - PTYPE (#1433) - ZOOM nX / nXP (#1465) - CHSPACE between model and paper space through a viewport (#1428) - Moving a dimension keeps its automatic text placement - Shell icon; "&&" button labels (#1554) - LINETYPE Load from a .lin file (#1588) - XLINE / RAY hide the crosshair arms (#1437) - Dynamic-input boxes keep clear of the crosshair and each other (#1546) - Snap marker colour setting, dark default on light canvases (#1497, #1229, #1128) - Dimension style precision as a 0.00 pattern dropdown (#1426) - Node graph nodes left of the origin no longer clip away (#1592) - Collapse button in the command history header (#1094) - Freeze-in-current-viewport toggle in the ribbon layer list (#1466) - Geometric Center object snap for closed polylines (#1369) New strings translated in all 21 locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abf302eba5
commit
178c7dff41
70 files changed
+1227
-145
No files matched your search
+16
-7
@@ -951,25 +951,34 @@ pub(crate) fn tapered_band_points(
|
||||
let seg_count = if is_closed { n } else { n.saturating_sub(1) };
|
||||
let mut pts: Vec<[f64; 3]> = Vec::with_capacity(seg_count + 1);
|
||||
let mut widths: Vec<f32> = Vec::with_capacity(seg_count + 1);
|
||||
let mut push = |x: f64, y: f64, w: f32| {
|
||||
let (wx, wy, wz) = to_wcs(x, y);
|
||||
pts.push([wx, wy, wz]);
|
||||
let mut push = |xy: Option<(f64, f64)>, w: f32| {
|
||||
// `None` is the NaN separator that breaks the band.
|
||||
pts.push(xy.map_or([f64::NAN; 3], |(x, y)| to_wcs(x, y).into()));
|
||||
widths.push(w);
|
||||
};
|
||||
let mut prev_end_width: Option<f64> = None;
|
||||
for i in 0..seg_count {
|
||||
let (p0, bulge, sw0, ew0) = verts[i];
|
||||
let (p1, _, _, _) = verts[(i + 1) % n];
|
||||
if i == 0 {
|
||||
push(p0[0], p0[1], sw0 as f32);
|
||||
match prev_end_width {
|
||||
None => push(Some((p0[0], p0[1])), sw0 as f32),
|
||||
// A segment starting at another width than the last one ended
|
||||
// steps there: break the band and restart it (#1628).
|
||||
Some(prev) if (prev - sw0).abs() > 1e-9 => {
|
||||
push(None, 0.0);
|
||||
push(Some((p0[0], p0[1])), sw0 as f32);
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
prev_end_width = Some(ew0);
|
||||
if bulge.abs() < 1e-9 {
|
||||
push(p1[0], p1[1], ew0 as f32);
|
||||
push(Some((p1[0], p1[1])), ew0 as f32);
|
||||
} else if let Some(arc) = BulgeArc::from_bulge(p0, p1, bulge) {
|
||||
let samples = arc.tessellate_angle(kernel::tessellation::DEFAULT_ANGLE);
|
||||
let segments = samples.len().saturating_sub(1).max(1);
|
||||
for (index, s) in samples.into_iter().enumerate().skip(1) {
|
||||
let t = index as f64 / segments as f64;
|
||||
push(s[0], s[1], (sw0 + (ew0 - sw0) * t) as f32);
|
||||
push(Some((s[0], s[1])), (sw0 + (ew0 - sw0) * t) as f32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user