Offset of an irregular closed spline no longer fails its error certificate; offset fit nodes stay private (#1009)

Fixes #971. At the node limit the offset certificate splits the fitted curve where it meets the exact offset midpoint, so curves with different parameter speeds certify within the same 0.002 mm tolerance. Associated offset fit nodes are hidden from display, picking, box selection and snapping until Break Association.

Thanks @Karl-VonRichter.
This commit is contained in:
Karl Von Richter authored and GitHub committed 2026-10-14 05:27:39 -04:00
1 parent 2f91338d3d
commit 9ca7d307a4
9 files changed
+319 -41

No files matched your search

+5 -23
View File
@@ -905,7 +905,7 @@ pub(crate) fn snaps_to_points(accept: Accept) -> bool {
}
/// Which of a sketch's points a face place snaps to (the Single hole's): the points of geometry
/// the sketch shows. Not a text outline's points, which are never drawn or picked on their own
/// the sketch shows. Not generated offset nodes or a text outline's points, which are never drawn or picked on their own
/// (as `view::sketch_point_visible` has it), nor projected points while the sketch hides
/// projected geometry (Show Projected off), whose curves aren't picked either. Hidden sketches
/// offer no points at all. Show Points doesn't count: it only hides the markers of the sketch
@@ -913,35 +913,17 @@ pub(crate) fn snaps_to_points(accept: Accept) -> bool {
pub(crate) struct SnapPoints<'a> {
/// Show Projected is off: no linked point is taken.
hide_linked: bool,
/// The text sources' link ids (looked up once, however many points and links there are).
text: std::collections::HashSet<&'a str>,
shown: solidcraft_engine::view::SketchPointVisibility<'a>,
}
impl<'a> SnapPoints<'a> {
pub(crate) fn of(sk: &'a solidcraft_engine::sketch::Sketch) -> SnapPoints<'a> {
let hide_linked = sk.view.hide_projected;
let text = if hide_linked {
Default::default()
} else {
// An id names its first link, as `Sketch::link` finds it.
let mut seen = std::collections::HashSet::new();
sk.links
.iter()
.filter(|l| seen.insert(l.id.as_str()))
.filter(|l| l.kind == solidcraft_engine::sketch::LinkKind::Text)
.map(|l| l.id.as_str())
.collect()
};
SnapPoints { hide_linked, text }
pub(crate) fn of(sk: &'a solidcraft_engine::sketch::Sketch) -> Self {
Self { hide_linked: sk.view.hide_projected, shown: solidcraft_engine::view::SketchPointVisibility::new(sk) }
}
/// Does a face place snap to point `p` of the sketch?
pub(crate) fn takes(&self, p: &solidcraft_engine::sketch::SPoint) -> bool {
match p.link.as_deref() {
None => true,
Some(_) if self.hide_linked => false,
Some(l) => !self.text.contains(l),
}
self.shown.takes(p) && !(self.hide_linked && p.link.is_some())
}
}