Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Blend clean-up: the ball's triangle (point-contact strips)
Claude310477c17f9e
diff --git a/Aetheris.Kernel.Core/Brep/Blends/BlendRecognition.cs b/Aetheris.Kernel.Core/Brep/Blends/BlendRecognition.csindex 4912a8a7..eb312ef4 100644--- a/Aetheris.Kernel.Core/Brep/Blends/BlendRecognition.cs+++ b/Aetheris.Kernel.Core/Brep/Blends/BlendRecognition.cs@@ -34,7 +34,9 @@ public sealed record BlendMeasurement(double AnchorTurnDegrees,bool BothRailsAlongEdges,int Samples,- double Lean = 1);+ double Lean = 1,+ FaceId? CollapsedAnchor = null,+ bool CollapsedAlongEdge = false);public sealed record BlendRecognitionOptions{@@ -65,13 +67,18 @@ public static class BlendRecognition/// <summary>"Not bounded" as a finite number: the judgment rejects non-finite evidence by design.</summary>private const double Unbounded = 1e300;- public static IReadOnlyList<FaceBlendRecognition> Recognize(BrepBody body, BlendRecognitionOptions? options = null)+ /// <param name="keep">Faces the caller keeps (a selection's complement, a wall it wants left): never read as+ /// blends, so always available as anchors.</param>+ public static IReadOnlyList<FaceBlendRecognition> Recognize(BrepBody body, BlendRecognitionOptions? options = null, IReadOnlySet<FaceId>? keep = null){+ keep ??= new HashSet<FaceId>();options ??= new();var tess = BrepDisplayTessellator.Tessellate(body);if (!tess.IsSuccess) throw new InvalidOperationException("blend-recognition: tessellation failed: " + string.Join("; ", tess.Diagnostics.Select(d => d.Message)));var context = new Context(body, tess.Value, options);- var results = body.Topology.Faces.OrderBy(f => f.Id.Value).Select(f => RecognizeStrip(context, f.Id, new HashSet<FaceId>())).ToDictionary(r => r.Face);+ var results = body.Topology.Faces.OrderBy(f => f.Id.Value)+ .Select(f => keep.Contains(f.Id) ? new FaceBlendRecognition(f.Id, BlendFaceRole.Primary, null, null, "kept by the caller") : RecognizeStrip(context, f.Id, new HashSet<FaceId>()))+ .ToDictionary(r => r.Face);// An anchor is a face that stays. Joiners (corner patches: smooth all round, meeting a strip, spanning no// two faces of their own) are decided from the strips; a strip read against a joiner or another strip (a// transition patch rolling on a fillet of its own radius) is judged again without them, until nothing changes.@@ -83,7 +90,7 @@ public static class BlendRecognitionvar spanned = results.Values.Where(r => r.Blend is not null).SelectMany(r => new[] { r.Blend!.Hypothesis.AnchorA, r.Blend.Hypothesis.AnchorB }).ToHashSet();foreach (var face in results.Values.Where(r => r.Role == BlendFaceRole.Primary).ToArray()){- if (context.Kind(face.Face) == SurfaceGeometryKind.Plane || spanned.Contains(face.Face)) continue;+ if (context.Kind(face.Face) == SurfaceGeometryKind.Plane || spanned.Contains(face.Face) || keep.Contains(face.Face)) continue;var edges = context.Edges(face.Face);if (edges.Length == 0 || !edges.All(e => context.Tangent(e, face.Face))) continue;if (!edges.Any(e => results[context.Other(e, face.Face)].Role == BlendFaceRole.Strip)) continue;@@ -104,8 +111,8 @@ public static class BlendRecognitionnew("coverage", (m, _) => new(m.Coverage >= 0.8, "blend-certificate-coverage", m.Coverage, 0.8, "fraction of samples whose ball touches an anchor")),new("size", (m, o) => new(m.Size > 0 && double.Max(m.Size, m.SecondSize) <= o.MaxSize + o.Limit(o.MaxSize), "blend-size-over-limit", double.Max(m.Size, m.SecondSize), o.MaxSize, "radius or setback within the policy limit (a measured size is known to the certificate's tolerance)")),new("residual", (m, o) => new(m.Residual <= o.Limit(m.Size), "blend-certificate-residual", m.Residual, o.Limit(m.Size), "worst miss of the certificate, mm")),- new("offset-not-collapsed", (m, o) => new(m.CollapseMargin > CollapseLimit(m, o), "blend-anchor-offset-collapsed", m.CollapseMargin, CollapseLimit(m, o), "an anchor of the ball's own radius (within 1%: approximating nets differ) is a sibling blend, not a face the ball rolls on")),- new("spine-is-a-curve", (m, o) => new(m.Hypothesis.Section == BlendSection.Chamfer || m.SpineExtent > 10 * o.Limit(m.Size), "blend-spine-is-a-point", m.SpineExtent, 10 * o.Limit(m.Size), "a ball that does not move is a corner, not a strip")),+ new("offset-not-collapsed", (m, o) => new(m.CollapseMargin > CollapseLimit(m, o) || BallTriangle(m, o), "blend-anchor-offset-collapsed", m.CollapseMargin, CollapseLimit(m, o), "distance from the ball centres to an anchor's core (axis, centre): on it, the anchor is of the ball's own radius with the ball inside (within 1%: approximating nets differ), a sibling blend, not a face the ball rolls on; unless the ball does not move and that anchor runs along an edge (the ball's triangle)")),+ new("spine-is-a-curve", (m, o) => new(m.Hypothesis.Section == BlendSection.Chamfer || m.SpineExtent > 10 * o.Limit(m.Size) || BallTriangle(m, o), "blend-spine-is-a-point", m.SpineExtent, 10 * o.Limit(m.Size), "a ball that does not move is a corner, not a strip; unless one anchor is a face of the ball's own radius along an edge (the ball's triangle)")),new("chamfer-leans", (m, _) => new(m.Lean > 0.05, "blend-chamfer-does-not-lean", m.Lean, 0.05, "a chamfer's outward normal leans towards both anchors' (cosine); a wall square to them is not one")),new("anchors-turn-at-all", (m, _) => new(m.AnchorTurnDegrees > 1, "blend-anchors-do-not-turn", m.AnchorTurnDegrees, 1, "degrees between the anchors: tangent anchors have no edge to blend")),new("anchors-turn", (m, _) => new(m.AnchorTurnDegrees < 179, "blend-full-round", m.AnchorTurnDegrees, 179, "section sweep (round) or anchor turn (chamfer), degrees: a full round between facing walls has no sharp edge")),@@ -118,6 +125,12 @@ public static class BlendRecognitionprivate static double CollapseLimit(BlendMeasurement m, BlendRecognitionOptions o) => double.Max(o.Limit(m.Size), 0.01 * m.Size);+ /// <summary>The ball's triangle: a round whose radius equals the radius of a face it runs along (a fillet as large+ /// as the arc it follows). That face's offset collapses onto its axis, so the ball's centre is fixed: the blend is+ /// a piece of the ball, touching the other anchor at a point. Its sharp edge is still where the anchors meet.</summary>+ public static bool BallTriangle(BlendMeasurement m, BlendRecognitionOptions o) =>+ m.Hypothesis.Section == BlendSection.Round && m.SpineExtent <= 10 * o.Limit(m.Size) && m.CollapsedAnchor is not null && m.CollapsedAlongEdge;+private static FaceBlendRecognition RecognizeStrip(Context c, FaceId face, IReadOnlySet<FaceId> notAnchors){SurfaceGeometryKind? kind = c.Kind(face);@@ -183,7 +196,15 @@ public static class BlendRecognitionBlendMeasurement Result(double radius, double residual, double coverage, (Point3D P, Vector3D N)[] used){- var collapse = new[] { a.ConstantRadius, b.ConstantRadius }.Where(x => x is not null).Select(x => double.Abs(x!.Value - radius)).DefaultIfEmpty(Unbounded).Min();+ var centresForCore = used.Select(s => s.P - s.N * (side * radius)).ToArray();+ // An anchor's offset collapses when the ball's centre sits on its core (a cylinder's axis, a sphere's centre):+ // a ball of the anchor's own radius on its inside. On the outside of a reflex arc of the same radius it rolls.+ double Core(BlendSupport s) => centresForCore.Length == 0 || s.CoreDistance(centresForCore[0]) is null ? Unbounded : centresForCore.Max(p => s.CoreDistance(p)!.Value);+ var collapse = double.Min(Core(a), Core(b));+ var limit = double.Max(c.Options.Limit(radius), 0.01 * radius);+ var collapsed = new[] { a, b }.Where(s => Core(s) <= limit).ToArray();+ FaceId? collapsedAnchor = collapsed.Length == 1 ? collapsed[0].Face : null;+ var collapsedAlongEdge = collapsedAnchor is { } ca && c.SharesEdge(h.Face, ca);var centres = used.Select(s => s.P - s.N * (side * radius)).ToArray();var extent = centres.Length < 2 ? 0 : centres.Max(p => (p - centres[0]).Length);// The section's sweep: the angle between the ball's two feet, 90° at a box edge, 180° for a full round@@ -192,7 +213,7 @@ public static class BlendRecognitionVector3D Foot(BlendSupport s) { var n = s.Normal(middle); return s.Distance(middle + n * radius) <= s.Distance(middle - n * radius) ? n : n * -1; }var (footA, footB) = (Foot(a), Foot(b));var sweep = double.Acos(double.Clamp(footA.Dot(footB), -1, 1)) * 180 / double.Pi;- return new(h, true, radius, 0, residual, coverage, collapse, extent, sweep, railsOnEdges, used.Length);+ return new(h, true, radius, 0, residual, coverage, collapse, extent, sweep, railsOnEdges, used.Length, 1, collapsedAnchor, collapsedAlongEdge);}double Residual((Point3D P, Vector3D N)[] used, double radius) => used.Length == 0 ? Unbounded : used.Max(s =>diff --git a/Aetheris.Kernel.Core/Brep/Blends/BlendSupport.cs b/Aetheris.Kernel.Core/Brep/Blends/BlendSupport.csindex 405638f2..d7c21954 100644--- a/Aetheris.Kernel.Core/Brep/Blends/BlendSupport.cs+++ b/Aetheris.Kernel.Core/Brep/Blends/BlendSupport.cs@@ -29,6 +29,27 @@ public sealed class BlendSupport_ => null,};+ /// <summary>Distance from the point to the support's core: a cylinder's axis, a sphere's centre, a torus's tube+ /// circle; null for supports without one. A ball whose centre sits on the core has a collapsed offset.</summary>+ public double? CoreDistance(Point3D x)+ {+ switch (_surface.Kind)+ {+ case SurfaceGeometryKind.Cylinder:+ var c = _surface.Cylinder!.Value;+ return Radial(x - c.Origin, c.Axis.ToVector()).Length;+ case SurfaceGeometryKind.Sphere:+ return (x - _surface.Sphere!.Value.Center).Length;+ case SurfaceGeometryKind.Torus:+ var t = _surface.Torus!.Value; var axis = t.Axis.ToVector();+ var radial = Radial(x - t.Center, axis);+ var tube = radial.Length > 1e-12 ? t.Center + radial * (t.MajorRadius / radial.Length) : t.Center;+ return (x - tube).Length;+ default:+ return null;+ }+ }+public static BlendSupport? Of(BrepBody body, FaceId face) =>body.TryGetFaceSurfaceGeometry(face, out var surface) && surface is { Kind: SurfaceGeometryKind.Plane or SurfaceGeometryKind.Cylinderor SurfaceGeometryKind.Cone or SurfaceGeometryKind.Sphere or SurfaceGeometryKind.Torus }diff --git a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemoval.cs b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemoval.csindex 95c02841..85b8751d 100644--- a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemoval.cs+++ b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemoval.cs@@ -78,11 +78,28 @@ internal static class BlendNetworkRemovalvar touched = strips.SelectMany(EdgesOf).ToHashSet();var transverse = touched.Where(e => !longitudinal.Contains(e)).ToHashSet();+ // The ball's triangle (a fillet as large as the arc it follows) touches one anchor at a single vertex. That+ // vertex is no corner: each strip ending at it ends at its own corner, reached along its own end edge, and+ // the vertex itself disappears with the blend.+ var contact = new HashSet<VertexId>();+ foreach (var (s, (a, b)) in bridge)+ foreach (var point in new[] { a, b }.Where(x => !EdgesOf(s).Any(e => edgeFaces[e].Contains(x))))+ foreach (var v in EdgesOf(s).Select(topology.GetEdge).SelectMany(e => new[] { e.StartVertexId, e.EndVertexId }).Distinct())+ if (body.TryGetVertexPoint(v, out var at) && Math.Abs(Surface(point).F(at)) <= 10 * accuracy) contact.Add(v);+// 2. Vertex clusters: vertices joined by transverse (end, miter) edges collapse to one corner.var parent = new Dictionary<VertexId, VertexId>();VertexId Find(VertexId v) { if (!parent.ContainsKey(v)) parent[v] = v; while (parent[v] != v) v = parent[v] = parent[parent[v]]; return v; }foreach (var e in touched) { var edge = topology.GetEdge(e); Find(edge.StartVertexId); Find(edge.EndVertexId); }- foreach (var e in transverse) { var edge = topology.GetEdge(e); parent[Find(edge.StartVertexId)] = Find(edge.EndVertexId); }+ foreach (var e in transverse)+ {+ var edge = topology.GetEdge(e);+ if (contact.Contains(edge.StartVertexId) || contact.Contains(edge.EndVertexId)) continue;+ parent[Find(edge.StartVertexId)] = Find(edge.EndVertexId);+ }+ foreach (var v in contact) parent.Remove(v);+ if (contact.Any(v => topology.Edges.Any(e => !touched.Contains(e.Id) && (e.StartVertexId == v || e.EndVertexId == v))))+ throw new InvalidOperationException("blend-removal-contact-vertex-kept-edge: a point-contact vertex also ends a kept edge");var clusterOf = parent.Keys.ToDictionary(v => v, Find);var clusters = clusterOf.GroupBy(p => p.Value).ToDictionary(g => g.Key, g => g.Select(p => p.Key).ToArray());@@ -111,7 +128,11 @@ internal static class BlendNetworkRemoval}foreach (var (root, members) in clusters){- var around = members.SelectMany(v => vertexFaces[v]).Where(f => !strips.Contains(f)).Distinct().Select(Surface).ToArray();+ // The faces round the cluster, and the anchors of the strips ending there: a corner beside a point+ // contact touches the anchor it was in contact with only through those strips.+ var around = members.SelectMany(v => vertexFaces[v]).Where(f => !strips.Contains(f))+ .Concat(members.SelectMany(v => vertexFaces[v]).Where(bridge.ContainsKey).SelectMany(f => new[] { bridge[f].A, bridge[f].B }))+ .Distinct().Select(Surface).ToArray();try { corner[root] = Corner(members, around); representative[root] = members.MinBy(v => v.Value)!; continue; }catch (InvalidOperationException refusal) when (refusal.Message.StartsWith("blend-removal-corner-not-common", StringComparison.Ordinal)){@@ -152,7 +173,15 @@ internal static class BlendNetworkRemovalNewEdgeData NewEdge(EdgeId old, FaceId s){var edge = topology.GetEdge(old);- var (u, v) = (MapCorner(edge.StartVertexId), MapCorner(edge.EndVertexId));+ VertexId Through(VertexId x)+ {+ if (!contact.Contains(x)) return MapCorner(x);+ // Along this strip's own end edge at the contact, to the corner at its other end.+ var end = EdgesOf(s).Where(transverse.Contains).Select(topology.GetEdge).FirstOrDefault(e => e.StartVertexId == x || e.EndVertexId == x)+ ?? throw new InvalidOperationException($"blend-removal-contact-unreached: strip {s.Value} reaches contact vertex {x.Value} by no end edge");+ return MapCorner(end.StartVertexId == x ? end.EndVertexId : end.StartVertexId);+ }+ var (u, v) = (Through(edge.StartVertexId), Through(edge.EndVertexId));var circle = bridgeCircle[s];if (u == v && circle is null) throw new InvalidOperationException($"blend-removal-strip-collapses: edge {old.Value} has both ends in one corner");var (a, b) = bridge[s];@@ -205,6 +234,8 @@ internal static class BlendNetworkRemovalforeach (var e in transverse){var edge = topology.GetEdge(e);+ // An end edge at a point contact goes with the blend: each side's strip ends at its own corner.+ if (contact.Contains(edge.StartVertexId) || contact.Contains(edge.EndVertexId)) continue;var (u, v) = (Map(edge.StartVertexId), Map(edge.EndVertexId));if (u == v) continue;var kept = edgeFaces[e].Where(f => !strips.Contains(f)).ToArray();@@ -219,7 +250,9 @@ internal static class BlendNetworkRemoval// 4. Rebuild the loops of every face outside the network.var model = new TopologyModel();- var keptVertices = topology.Vertices.Select(v => Map(v.Id)).Distinct().ToArray();+ var keptVertices = topology.Vertices.Where(v => !contact.Contains(v.Id)).Select(v => Map(v.Id)).Distinct().ToArray();+ // Every sharp edge first: a face may need one it does not own an old edge for (the top across a point contact).+ foreach (var e in longitudinal) NewEdge(e, edgeFaces[e].First(strips.Contains));foreach (var v in keptVertices) model.AddVertex(new Vertex(v));var keptEdges = topology.Edges.Where(e => !touched.Contains(e.Id)).ToArray();foreach (var e in keptEdges) model.AddEdge(e with { StartVertexId = Map(e.StartVertexId), EndVertexId = Map(e.EndVertexId) });@@ -272,15 +305,18 @@ internal static class BlendNetworkRemoval}if (changed) changedFaces.Add(face.Id);if (uses.Count > 1 && uses[0] == uses[^1]) uses.RemoveAt(uses.Count - 1);- // An anchor's loop runs along the sharp edge to the corner, then on along an end edge to the vertex- // that stayed: insert the end edges this face owns where its loop has such a gap.- foreach (var end in endEdges.Values.Where(x => x.Anchor == face.Id))+ // Where the loop has a gap, a new edge this face lies on closes it: an end edge on to a vertex that+ // stayed, or a strip's sharp edge the face meets only across a point contact.+ var fillers = endEdges.Values.Where(x => x.Anchor == face.Id).Select(x => x.Edge)+ .Concat(newEdges.Where(p => p.Key.Item3 == face.Id.Value || p.Key.Item4 == face.Id.Value).Select(p => p.Value)).ToArray();+ foreach (var filler in fillers)for (var i = 0; i < uses.Count; i++){+ if (uses.Any(x => x.Edge == filler.Id)) break;var to = Ends(uses[i]).To; var from = Ends(uses[(i + 1) % uses.Count]).From;if (to == from) continue;- if (to == end.Edge.Start && from == end.Edge.End) { uses.Insert(i + 1, (end.Edge.Id, false)); break; }- if (to == end.Edge.End && from == end.Edge.Start) { uses.Insert(i + 1, (end.Edge.Id, true)); break; }+ if (to == filler.Start && from == filler.End) { uses.Insert(i + 1, (filler.Id, false)); break; }+ if (to == filler.End && from == filler.Start) { uses.Insert(i + 1, (filler.Id, true)); break; }}if (uses.Count == 0) throw new InvalidOperationException($"blend-removal-loop-vanishes: face {face.Id.Value} loop {loopId.Value}");var ids = loop.CoedgeIds.Count == uses.Count && !changed ? loop.CoedgeIds.ToArray()diff --git a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemovalTests.cs b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemovalTests.csindex ce589de4..34e9994a 100644--- a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemovalTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendNetworkRemovalTests.cs@@ -45,6 +45,9 @@ public sealed class BlendNetworkRemovalTests(ITestOutputHelper output){ "d-profile-fillet", "fixtures/Regression/EdgeFinishRobustness/d-profile-fillet.firmament" },{ "rounded-rect-top-fillet", RoundedRect("Modify Body { EdgeFinish Rim { target: Section.Outer; on: Top; kind: Fillet; radius: 2mm } }") },{ "rounded-rect-top-chamfer", RoundedRect("Modify Body { EdgeFinish Rim { target: Section.Outer; on: Top; kind: Chamfer; distance: 2mm } }") },+ // The convex 4 mm arc under a 4 mm fillet: the blend there is a piece of the ball touching the top at one point+ // (the ball's triangle); its sharp edge is still the arc where the top meets the arc wall.+ { "chimera-fillet", "fixtures/Regression/CanonicalGeometry/profile-edgefinish-chimera-fillet.firmament" },};/// <summary>Corner arcs tangent to the sides: the rim strips along the arcs bridge the top and a cylinder@@ -70,20 +73,24 @@ public sealed class BlendNetworkRemovalTests(ITestOutputHelper output)}""";- /// <summary>The chimera's convex 4 mm arc under a 4 mm fillet: the blend there is a sphere touching the top at- /// one point, which the probe reads as a joiner with no anchors. Its corner is two corners merged.</summary>+ /// <summary>A 4 mm fillet on a 4 mm convex arc: the blend is a piece of the ball (the ball's triangle), touching+ /// the top at one vertex, rolling on nothing, its centre on the arc's axis. Read as a strip between the top and+ /// the arc wall; a sharp corner's sphere (three strips, no wall of its radius) stays a joiner.</summary>[Fact]- public void FilletAsLargeAsTheArc_Refuses()+ public void FilletAsLargeAsItsArc_ReadsAsTheBallsTriangle(){- var source = File.ReadAllText(Path.Combine(Root(), "fixtures/Regression/CanonicalGeometry/profile-edgefinish-chimera-fillet.firmament"));- var finished = Import(source);- var probe = BlendRegionProbe.Run("chimera", finished);- var strips = probe.Regions.SelectMany(r => r.Faces).Select(f => new FaceId(f))- .Where(f => !(finished.TryGetFaceSurfaceGeometry(f, out var g) && g!.Cylinder is { } c && Math.Abs(Math.Abs(c.Axis.ToVector().Z) - 1) < 1e-9))- .ToHashSet();- var removed = BlendNetworkRemoval.Remove(finished, strips, Anchors(probe));- Assert.Null(removed.Body);- Assert.StartsWith("blend-removal-corner-not-common", removed.Refusal);+ var finished = Import(File.ReadAllText(Path.Combine(Root(), "fixtures/Regression/CanonicalGeometry/profile-edgefinish-chimera-fillet.firmament")));+ var keep = finished.Topology.Faces.Select(f => f.Id)+ .Where(f => finished.TryGetFaceSurfaceGeometry(f, out var g) && g!.Cylinder is { } c && Math.Abs(Math.Abs(c.Axis.ToVector().Z) - 1) < 1e-9).ToHashSet();+ var recognized = Aetheris.Kernel.Core.Brep.Blends.BlendRecognition.Recognize(finished, null, keep);+ var sphere = recognized.Single(r => finished.TryGetFaceSurfaceGeometry(r.Face, out var g) && g!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Sphere);+ Assert.Equal(Aetheris.Kernel.Core.Brep.Blends.BlendFaceRole.Strip, sphere.Role);+ Assert.True(Aetheris.Kernel.Core.Brep.Blends.BlendRecognition.BallTriangle(sphere.Blend!, new()));+ Assert.Contains(sphere.Blend!.CollapsedAnchor!.Value, keep);+ Assert.Equal(4, sphere.Blend.Size, 9);++ var box = Aetheris.Kernel.Core.Brep.Blends.BlendRecognition.Recognize(Aetheris.Kernel.Core.Brep.ConvexStockPrimitives.CreateRoundedBox(40, 30, 20, 3).Value);+ Assert.Equal(8, box.Count(r => r.Role == Aetheris.Kernel.Core.Brep.Blends.BlendFaceRole.Joiner));}[Theory]@@ -96,18 +103,14 @@ public sealed class BlendNetworkRemovalTests(ITestOutputHelper output)Assert.DoesNotMatch(@"EdgeFinish \w+ \{", stripped);var plain = Import(Regex.Replace(source, @"Modify Body \{\s*EdgeFinish[^{}]*\{[^{}]*\}\s*\}", ""));- var probe = BlendRegionProbe.Run(name, finished);- // Profile arcs extruded along Z are tangent walls the probe also reads as blends; the authored part- // without the finish keeps them, so only the finish is removed and the arcs stay as anchors.- var strips = probe.Regions.SelectMany(r => r.Faces).Select(f => new FaceId(f))- .Where(f => !(finished.TryGetFaceSurfaceGeometry(f, out var g) && g!.Cylinder is { } c && Math.Abs(Math.Abs(c.Axis.ToVector().Z) - 1) < 1e-9))- .ToHashSet();+ // Profile arcs extruded along Z are tangent walls, geometrically blends between the side walls; the authored+ // part without the finish keeps them, so the caller keeps them and only the finish is recognized.+ var keep = finished.Topology.Faces.Select(f => f.Id)+ .Where(f => finished.TryGetFaceSurfaceGeometry(f, out var g) && g!.Cylinder is { } c && Math.Abs(Math.Abs(c.Axis.ToVector().Z) - 1) < 1e-9).ToHashSet();+ var probe = BlendRegionProbe.Run(name, finished, new BlendRegionProbe.Options(Keep: keep));+ var strips = probe.Regions.SelectMany(r => r.Faces).Select(f => new FaceId(f)).ToHashSet();Assert.NotEmpty(strips);- // A kept wall the probe read as a blend is an anchor of the strips along it.- var kept = probe.Regions.SelectMany(r => r.Faces).Select(f => new FaceId(f)).Where(f => !strips.Contains(f)).ToHashSet();var anchors = Anchors(probe);- foreach (var f in strips)- anchors[f] = anchors[f].Concat(Neighbours(finished, f).Where(kept.Contains)).Distinct().ToArray();var removed = BlendNetworkRemoval.Remove(finished, strips, anchors);Assert.True(removed.Body is not null, removed.Refusal);output.WriteLine($"{name}: removed {strips.Count} faces, {removed.NewEdges} sharp edges, {removed.Clusters} corners");diff --git a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendRegionProbe.cs b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendRegionProbe.csindex c2f603db..2dfe82e7 100644--- a/Aetheris.Kernel.Firmament.Tests/Experiments/BlendRegionProbe.cs+++ b/Aetheris.Kernel.Firmament.Tests/Experiments/BlendRegionProbe.cs@@ -15,7 +15,7 @@ namespace Aetheris.Kernel.Firmament.Tests.Experiments;/// </summary>internal static class BlendRegionProbe{- internal sealed record Options(double MaxBlendRadius = 5, double TangentDegrees = 3, bool Certificate = true)+ internal sealed record Options(double MaxBlendRadius = 5, double TangentDegrees = 3, bool Certificate = true, IReadOnlySet<FaceId>? Keep = null){// A 45° chamfer of size c is c·√2 wide; admit chamfers up to the blend-radius limit.public double MaxChamferWidth => MaxBlendRadius * Math.Sqrt(2) + 1e-6;@@ -64,7 +64,7 @@ internal static class BlendRegionProbe// The rolling-ball certificate (Core BlendRecognition) decides strips, joiners and anchors; the shape// heuristics below remain for comparison (Options.Certificate = false).var recognized = options.Certificate- ? BlendRecognition.Recognize(body, new BlendRecognitionOptions { MaxSize = options.MaxBlendRadius, TangentDegrees = options.TangentDegrees }).ToDictionary(r => r.Face)+ ? BlendRecognition.Recognize(body, new BlendRecognitionOptions { MaxSize = options.MaxBlendRadius, TangentDegrees = options.TangentDegrees }, options.Keep).ToDictionary(r => r.Face): null;foreach (var face in body.Topology.Faces){diff --git a/docs/development/reports/2026-11/BLEND-RECOGNITION-CERTIFICATE.md b/docs/development/reports/2026-11/BLEND-RECOGNITION-CERTIFICATE.mdindex bc974f78..6dc2ea93 100644--- a/docs/development/reports/2026-11/BLEND-RECOGNITION-CERTIFICATE.md+++ b/docs/development/reports/2026-11/BLEND-RECOGNITION-CERTIFICATE.md@@ -60,3 +60,28 @@ predicted), the source-tessellation error found by hand before. Most of the 45 a- Freeform anchors (no distance function yet): `freeform-neighbour-not-extendable` 186 faces.- Point-contact strips (the chimera sphere; item 2 of the plan) read as joiners for now.- Pappus length for curved strips in the volume prediction.++## Point contacts: the ball's triangle++A fillet as large as the arc it follows (the chimera's 4 mm fillet on a 4 mm convex arc) is a+piece of the ball: its centre is fixed on the arc's axis, and it touches the top at one vertex.+solidcore names it the ball's triangle (#2403).++- **Recognition.** An anchor's offset collapses when the ball's centres sit on its core (a+ cylinder's axis, a sphere's centre, a torus's tube circle), measured, not inferred from equal+ radii: on the outside of a reflex arc of the same radius the ball rolls (the chimera's torus 24+ was wrongly refused before this). A reading whose centre does not move and whose one collapsed+ anchor runs along an edge is admitted as the ball's triangle (`BlendRecognition.BallTriangle`).+ A box corner's sphere never qualifies: its candidate anchors are sibling strips.+- **Keep set.** `Recognize(body, options, keep)`: faces the caller keeps are never blends, so+ they are anchors. The chimera's profile arcs are geometrically blends between the side walls;+ a caller removing only the rim finish keeps them. Replaces the test-side anchor workaround.+- **Removal.** The contact vertex joins no cluster and disappears; each strip ending at it maps+ it along its own end edge to its own corner; corners include the anchors of the strips ending+ there; every sharp edge is built before the loops, and a loop gap is closed by any new edge on+ that face (the top gets the arc across the contact).++The chimera now comes back as the authored sharp part (19 faces, every vertex within 1e-6 mm,+volume, export and reimport); `FilletAsLargeAsTheArc_Refuses` is replaced by that ground truth and+`FilletAsLargeAsItsArc_ReadsAsTheBallsTriangle`. Reach unchanged (802; 697 full pcurve): the+corpus has no ball's triangle.