Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Kernel: certified intersection B-splines share joint control points (interior multiplicity 3)

Claude3d77dbb105e7
diff --git a/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs b/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs
index 9ebe5725..8b50b7e7 100644
--- a/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs
+++ b/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs
@@ -85,6 +85,8 @@ public sealed class ShapeComparisonCliTests
.OfType<Aetheris.Kernel.Core.Geometry.Curves.BSpline3Curve>().ToArray();
// One cut per lug, where its root fillet meets the R25 waist.
Assert.Equal(4, splines.Length);
+ // Interior knots no higher than the degree: other readers (OCCT) drop the whole solid otherwise.
+ Assert.All(splines, spline => Assert.All(spline.KnotMultiplicities.Skip(1).SkipLast(1), m => Assert.True(m <= spline.Degree)));
foreach (var spline in splines)
{
var (t0, t1) = (spline.KnotValues[0], spline.KnotValues[^1]);
diff --git a/Aetheris.Kernel.Core.Tests/Geometry/CylinderCylinderIntersectionCurveTests.cs b/Aetheris.Kernel.Core.Tests/Geometry/CylinderCylinderIntersectionCurveTests.cs
index b81ca940..f9bc12fd 100644
--- a/Aetheris.Kernel.Core.Tests/Geometry/CylinderCylinderIntersectionCurveTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Geometry/CylinderCylinderIntersectionCurveTests.cs
@@ -88,7 +88,9 @@ public sealed class CylinderCylinderIntersectionCurveTests
var observedHostResidual = 0d;
var observedToolResidual = 0d;
Assert.True(result.CertifiedDeviationBoundMm <= ToleranceContext.Default.Linear);
- Assert.Equal(result.SegmentCount * 4, result.Curve.ControlPoints.Count);
+ // Spans share their joint control points; no interior knot exceeds the degree (readers reject that).
+ Assert.Equal(result.SegmentCount * 3 + 1, result.Curve.ControlPoints.Count);
+ Assert.All(result.Curve.KnotMultiplicities.Skip(1).SkipLast(1), m => Assert.True(m <= result.Curve.Degree));
var stored = CurveGeometry.FromCertifiedIntersection(result);
Assert.Same(result, stored.CertifiedIntersection);
Assert.Equal(result.Curve, stored.BSpline3!.Value);
@@ -221,6 +223,7 @@ public sealed class CylinderCylinderIntersectionCurveTests
Assert.True(realized.IsSuccess, string.Join("; ", realized.Diagnostics.Select(d => d.Message)));
var result = realized.Value;
Assert.True(result.CertifiedDeviationBoundMm <= ToleranceContext.Default.Linear);
+ Assert.All(result.Curve.KnotMultiplicities.Skip(1).SkipLast(1), m => Assert.True(m <= result.Curve.Degree));
var observed = 0d;
for (var i = 0; i <= 4096; i++)
{
diff --git a/Aetheris.Kernel.Core/Geometry/Curves/CylinderIntersectionCurveRealizer.cs b/Aetheris.Kernel.Core/Geometry/Curves/CylinderIntersectionCurveRealizer.cs
index 167d14a4..87f124b1 100644
--- a/Aetheris.Kernel.Core/Geometry/Curves/CylinderIntersectionCurveRealizer.cs
+++ b/Aetheris.Kernel.Core/Geometry/Curves/CylinderIntersectionCurveRealizer.cs
@@ -72,19 +72,23 @@ public static class CylinderIntersectionCurveRealizer
p3 - authority.Derivative(end) * (h / 3d), p3));
}
- var controls = new List<Point3D>(spans.Count * 4);
+ // Consecutive Bezier spans share their joint control point (both evaluate the exact curve at the same
+ // parameter), so interior knots carry multiplicity 3: a cubic B-spline admits no interior knot of
+ // multiplicity above its degree, and readers (OCCT among them) reject the curve, and its solid, otherwise.
+ var controls = new List<Point3D>(spans.Count * 3 + 1);
var knots = new List<double>(spans.Count + 1);
var multiplicities = new List<int>(spans.Count + 1);
knots.Add(spans[0].Start);
multiplicities.Add(4);
- foreach (var span in spans)
+ controls.Add(spans[0].P0);
+ for (var index = 0; index < spans.Count; index++)
{
- controls.Add(span.P0);
+ var span = spans[index];
controls.Add(span.P1);
controls.Add(span.P2);
controls.Add(span.P3);
knots.Add(span.End);
- multiplicities.Add(4);
+ multiplicities.Add(index == spans.Count - 1 ? 4 : 3);
}
var curve = new BSpline3Curve(3, controls, multiplicities, knots,
diff --git a/docs/development/reports/2026-11/CTC-01-DECOMPILE.md b/docs/development/reports/2026-11/CTC-01-DECOMPILE.md
index 442aaa2d..4ca4b0b3 100644
--- a/docs/development/reports/2026-11/CTC-01-DECOMPILE.md
+++ b/docs/development/reports/2026-11/CTC-01-DECOMPILE.md
@@ -273,6 +273,24 @@ stack splits; carriers and volume agree.
sense.
- **Junction fillets now work on the exported body.** A drilled body's in-memory handle can predate the drills.
+## Follow-up: exported B-splines OCCT rejected
+
+FreeCAD and CAD Assistant (both OCCT) imported the CTC-01 STEP as empty, and Fusion dropped a hole.
+
+- **Cause:** the cylinder-intersection realizer wrote each certified Hermite span as its own Bezier piece, so
+ every interior knot had multiplicity 4 on a cubic and every joint control point appeared twice. A B-spline admits
+ no interior knot above its degree. OCCT rejects the curve and, with it, the whole solid.
+- **Scope:** this hit every export of these curves: the CTC-01 lug cuts, perforated hollows and cross holes. The
+ 8-hole perforation grid also read back empty in OCCT.
+- **Why we missed it:** our own importer accepted the file, so nothing in the lane caught it.
+- **Fix:** spans share their joint control point (both evaluate the exact curve at the same parameter), and
+ interior knots carry multiplicity 3. The curve is unchanged.
+- **Evidence (OCCT 7.x via OCP):**
+ - CTC-01 is one valid solid with 113 faces and volume 14 644 822.6 mm³ (NIST: 14 644 823.3).
+ - Its top face has the same 12 wires and every through hole.
+ - The perforation fixtures are valid solids.
+ - Tests now assert no interior knot above the degree.
+
## Verdict
Success. CTC-01 decompiles into Firmament that rebuilds every surface of the NIST original (85/85, IoU 0.999992),