Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add shared geometry identity and bounded curve support
Yuechen Li3345a4635a5c
diff --git a/Aetheris.Geometry.Tests/Aetheris.Geometry.Tests.csproj b/Aetheris.Geometry.Tests/Aetheris.Geometry.Tests.csprojindex 491d1579..d2533d53 100644--- a/Aetheris.Geometry.Tests/Aetheris.Geometry.Tests.csproj+++ b/Aetheris.Geometry.Tests/Aetheris.Geometry.Tests.csproj@@ -8,5 +8,6 @@<ItemGroup><ProjectReference Include="..\Aetheris.Geometry\Aetheris.Geometry.csproj" /><ProjectReference Include="..\Aetheris.Surfacing\Aetheris.Surfacing.csproj" />+ <ProjectReference Include="..\Aetheris.Piping\Aetheris.Piping.csproj" /></ItemGroup></Project>diff --git a/Aetheris.Geometry.Tests/ParametricCurveTests.cs b/Aetheris.Geometry.Tests/ParametricCurveTests.csnew file mode 100644index 00000000..5dbbb60e--- /dev/null+++ b/Aetheris.Geometry.Tests/ParametricCurveTests.cs@@ -0,0 +1,128 @@+using System.Text.Json;+using Aetheris.Geometry;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Geometry.Curves;+using Aetheris.Kernel.Core.Geometry.Surfaces;+using Aetheris.Kernel.Core.Math;+using Aetheris.Piping;+using Aetheris.Surfacing;+using Xunit;++namespace Aetheris.Geometry.Tests;++public sealed class ParametricCurveTests+{+ private static readonly Direction3D X = Direction3D.Create(new(1, 0, 0));+ private static readonly Direction3D Z = Direction3D.Create(new(0, 0, 1));++ [Fact]+ public void DomainIsFiniteOrderedInclusiveAndDeterministic()+ {+ Assert.Throws<GeometryDefinitionException>(() => new ParameterDomain1(1, 1));+ Assert.Throws<GeometryDefinitionException>(() => new ParameterDomain1(double.NegativeInfinity, 1));+ var domain = new ParameterDomain1(-2, 3);+ Assert.True(domain.Contains(-2)); Assert.True(domain.Contains(3)); Assert.False(domain.Contains(4));+ Assert.Equal(domain, new ParameterDomain1(-2, 3));+ var curve = BoundedParametricCurve3.LineSegment("domain-line", new(0, 0, 0), new(1, 0, 0), "fixture");+ Assert.Throws<ArgumentOutOfRangeException>(() => curve.Evaluate(2));+ }++ [Fact]+ public void ExactKernelFamiliesExposePointsDerivativesTangentsAndDomains()+ {+ var line = Adapt("line", CurveGeometry.FromLine(new(new(1, 2, 3), X)), 0, 4);+ AssertPoint(line.Evaluate(4), 5, 2, 3); AssertVector(line.EvaluateJet1(2).Derivative, 1, 0, 0);++ var circle = Adapt("circle", CurveGeometry.FromCircle(new(Point3D.Origin, Z, 2, X)), 0, 2 * double.Pi);+ Assert.True(circle.IsPeriodic); AssertPoint(circle.Evaluate(0), 2, 0, 0); AssertVector(circle.EvaluateJet1(0).Derivative, 0, 2, 0);++ var ellipse = Adapt("ellipse", CurveGeometry.FromEllipse(new(Point3D.Origin, Z, 3, 2, X)), 0, double.Pi / 2);+ AssertPoint(ellipse.Evaluate(double.Pi / 2), 0, 2, 0); AssertVector(ellipse.EvaluateJet1(0).Derivative, 0, 2, 0);++ var hyperbola = Adapt("hyperbola", CurveGeometry.FromHyperbola(new(Point3D.Origin, Z, X, 2, 3, HyperbolaBranch.PositiveAxisU)), -1, 1);+ AssertPoint(hyperbola.Evaluate(0), 2, 0, 0); AssertVector(hyperbola.EvaluateJet1(0).Derivative, 0, 3, 0);++ var splineSupport = new BSpline3Curve(1, [new(0, 0, 0), new(2, 4, 0)], [2, 2], [0, 1], "POLYLINE_FORM", false, false, "UNIFORM_KNOTS");+ var spline = Adapt("spline", CurveGeometry.FromBSpline(splineSupport), splineSupport.DomainStart, splineSupport.DomainEnd);+ Assert.Equal(1, spline.Degree); AssertPoint(spline.Evaluate(.5), 1, 2, 0); AssertVector(spline.EvaluateJet1(.5).Derivative, 2, 4, 0);+ Assert.All(new[] { line, circle, ellipse, hyperbola, spline }, curve => Assert.Equal(DifferentialSingularityKind.Regular, curve.EvaluateJet1(curve.Domain.Minimum).Singularity));+ }++ [Fact]+ public void ReversedNativeTrimPreservesAuthoredOrientationWithoutChangingSupportIdentity()+ {+ var reversed = Adapt("reverse", CurveGeometry.FromLine(new(Point3D.Origin, X)), 5, 2);+ Assert.Equal(new ParameterDomain1(2, 5), reversed.Domain);+ AssertPoint(reversed.Evaluate(2), 5, 0, 0); AssertPoint(reversed.Evaluate(5), 2, 0, 0);+ AssertVector(reversed.EvaluateJet1(3).Derivative, -1, 0, 0);+ }++ [Fact]+ public void ExpressionsAutomaticallyDifferentiateParabolaSinusoidAndHelix()+ {+ var t = CurveExpression.T; var one = CurveExpression.Length(1);+ var parabola = Expression("parabola", new(CurveExpression.Multiply(one, t), CurveExpression.Multiply(one, CurveExpression.Power(t, 2)), CurveExpression.Length(0)), -2, 2);+ AssertPoint(parabola.Evaluate(1.5), 1.5, 2.25, 0); AssertVector(parabola.EvaluateJet1(1.5).Derivative, 1, 3, 0);+ var sinusoid = Expression("sinusoid", new(CurveExpression.Multiply(one, t), CurveExpression.Multiply(one, CurveExpression.Sin(t)), CurveExpression.Length(0)), -double.Pi, double.Pi);+ AssertVector(sinusoid.EvaluateJet1(0).Derivative, 1, 1, 0);+ var helix = Expression("helix", new(CurveExpression.Multiply(one, CurveExpression.Cos(t)), CurveExpression.Multiply(one, CurveExpression.Sin(t)), CurveExpression.Multiply(one, t)), 0, 2 * double.Pi);+ AssertPoint(helix.Evaluate(double.Pi / 2), 0, 1, double.Pi / 2); AssertVector(helix.EvaluateJet1(0).Derivative, 0, 1, 1);+ Assert.Throws<ArgumentException>(() => new BoundedParametricCurve3("bad-units", new(0, 1), new(t, one, one), "fixture"));+ var division = Expression("non-finite", new(CurveExpression.Divide(one, t), one, one), -1, 1);+ Assert.Throws<DivideByZeroException>(() => division.Evaluate(0));+ }++ [Fact]+ public void ZeroDerivativeHasExplicitSingularityStateAndNoTangent()+ {+ var curve = BoundedParametricCurve3.Procedural("singular", new(0, 1), t => (new(t, 0, 0), new(0, 0, 0)), "fixture");+ var jet = curve.EvaluateJet1(.5);+ Assert.Equal(DifferentialSingularityKind.Singular, jet.Singularity); Assert.Null(jet.UnitTangent);+ }++ [Fact]+ public void PanelEdgeAndPipeRouteUseTheSameDirectedPublicCurveLayer()+ {+ var panelResult = PanelFactory.FromRuled(RuledCanopyTemplate.Create("curve-panel", 20, 10, 2));+ Assert.True(panelResult.IsSuccess);+ var north = panelResult.Panel!["North"];+ AssertPoint(north.AuthoredCurve.Evaluate(north.AuthoredCurve.Domain.Minimum), north.Start.X, north.Start.Y, north.Start.Z);+ Assert.NotNull(north.AuthoredCurve.EvaluateJet1(north.AuthoredCurve.Domain.Minimum).UnitTangent);+ Assert.Equal(north.StableId, north.AuthoredCurve.Provenance.SemanticOwner);++ var routeResult = PipeRouteLowering.Lower(StandardPipeElbowTemplate.Create("route", 4, 10, 8));+ Assert.True(routeResult.IsSuccess);+ var pieces = routeResult.Ir!.CenterlineCurves;+ Assert.Equal(["Line3", "Circle3", "Line3"], pieces.Select(piece => piece.NativeFamily));+ Assert.Equal(routeResult.Ir.Elements.Select(element => element.StableId), pieces.Select(piece => piece.StableId));+ AssertPoint(pieces[0].Evaluate(pieces[0].Domain.Minimum), 0, 0, 0);+ AssertPoint(pieces[1].Evaluate(pieces[1].Domain.Maximum), 18, 8, 0);+ AssertPoint(pieces[2].Evaluate(pieces[2].Domain.Maximum), 18, 18, 0);+ }++ [Fact]+ public void ConstructiveConeSectionHyperbolaKeepsItsBoundedNonAuthoringRole()+ {+ var cone = new ConeSurface(Point3D.Origin, X, double.Pi / 4, Z);+ var construction = TransverseConePlaneIntersection.IntersectWorldZ(cone, 2);+ Assert.True(construction.IsSuccess);+ var bounded = Adapt("construction-hyperbola", CurveGeometry.FromHyperbola(construction.Value), -.5, .5);+ Assert.Equal("Hyperbola3", bounded.NativeFamily); Assert.Equal("construction:cone-world-z", bounded.Provenance.Source);+ Assert.Equal(DifferentialSingularityKind.Regular, bounded.EvaluateJet1(0).Singularity);+ }++ [Fact]+ public void FixedCurveInputsSerializeDeterministically()+ {+ var curve = BoundedParametricCurve3.LineSegment("stable", new(0, 0, 0), new(2, 0, 0), "fixture", "owner");+ var first = JsonSerializer.Serialize(new { curve.Identity, curve.Domain, curve.Provenance, Jet = curve.EvaluateJet1(1) });+ var second = JsonSerializer.Serialize(new { curve.Identity, curve.Domain, curve.Provenance, Jet = curve.EvaluateJet1(1) });+ Assert.Equal(first, second);+ }++ private static BoundedParametricCurve3 Adapt(string id, CurveGeometry curve, double start, double end) =>+ BoundedParametricCurve3.FromCurveGeometry(id, curve, start, end, id == "construction-hyperbola" ? "construction:cone-world-z" : "fixture:" + id);+ private static BoundedParametricCurve3 Expression(string id, CurvePointExpression expression, double start, double end) => new(id, new(start, end), expression, "fixture:" + id);+ private static void AssertPoint(Point3D actual, double x, double y, double z) { Assert.Equal(x, actual.X, 10); Assert.Equal(y, actual.Y, 10); Assert.Equal(z, actual.Z, 10); }+ private static void AssertVector(Vector3D actual, double x, double y, double z) { Assert.Equal(x, actual.X, 10); Assert.Equal(y, actual.Y, 10); Assert.Equal(z, actual.Z, 10); }+}diff --git a/Aetheris.Geometry/ParametricCurves.cs b/Aetheris.Geometry/ParametricCurves.csnew file mode 100644index 00000000..c86e4b1e--- /dev/null+++ b/Aetheris.Geometry/ParametricCurves.cs@@ -0,0 +1,195 @@+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Geometry.Curves;+using Aetheris.Kernel.Core.Math;++namespace Aetheris.Geometry;++/// <summary>An inclusive, finite, non-degenerate authored curve domain.</summary>+public readonly record struct ParameterDomain1+{+ public ParameterDomain1(double minimum, double maximum)+ {+ if (!double.IsFinite(minimum) || !double.IsFinite(maximum) || maximum <= minimum)+ throw new GeometryDefinitionException(GeometryQueryDiagnosticCode.InvalidParameterDomain,+ "A curve parameter domain must be finite and increasing.");+ Minimum = minimum;+ Maximum = maximum;+ }++ public double Minimum { get; }+ public double Maximum { get; }+ public double Length => Maximum - Minimum;+ public bool Contains(double parameter) => double.IsFinite(parameter) && parameter >= Minimum && parameter <= Maximum;+ public double Clamp(double parameter) => double.Clamp(parameter, Minimum, Maximum);+ public double Map(double normalized) => Minimum + double.Clamp(normalized, 0d, 1d) * Length;+}++public sealed record CurveJet1(+ Point3D Point,+ Vector3D Derivative,+ Direction3D? UnitTangent,+ DifferentialSingularityKind Singularity) : IFirstJet3+{+ public bool IsRegular => Singularity == DifferentialSingularityKind.Regular;+}++public sealed record CurvePointExpression(+ SurfaceScalarExpression X,+ SurfaceScalarExpression Y,+ SurfaceScalarExpression Z)+{+ internal void ValidateLengthOutput()+ {+ if (X.Unit != UnitDimension.Length || Y.Unit != UnitDimension.Length || Z.Unit != UnitDimension.Length)+ throw new ArgumentException("Parametric curve point components must all have Length dimension.");+ }+}++/// <summary>One-parameter expression vocabulary backed by the same unit-aware AD tree as patches.</summary>+public static class CurveExpression+{+ public static SurfaceScalarExpression T => SurfaceExpression.U;+ public static SurfaceScalarExpression Number(double value) => SurfaceExpression.Number(value);+ public static SurfaceScalarExpression Length(double millimetres) => SurfaceExpression.Length(millimetres);+ public static SurfaceScalarExpression Add(SurfaceScalarExpression a, SurfaceScalarExpression b) => SurfaceExpression.Add(a, b);+ public static SurfaceScalarExpression Subtract(SurfaceScalarExpression a, SurfaceScalarExpression b) => SurfaceExpression.Subtract(a, b);+ public static SurfaceScalarExpression Multiply(SurfaceScalarExpression a, SurfaceScalarExpression b) => SurfaceExpression.Multiply(a, b);+ public static SurfaceScalarExpression Divide(SurfaceScalarExpression a, SurfaceScalarExpression b) => SurfaceExpression.Divide(a, b);+ public static SurfaceScalarExpression Power(SurfaceScalarExpression a, int exponent) => SurfaceExpression.Power(a, exponent);+ public static SurfaceScalarExpression Sin(SurfaceScalarExpression a) => SurfaceExpression.Sin(a);+ public static SurfaceScalarExpression Cos(SurfaceScalarExpression a) => SurfaceExpression.Cos(a);+}++/// <summary>+/// Authored bounded parametric curve geometry, independent of B-rep ownership and topology.+/// Increasing public parameters always follow the authored direction, even for a reversed native support.+/// </summary>+public sealed class BoundedParametricCurve3+{+ private readonly Func<double, (Point3D Point, Vector3D Derivative)> _evaluator;++ public BoundedParametricCurve3(+ string stableId,+ ParameterDomain1 domain,+ CurvePointExpression pointExpression,+ string provenance,+ string? semanticOwner = null,+ bool isGenerated = false)+ {+ ArgumentNullException.ThrowIfNull(pointExpression);+ pointExpression.ValidateLengthOutput();+ PointExpression = pointExpression;+ _evaluator = t =>+ {+ var x = pointExpression.X.Evaluate(t, 0d);+ var y = pointExpression.Y.Evaluate(t, 0d);+ var z = pointExpression.Z.Evaluate(t, 0d);+ return (new(x.Value, y.Value, z.Value), new(x.Du, y.Du, z.Du));+ };+ Initialize(stableId, domain, provenance, semanticOwner, isGenerated, GeometryRepresentationKind.AnalyticExpression);+ }++ private BoundedParametricCurve3(string stableId, ParameterDomain1 domain,+ Func<double, (Point3D Point, Vector3D Derivative)> evaluator, string provenance,+ string? semanticOwner, bool isGenerated, GeometryRepresentationKind representation,+ bool isPeriodic, string? nativeFamily, int? degree = null)+ {+ _evaluator = evaluator ?? throw new ArgumentNullException(nameof(evaluator));+ IsPeriodic = isPeriodic;+ NativeFamily = nativeFamily;+ Degree = degree;+ Initialize(stableId, domain, provenance, semanticOwner, isGenerated, representation);+ }++ public GeometryIdentity Identity { get; private set; }+ public string StableId => Identity.StableId;+ public ParameterDomain1 Domain { get; private set; }+ public GeometryProvenance Provenance { get; private set; } = null!;+ public GeometryRepresentationKind Representation { get; private set; }+ public CurvePointExpression? PointExpression { get; }+ public bool HasExpressionTree => PointExpression is not null;+ public bool IsPeriodic { get; }+ public string? NativeFamily { get; }+ public int? Degree { get; }++ public Point3D Evaluate(double parameter) => EvaluateJet1(parameter).Point;++ public CurveJet1 EvaluateJet1(double parameter)+ {+ if (!Domain.Contains(parameter))+ throw new ArgumentOutOfRangeException(nameof(parameter), "Parameter must be finite and lie inside the authored curve domain.");+ Point3D point;+ Vector3D derivative;+ try { (point, derivative) = _evaluator(parameter); }+ catch (ArithmeticException) { throw; }+ if (!Finite(point) || !Finite(derivative))+ throw new ArithmeticException("Parametric curve evaluation produced a non-finite value.");+ if (!derivative.TryNormalize(out var normalized))+ return new(point, derivative, null, DifferentialSingularityKind.Singular);+ return new(point, derivative, Direction3D.Create(normalized), DifferentialSingularityKind.Regular);+ }++ public static BoundedParametricCurve3 Procedural(string stableId, ParameterDomain1 domain,+ Func<double, (Point3D Point, Vector3D Derivative)> evaluator, string provenance,+ string? semanticOwner = null, bool isGenerated = false,+ GeometryRepresentationKind representation = GeometryRepresentationKind.ProceduralParametric) =>+ new(stableId, domain, evaluator, provenance, semanticOwner, isGenerated, representation, false, null);++ public static BoundedParametricCurve3 FromCurveGeometry(string stableId, CurveGeometry curve,+ double parameterStart, double parameterEnd, string provenance, string? semanticOwner = null,+ bool isGenerated = false, GeometryRepresentationKind representation = GeometryRepresentationKind.ProceduralParametric)+ {+ ArgumentNullException.ThrowIfNull(curve);+ if (!double.IsFinite(parameterStart) || !double.IsFinite(parameterEnd) || parameterStart == parameterEnd)+ throw new GeometryDefinitionException(GeometryQueryDiagnosticCode.InvalidParameterDomain, "A bounded native curve requires two distinct finite trim parameters.");+ var minimum = double.Min(parameterStart, parameterEnd);+ var maximum = double.Max(parameterStart, parameterEnd);+ var forward = parameterEnd > parameterStart;+ var domain = new ParameterDomain1(minimum, maximum);+ double Native(double publicParameter) => forward ? publicParameter : minimum + maximum - publicParameter;+ var sign = forward ? 1d : -1d;+ return curve.Kind switch+ {+ CurveGeometryKind.Line3 => NativeCurve("Line3", false, t =>+ (curve.Line3!.Value.Evaluate(Native(t)), curve.Line3.Value.Direction.ToVector() * sign)),+ CurveGeometryKind.Circle3 => NativeCurve("Circle3", IsFullPeriod(minimum, maximum), t =>+ (curve.Circle3!.Value.Evaluate(Native(t)), curve.Circle3.Value.Tangent(Native(t)) * sign)),+ CurveGeometryKind.Ellipse3 => NativeCurve("Ellipse3", IsFullPeriod(minimum, maximum), t =>+ {+ var e = curve.Ellipse3!.Value; var n = Native(t);+ var derivative = e.XAxis.ToVector() * (-e.MajorRadius * double.Sin(n)) + e.YAxis.ToVector() * (e.MinorRadius * double.Cos(n));+ return (e.Evaluate(n), derivative * sign);+ }),+ CurveGeometryKind.Hyperbola3 => NativeCurve("Hyperbola3", false, t =>+ (curve.Hyperbola3!.Value.Evaluate(Native(t)), curve.Hyperbola3.Value.FirstDerivative(Native(t)) * sign)),+ CurveGeometryKind.BSpline3 => NativeCurve("BSpline3", curve.BSpline3!.Value.ClosedCurve, t =>+ (curve.BSpline3.Value.Evaluate(Native(t)), curve.BSpline3.Value.EvaluateTangent(Native(t)) * sign)),+ _ => throw new NotSupportedException($"Curve family '{curve.Kind}' has no bounded public adapter.")+ };++ BoundedParametricCurve3 NativeCurve(string family, bool periodic,+ Func<double, (Point3D Point, Vector3D Derivative)> evaluator) =>+ new(stableId, domain, evaluator, provenance, semanticOwner, isGenerated,+ representation, periodic, family, family == "BSpline3" ? curve.BSpline3!.Value.Degree : null);+ }++ public static BoundedParametricCurve3 LineSegment(string stableId, Point3D start, Point3D end, string provenance, string? semanticOwner = null, bool isGenerated = false)+ {+ var delta = end - start;+ if (!delta.TryNormalize(out var direction)) throw new ArgumentException("Line segment endpoints must be distinct.", nameof(end));+ return FromCurveGeometry(stableId, CurveGeometry.FromLine(new(start, Direction3D.Create(direction))), 0d, delta.Length, provenance, semanticOwner, isGenerated);+ }++ private void Initialize(string stableId, ParameterDomain1 domain, string provenance, string? semanticOwner,+ bool isGenerated, GeometryRepresentationKind representation)+ {+ Identity = new(stableId);+ Domain = domain;+ Provenance = new(provenance, semanticOwner, isGenerated);+ Representation = representation;+ }++ private static bool IsFullPeriod(double minimum, double maximum) => double.Abs((maximum - minimum) - 2d * double.Pi) <= 1e-12;+ private static bool Finite(Point3D p) => double.IsFinite(p.X) && double.IsFinite(p.Y) && double.IsFinite(p.Z);+ private static bool Finite(Vector3D v) => double.IsFinite(v.X) && double.IsFinite(v.Y) && double.IsFinite(v.Z);+}diff --git a/Aetheris.Geometry/ParametricGeometry.cs b/Aetheris.Geometry/ParametricGeometry.csindex 2fa920dd..6782abfa 100644--- a/Aetheris.Geometry/ParametricGeometry.cs+++ b/Aetheris.Geometry/ParametricGeometry.cs@@ -25,6 +25,39 @@ public sealed class GeometryDefinitionException : ArgumentExceptionpublic sealed record ParametricDomain(ParameterInterval2 U, ParameterInterval2 V);+public readonly record struct GeometryIdentity+{+ public GeometryIdentity(string stableId)+ {+ ArgumentException.ThrowIfNullOrWhiteSpace(stableId);+ StableId = stableId;+ }+ public string StableId { get; }+ public override string ToString() => StableId;+}++public sealed record GeometryProvenance+{+ public GeometryProvenance(string source, string? semanticOwner = null, bool isGenerated = false)+ {+ ArgumentException.ThrowIfNullOrWhiteSpace(source);+ Source = source;+ SemanticOwner = semanticOwner;+ IsGenerated = isGenerated;+ }+ public string Source { get; }+ public string? SemanticOwner { get; }+ public bool IsGenerated { get; }+}++public enum DifferentialSingularityKind { Regular, Singular, NonFinite, Undefined }++public interface IFirstJet3+{+ Point3D Point { get; }+ DifferentialSingularityKind Singularity { get; }+}+public enum GeometryRepresentationKind{AnalyticExpression,@@ -99,7 +132,10 @@ public sealed record SurfacePointExpression(SurfaceScalarExpression X, SurfaceSc}}-public sealed record SurfaceDifferential(Point3D Point, Vector3D Du, Vector3D Dv, Direction3D? Normal, bool IsSingular);+public sealed record SurfaceDifferential(Point3D Point, Vector3D Du, Vector3D Dv, Direction3D? Normal, bool IsSingular) : IFirstJet3+{+ public DifferentialSingularityKind Singularity => IsSingular ? DifferentialSingularityKind.Singular : DifferentialSingularityKind.Regular;+}/// <summary>Authored rectangular parametric geometry, independent of CAD realization and topology.</summary>public sealed class BoundedParametricPatch3@@ -115,6 +151,7 @@ public sealed class BoundedParametricPatch3ArgumentNullException.ThrowIfNull(pointExpression);pointExpression.ValidateLengthOutput();StableId = stableId; Domain = domain; PointExpression = pointExpression; Provenance = provenance; Representation = representation;+ Identity = new(stableId); GeometryProvenance = new(provenance);}private BoundedParametricPatch3(string stableId, ParametricDomain domain, Func<double, double, SurfaceDifferential> evaluator,@@ -123,12 +160,15 @@ public sealed class BoundedParametricPatch3ArgumentException.ThrowIfNullOrWhiteSpace(stableId);ArgumentException.ThrowIfNullOrWhiteSpace(provenance);StableId = stableId; Domain = domain; Provenance = provenance; Representation = representation; _proceduralEvaluator = evaluator;+ Identity = new(stableId); GeometryProvenance = new(provenance);}public string StableId { get; }+ public GeometryIdentity Identity { get; }public ParametricDomain Domain { get; }public SurfacePointExpression? PointExpression { get; }public string Provenance { get; }+ public GeometryProvenance GeometryProvenance { get; }public GeometryRepresentationKind Representation { get; }public bool HasExpressionTree => PointExpression is not null;@@ -150,4 +190,7 @@ public sealed class BoundedParametricPatch3var singular = !cross.TryNormalize(out var normalized);return new(new(x.Value, y.Value, z.Value), du, dv, singular ? null : Direction3D.Create(normalized), singular);}++ public Point3D EvaluatePoint(double u, double v) => Evaluate(u, v).Point;+ public SurfaceDifferential EvaluateJet1(double u, double v) => Evaluate(u, v);}diff --git a/Aetheris.Piping/Aetheris.Piping.csproj b/Aetheris.Piping/Aetheris.Piping.csprojindex 6931e3bb..0539739a 100644--- a/Aetheris.Piping/Aetheris.Piping.csproj+++ b/Aetheris.Piping/Aetheris.Piping.csproj@@ -3,6 +3,7 @@<ItemGroup><ProjectReference Include="..\Aetheris.Modules\Aetheris.Modules.csproj" /><ProjectReference Include="..\Aetheris.Kernel.Core\Aetheris.Kernel.Core.csproj" />+ <ProjectReference Include="..\Aetheris.Geometry\Aetheris.Geometry.csproj" /><ProjectReference Include="..\Aetheris.Semantics\Aetheris.Semantics.csproj" /></ItemGroup></Project>diff --git a/Aetheris.Piping/PipeRoute.cs b/Aetheris.Piping/PipeRoute.csindex 8e6b8020..c8f3a836 100644--- a/Aetheris.Piping/PipeRoute.cs+++ b/Aetheris.Piping/PipeRoute.cs@@ -6,6 +6,7 @@ using Aetheris.Kernel.Core.Geometry.Surfaces;using Aetheris.Kernel.Core.Math;using Aetheris.Kernel.Core.Topology;using Aetheris.Semantics;+using Aetheris.Geometry;namespace Aetheris.Piping;@@ -17,7 +18,20 @@ public abstract record PipeRouteElement(string StableId)public sealed record Straight(string Id, Point3D Start, Point3D End) : PipeRouteElement(Id);public sealed record PlanarCircularBend(string Id, Point3D Center, double Radius, double AngleRadians) : PipeRouteElement(Id);}-public sealed record PipeRouteIr(string StableId,IReadOnlyList<PipeRouteElement> Elements,string FramePolicy,string BoundaryProvenance);+public sealed record PipeRouteIr(string StableId,IReadOnlyList<PipeRouteElement> Elements,string FramePolicy,string BoundaryProvenance)+{+ /// <summary>Ordered authored centerline pieces; Piping retains ownership of route intent.</summary>+ public IReadOnlyList<BoundedParametricCurve3> CenterlineCurves { get; } = Elements.Select((element, index) => element switch+ {+ PipeRouteElement.Straight line => BoundedParametricCurve3.LineSegment(+ line.StableId, line.Start, line.End, BoundaryProvenance, StableId, isGenerated: true),+ PipeRouteElement.PlanarCircularBend bend => BoundedParametricCurve3.FromCurveGeometry(+ bend.StableId,+ CurveGeometry.FromCircle(new Circle3Curve(bend.Center, Direction3D.Create(new(0, 0, 1)), bend.Radius, Direction3D.Create(new(0, -1, 0)))),+ 0d, bend.AngleRadians, BoundaryProvenance, StableId, isGenerated: true),+ _ => throw new NotSupportedException($"Route element {index} has no bounded curve adapter.")+ }).ToArray();+}public sealed record PipingDiagnostic(string Code,string Message);public sealed record PipeRouteResult(BrepBody? Body,SemanticValue? Semantics,PipeRouteIr? Ir,IReadOnlyList<PipingDiagnostic> Diagnostics){ public bool IsSuccess=>Body is not null&&Semantics is not null&&Diagnostics.Count==0; }diff --git a/Aetheris.Surfacing/Panels.cs b/Aetheris.Surfacing/Panels.csindex 6b434b58..58d6a718 100644--- a/Aetheris.Surfacing/Panels.cs+++ b/Aetheris.Surfacing/Panels.cs@@ -46,18 +46,15 @@ public sealed record PanelEdgeIr(IReadOnlyList<BoundaryProvenance> Provenance,SemanticValue SemanticValue){+ /// <summary>The semantic edge as authored, including its directed parameter orientation.</summary>+ public BoundedParametricCurve3 AuthoredCurve { get; } = BoundedParametricCurve3.FromCurveGeometry(+ StableId + ":curve", Curve, ParameterStart, ParameterEnd,+ string.Join(";", Provenance.Select(item => item.SourceIdentity + ":" + item.Role)), StableId);public Point3D Start => Evaluate(0);public Point3D End => Evaluate(1);public Point3D Evaluate(double normalized){- var parameter = ParameterStart + Math.Clamp(normalized, 0, 1) * (ParameterEnd - ParameterStart);- return Curve.Kind switch- {- CurveGeometryKind.Line3 => Curve.Line3!.Value.Evaluate(parameter),- CurveGeometryKind.Circle3 => Curve.Circle3!.Value.Evaluate(parameter),- CurveGeometryKind.BSpline3 => Curve.BSpline3!.Value.Evaluate(parameter),- _ => throw new NotSupportedException($"Panel edge curve family '{Curve.Kind}' cannot be evaluated.")- };+ return AuthoredCurve.Evaluate(AuthoredCurve.Domain.Map(normalized));}public double Length(int segments = 64)diff --git a/Aetheris.slnx b/Aetheris.slnxindex 0b7d6323..9f683f60 100644--- a/Aetheris.slnx+++ b/Aetheris.slnx@@ -26,6 +26,7 @@<Project Path="tools/Aetheris.Continuum.M4C/Aetheris.Continuum.M4C.csproj" /><Project Path="tools/Aetheris.Forge.M1Evidence/Aetheris.Forge.M1Evidence.csproj" /><Project Path="tools/Aetheris.Geometry.M0Evidence/Aetheris.Geometry.M0Evidence.csproj" />+ <Project Path="tools/Aetheris.Geometry.M1Evidence/Aetheris.Geometry.M1Evidence.csproj" /><Project Path="tools/Aetheris.Continuum.AttentionE0/Aetheris.Continuum.AttentionE0.csproj" /><Project Path="tools/Aetheris.Continuum.AttentionE1/Aetheris.Continuum.AttentionE1.csproj" /><Project Path="Aetheris.Forge/Aetheris.Forge.csproj" />diff --git a/docs/geometry/artifacts/reasoning-m1/adapter-and-dogfood-evidence.md b/docs/geometry/artifacts/reasoning-m1/adapter-and-dogfood-evidence.mdnew file mode 100644index 00000000..573e7c49--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/adapter-and-dogfood-evidence.md@@ -0,0 +1,13 @@+# Adapter and dogfood evidence++The test `ExactKernelFamiliesExposePointsDerivativesTangentsAndDomains` covers bounded line, full circle, arc-like ellipse trim, hyperbola, and non-rational B-spline support. It verifies points, raw derivatives, unit tangents, domains, regularity, B-spline degree, and the circle seam. `ReversedNativeTrimPreservesAuthoredOrientationWithoutChangingSupportIdentity` proves directed orientation.++The expression fixture evaluates a parabola, sinusoid, and helix with automatic derivatives, rejects non-Length coordinates, and detects division by zero. Firmament syntax is deliberately deferred; the public API supplies the usable seam without a language redesign.++Panel proof: `PanelEdgeAndPipeRouteUseTheSameDirectedPublicCurveLayer` creates a real ruled canopy Panel, evaluates its North semantic edge and tangent through `AuthoredCurve`, and verifies semantic-owner provenance. The Panel support is reused; no duplicate edge geometry is authored. Existing `PanelEdgeCorrespondence.SameDirection` / `OppositeDirections` remains mate evidence and does not rewrite curve identity.++Piping proof: the same test lowers a real standard elbow and obtains stable ordered `Line3`, `Circle3`, `Line3` centerline curves. It verifies inlet, bend endpoint, outlet endpoint, piece identities, and ordering while `PipeRouteIr` retains route intent.++Construction proof: `ConstructiveConeSectionHyperbolaKeepsItsBoundedNonAuthoringRole` runs the exact signed-permutation transverse cone/world-Z construction, bounds its hyperbola branch, and evaluates its first jet. This remains a construction-specific result, not a generic intersection-authoring service.++Machine-readable fixed evaluations and jets are in `deterministic-evaluations.json`. Their SHA-256 is in `deterministic-hashes.json`. `performance.md` records smoke timings for evaluation, first jets, expressions, Panel adaptation, and Piping adaptation.diff --git a/docs/geometry/artifacts/reasoning-m1/api-architecture.md b/docs/geometry/artifacts/reasoning-m1/api-architecture.mdnew file mode 100644index 00000000..b01c013c--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/api-architecture.md@@ -0,0 +1,9 @@+# M1 API architecture and domain model++`Aetheris.Geometry` owns `BoundedParametricCurve3`, `BoundedParametricPatch3`, `ParameterDomain1`, `ParametricDomain`, identity, provenance, representation classification, and shared first-jet singularity vocabulary. Kernel.Core owns native analytic supports. Surfacing and Piping adapt semantic objects to the geometry contract and remain owners of CAD intent.++`CurveJet1` and `SurfaceDifferential` both implement the deliberately small `IFirstJet3` (`Point`, `Singularity`). Dimension-specific raw derivatives remain explicit rather than forced into a generic collection. This is the future second-jet seam: M2 should add sibling `CurveJet2` and `PatchJet2` results beside these types, then implement curvature as evidence-producing queries over those results.++`ParameterDomain1` requires finite strictly increasing endpoints, inclusive membership, deterministic value equality, clamping, and normalized mapping. Reversed native trims keep an increasing public domain but map it to decreasing native parameters. Thus a curve's derivative is always aligned with authored public orientation.++Generated and imported/materialized status is carried by `GeometryProvenance.IsGenerated` and `GeometryRepresentationKind`; neither changes query evidence. No new curve-specific representation or predicate enum was introduced.diff --git a/docs/geometry/artifacts/reasoning-m1/curve-representation-audit.md b/docs/geometry/artifacts/reasoning-m1/curve-representation-audit.mdnew file mode 100644index 00000000..de5dc86b--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/curve-representation-audit.md@@ -0,0 +1,19 @@+# Curve representation audit++Audit date: 2026-08-13. Public means accessible across assemblies; bounded refers to the representation itself rather than a B-rep binding that trims an unbounded support.++| Family / area | Visibility and bounds before M1 | Derivatives / domain before M1 | Provenance and consumers | M1 seam |+|---|---|---|---|---|+| `Line3Curve` / Kernel.Core | public, unbounded support | `Evaluate`, unit `Tangent`; no owned domain | B-rep edges, STEP, tessellation, Panels, Piping | bounded distance-parameterized adapter with raw derivative |+| `Circle3Curve` / Kernel.Core | public, periodic support | `Evaluate`, raw `Tangent`; no owned domain | B-rep edges, STEP, Panels, Drawing, Piping | arc/full-circle adapter; explicit periodic seam |+| `Ellipse3Curve` / Kernel.Core | public, periodic support | `Evaluate`; derivative duplicated by consumers or absent | STEP/imported and constructive edges, Drawing/tessellation | bounded adapter supplies analytic first derivative |+| `Hyperbola3Curve` / Kernel.Core | public, unbounded explicit branch | first and second derivatives; trim owned by B-rep | transverse cone-plane construction and tessellation | bounded branch adapter; construction authority unchanged |+| `BSpline3Curve` / Kernel.Core | public, knot-bounded non-rational spline | `Evaluate`, exact polynomial `EvaluateTangent`, knot domain | STEP, Panel boundary extraction, tessellation | knot-domain bounded adapter; degree remains on native support |+| Arc | represented by bounded `Circle3Curve` trim | trim stored separately | Panel ruled boundaries and many B-rep features | same circle adapter with authored trim orientation |+| Helix | no named Kernel.Core curve found | expression support can represent it | no existing CAD consumer | calibration through generic expression-backed curve |+| Profile/path curves | public/internal 2D line/arc/profile records, bounded by endpoints | family-specific evaluation; no shared 3D jet | Firmament Profiles and path authoring | audited only; no broad refactor |+| Panel semantic edges | public exact binding plus separate support/start/end/direction | local family switch in `PanelEdgeIr.Evaluate`; assembly had another switch | Panel mates and assembly G0 validation | `AuthoredCurve` is the directed public seam |+| Pipe centerline | public line/arc/line route elements | geometry recomputed in lowering; no common curve contract | Piping exact materializer and semantics | stable ordered `CenterlineCurves` while route retains ownership |+| STEP / SurfaceMeshIR / Drawing | imported/bound B-rep curve supports | several family switches and sampling paths | serialization, display, projection | consume adapters opportunistically later; no M1-wide rewrite |++Duplicated evaluation logic was confirmed in `PanelEdgeIr.Evaluate`, Firmament assembly Panel-mate evaluation, B-rep tessellation/sampling, SurfaceMeshIR, Drawing projection, and Piping centerline construction. M1 removes the Panel-local switch and defines the shared seam. The other systems remain unchanged to avoid an unrelated refactor; they can adopt the public adapter when their topology/materialization boundary is deliberately revised.diff --git a/docs/geometry/artifacts/reasoning-m1/deterministic-evaluations.json b/docs/geometry/artifacts/reasoning-m1/deterministic-evaluations.jsonnew file mode 100644index 00000000..102f64c6--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/deterministic-evaluations.json@@ -0,0 +1,358 @@+{+ "curves": [+ {+ "identity": "evidence:line",+ "Domain": {+ "Minimum": 0,+ "Maximum": 10,+ "Length": 10+ },+ "Provenance": {+ "Source": "evidence",+ "SemanticOwner": "fixture",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0.5,+ "Point": {+ "X": 0.5,+ "Y": 0,+ "Z": 0+ },+ "Derivative": {+ "X": 1,+ "Y": 0,+ "Z": 0,+ "LengthSquared": 1,+ "Length": 1+ },+ "UnitTangent": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "Singularity": 0+ },+ {+ "identity": "evidence:circle",+ "Domain": {+ "Minimum": 0,+ "Maximum": 6.283185307179586,+ "Length": 6.283185307179586+ },+ "Provenance": {+ "Source": "evidence",+ "SemanticOwner": "fixture",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Circle3",+ "IsPeriodic": true,+ "parameter": 1.5707963267948966,+ "Point": {+ "X": 3.061616997868383E-16,+ "Y": 5,+ "Z": 0+ },+ "Derivative": {+ "X": -5,+ "Y": 3.061616997868383E-16,+ "Z": 0,+ "LengthSquared": 25,+ "Length": 5+ },+ "UnitTangent": {+ "X": -1,+ "Y": 6.123233995736766E-17,+ "Z": 0+ },+ "Singularity": 0+ },+ {+ "identity": "evidence:helix",+ "Domain": {+ "Minimum": 0,+ "Maximum": 6.283185307179586,+ "Length": 6.283185307179586+ },+ "Provenance": {+ "Source": "evidence",+ "SemanticOwner": "fixture",+ "IsGenerated": false+ },+ "Representation": 0,+ "NativeFamily": null,+ "IsPeriodic": false,+ "parameter": 3.141592653589793,+ "Point": {+ "X": -1,+ "Y": 1.2246467991473532E-16,+ "Z": 3.141592653589793+ },+ "Derivative": {+ "X": -1.2246467991473532E-16,+ "Y": -1,+ "Z": 1,+ "LengthSquared": 2,+ "Length": 1.4142135623730951+ },+ "UnitTangent": {+ "X": -8.659560562354934E-17,+ "Y": -0.7071067811865476,+ "Z": 0.7071067811865476+ },+ "Singularity": 0+ }+ ],+ "panel": [+ {+ "identity": "panel:evidence-panel:edge:south:curve",+ "Domain": {+ "Minimum": 0,+ "Maximum": 20.396078054371138,+ "Length": 20.396078054371138+ },+ "Provenance": {+ "Source": "evidence-panel:South",+ "SemanticOwner": "panel:evidence-panel:edge:south",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": -10,+ "Y": -5,+ "Z": 2+ },+ "Derivative": {+ "X": 0.9805806756909202,+ "Y": 0,+ "Z": -0.19611613513818404,+ "LengthSquared": 1.0000000000000002,+ "Length": 1+ },+ "UnitTangent": {+ "X": 0.9805806756909202,+ "Y": 0,+ "Z": -0.19611613513818404+ },+ "Singularity": 0+ },+ {+ "identity": "panel:evidence-panel:edge:east:curve",+ "Domain": {+ "Minimum": 0,+ "Maximum": 10.770329614269007,+ "Length": 10.770329614269007+ },+ "Provenance": {+ "Source": "evidence-panel:East",+ "SemanticOwner": "panel:evidence-panel:edge:east",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": 10,+ "Y": -5,+ "Z": -2+ },+ "Derivative": {+ "X": 0,+ "Y": 0.9284766908852594,+ "Z": 0.3713906763541037,+ "LengthSquared": 1.0000000000000002,+ "Length": 1+ },+ "UnitTangent": {+ "X": 0,+ "Y": 0.9284766908852594,+ "Z": 0.3713906763541037+ },+ "Singularity": 0+ },+ {+ "identity": "panel:evidence-panel:edge:north:curve",+ "Domain": {+ "Minimum": 0,+ "Maximum": 20.396078054371138,+ "Length": 20.396078054371138+ },+ "Provenance": {+ "Source": "evidence-panel:North",+ "SemanticOwner": "panel:evidence-panel:edge:north",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": 10,+ "Y": 5,+ "Z": 2+ },+ "Derivative": {+ "X": -0.9805806756909202,+ "Y": -0,+ "Z": -0.19611613513818404,+ "LengthSquared": 1.0000000000000002,+ "Length": 1+ },+ "UnitTangent": {+ "X": -0.9805806756909202,+ "Y": -0,+ "Z": -0.19611613513818404+ },+ "Singularity": 0+ },+ {+ "identity": "panel:evidence-panel:edge:west:curve",+ "Domain": {+ "Minimum": 0,+ "Maximum": 10.770329614269007,+ "Length": 10.770329614269007+ },+ "Provenance": {+ "Source": "evidence-panel:West",+ "SemanticOwner": "panel:evidence-panel:edge:west",+ "IsGenerated": false+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": -10,+ "Y": 5,+ "Z": -2+ },+ "Derivative": {+ "X": 0,+ "Y": -0.9284766908852594,+ "Z": 0.3713906763541037,+ "LengthSquared": 1.0000000000000002,+ "Length": 1+ },+ "UnitTangent": {+ "X": 0,+ "Y": -0.9284766908852594,+ "Z": 0.3713906763541037+ },+ "Singularity": 0+ }+ ],+ "piping": [+ {+ "identity": "evidence-route:straight-in",+ "Domain": {+ "Minimum": 0,+ "Maximum": 10,+ "Length": 10+ },+ "Provenance": {+ "Source": "centerline and four cross-section rings",+ "SemanticOwner": "evidence-route",+ "IsGenerated": true+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "Derivative": {+ "X": 1,+ "Y": 0,+ "Z": 0,+ "LengthSquared": 1,+ "Length": 1+ },+ "UnitTangent": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "Singularity": 0+ },+ {+ "identity": "evidence-route:bend-0",+ "Domain": {+ "Minimum": 0,+ "Maximum": 1.5707963267948966,+ "Length": 1.5707963267948966+ },+ "Provenance": {+ "Source": "centerline and four cross-section rings",+ "SemanticOwner": "evidence-route",+ "IsGenerated": true+ },+ "Representation": 1,+ "NativeFamily": "Circle3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": 10,+ "Y": 0,+ "Z": 0+ },+ "Derivative": {+ "X": 8,+ "Y": 0,+ "Z": -0,+ "LengthSquared": 64,+ "Length": 8+ },+ "UnitTangent": {+ "X": 1,+ "Y": 0,+ "Z": -0+ },+ "Singularity": 0+ },+ {+ "identity": "evidence-route:straight-out",+ "Domain": {+ "Minimum": 0,+ "Maximum": 10,+ "Length": 10+ },+ "Provenance": {+ "Source": "centerline and four cross-section rings",+ "SemanticOwner": "evidence-route",+ "IsGenerated": true+ },+ "Representation": 1,+ "NativeFamily": "Line3",+ "IsPeriodic": false,+ "parameter": 0,+ "Point": {+ "X": 18,+ "Y": 8,+ "Z": 0+ },+ "Derivative": {+ "X": 0,+ "Y": 1,+ "Z": 0,+ "LengthSquared": 1,+ "Length": 1+ },+ "UnitTangent": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "Singularity": 0+ }+ ]+}diff --git a/docs/geometry/artifacts/reasoning-m1/deterministic-hashes.json b/docs/geometry/artifacts/reasoning-m1/deterministic-hashes.jsonnew file mode 100644index 00000000..a8b0eb2e--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/deterministic-hashes.json@@ -0,0 +1,6 @@+{+ "algorithm": "SHA-256",+ "artifact": "deterministic-evaluations.json",+ "sha256": "bec8477b73723b0562f823787f38727d4596992f0ea2d310bcc377663eca7634",+ "invariant": "Same runtime inputs preserve identities, domains, provenance, ordered pieces, evaluations, and first jets."+}diff --git a/docs/geometry/artifacts/reasoning-m1/performance.md b/docs/geometry/artifacts/reasoning-m1/performance.mdnew file mode 100644index 00000000..fe1932cb--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/performance.md@@ -0,0 +1,11 @@+# M1 performance evidence++Debug net10.0, Stopwatch wall time, 100,000 operations per case. These are smoke measurements, not optimization claims.++| Case | elapsed ms | ns/op |+|---|---:|---:|+| curve-evaluate | 40.743 | 407.4 |+| curve-first-jet | 52.316 | 523.2 |+| expression-first-jet | 51.759 | 517.6 |+| panel-edge-adapter | 40.468 | 404.7 |+| piping-route-adapter | 46.464 | 464.6 |diff --git a/docs/geometry/artifacts/reasoning-m1/validation-report.md b/docs/geometry/artifacts/reasoning-m1/validation-report.mdnew file mode 100644index 00000000..67c68292--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m1/validation-report.md@@ -0,0 +1,16 @@+# AETHERIS-GEOMETRY-REASONING-M1 validation++Validation date: 2026-08-13.++- `dotnet restore Aetheris.slnx`: succeeded; 49 projects accounted for.+- `dotnet build Aetheris.slnx -f net10.0 --no-restore /m:1`: succeeded with 0 warnings and 0 errors.+- `dotnet test Aetheris.slnx -f net10.0 --no-restore --no-build /m:1`: 2,716 passed, 0 failed, 0 skipped across 12 test assemblies. `Aetheris.FrictionLab.Tests` built successfully but contains no discoverable tests.+- `Aetheris.Geometry.Tests`: 19 passed, including 8 M1 curve tests and 11 retained M0 signed-side tests.+- `dotnet run --project Aetheris.CLI -- --help`: succeeded. `modules` inspection reported the expected Surfacing Panel and Piping PipeRoute capabilities. The attempted `modules list` spelling exposed a small CLI friction point: this command lists directly as `modules [--json]`, without a `list` subcommand.+- `git diff --check`: passed.++The durable evidence generator is `tools/Aetheris.Geometry.M1Evidence`. Two consecutive final runs produced the same fixed-output SHA-256, `bec8477b73723b0562f823787f38727d4596992f0ea2d310bcc377663eca7634`. Timing is kept in a separate artifact so machine variation does not affect the determinism hash.++Final Debug/net10.0 smoke measurements over 100,000 operations were approximately 407 ns curve evaluation, 523 ns native first jet, 518 ns expression first jet, 405 ns Panel-edge adapter evaluation, and 465 ns Piping-route adapter evaluation. These are validation measurements, not optimization claims.++The M1 scope deliberately excludes Firmament grammar, piecewise global reparameterization, curve signed-side predicates, second jets, curvature, closest point, distance, generic intersection, contact order, rational B-splines/NURBS, and topology materialization from numerical results.diff --git a/docs/geometry/parametric-curves.md b/docs/geometry/parametric-curves.mdnew file mode 100644index 00000000..0a244931--- /dev/null+++ b/docs/geometry/parametric-curves.md@@ -0,0 +1,40 @@+# Bounded parametric curves++`Aetheris.Geometry.BoundedParametricCurve3` is the public, domain-neutral contract for authored one-parameter geometry in three dimensions. It is the curve sibling of `BoundedParametricPatch3`; it is not necessarily a B-rep edge.++## Contract++Every curve has a stable `GeometryIdentity`, finite increasing `ParameterDomain1`, `GeometryProvenance`, and `GeometryRepresentationKind`. `Evaluate(t)` returns `P(t)`. `EvaluateJet1(t)` returns the raw derivative `dP/dt`, an optional normalized `UnitTangent`, and an explicit `DifferentialSingularityKind`. A zero derivative is `Singular`, not an unexplained null tangent. Out-of-domain and non-finite evaluations are rejected.++Native adapters cover bounded trims of Kernel.Core `Line3`, `Circle3`, `Ellipse3`, `Hyperbola3`, and non-rational `BSpline3`. Line segments retain distance parameterization. Circle and ellipse trims use radians and report `IsPeriodic` only for a complete `2*pi` domain. The endpoints of that domain are the same locus but remain two legal seam parameters. A reversed trim maps the increasing public domain to decreasing native parameters, so derivatives and unit tangents follow authored edge orientation.++```csharp+var segment = BoundedParametricCurve3.LineSegment(+ "guide", new Point3D(0, 0, 0), new Point3D(20, 0, 0),+ "feature:guide", semanticOwner: "feature");+var midpoint = segment.Evaluate(10);+var jet = segment.EvaluateJet1(10);+```++## Expression-backed curves++`CurvePointExpression` uses the same unit-aware scalar expression and forward automatic-differentiation engine as patches. `CurveExpression.T` is initially dimensionless. All three coordinates must have Length dimension; trigonometric arguments must be dimensionless. Canonical parabola, sinusoid, and helix fixtures are covered by the public API tests and persisted evidence.++```csharp+var t = CurveExpression.T;+var mm = CurveExpression.Length(1);+var helix = new BoundedParametricCurve3("helix", new(0, 2 * double.Pi),+ new CurvePointExpression(+ CurveExpression.Multiply(mm, CurveExpression.Cos(t)),+ CurveExpression.Multiply(mm, CurveExpression.Sin(t)),+ CurveExpression.Multiply(mm, t)),+ "scientific:calibration");+```++No Firmament `ParametricCurve` syntax was added in M1. Existing Profiles, paths, Panel boundaries, Surfacing expressions, and PipeRoute already own useful authoring intent; a general textual curve would add syntax without an immediate materialization contract. The public expression API is the future language seam.++## CAD adapters and authority++`PanelEdgeIr.AuthoredCurve` exposes the exact semantic edge direction and owner without duplicating its Kernel.Core support. `PipeRouteIr.CenterlineCurves` exposes stable ordered line–arc–line pieces while `PipeRouteIr` remains the route-intent authority. Constructive bounded hyperbolas can be adapted without becoming a generic intersection or trimming API.++Representation and predicate evidence remain independent. An analytic representation does not imply that a query result is certified. M1 does not add generic closest-point, distance, intersection, contact, NURBS, second-jet, or curvature behavior, and it never promotes numerical intersections into semantic topology.diff --git a/docs/geometry/reasoning.md b/docs/geometry/reasoning.mdindex a558cfe2..5ed41cea 100644--- a/docs/geometry/reasoning.md+++ b/docs/geometry/reasoning.md@@ -1,6 +1,6 @@# Authored geometry reasoning-Status: AETHERIS-GEOMETRY-REASONING-M0+Status: AETHERIS-GEOMETRY-REASONING-M1## Architecture and authority@@ -11,9 +11,9 @@ Aetheris separates four layers:3. optional realization into a supported surface representation;4. BRep topology and STEP serialization.-`Aetheris.Geometry.BoundedParametricPatch3` is the public object at layer 1. It is not a Panel and carries no material, thickness, fabrication, or material-side meaning. `Aetheris.Surfacing.PanelIr` remains the manufacturing/CAD wrapper and exposes its source through `AuthoredPatch`. Expression-authored patches evaluate `P(u,v)`, `dP/du`, `dP/dv`, and a normal where the first jet is non-singular. The derivatives come from forward automatic differentiation; users do not author them independently.+`Aetheris.Geometry.BoundedParametricCurve3` and `BoundedParametricPatch3` are sibling public objects at layer 1. Neither owns B-rep topology or CAD intent. Curves and patches share `GeometryIdentity`, `GeometryProvenance`, `GeometryRepresentationKind`, `IFirstJet3`, and `DifferentialSingularityKind`, while retaining dimension-appropriate `CurveJet1` and `SurfaceDifferential` results. `Aetheris.Surfacing.PanelIr` remains the manufacturing/CAD wrapper and exposes its source through `AuthoredPatch`; each semantic edge exposes its directed source through `AuthoredCurve`.-The M0 domain is rectangular: `u in [u0,u1]` and `v in [v0,v1]`, with finite, strictly increasing limits. Arbitrary trim-domain topology and second jets are deferred.+Patch domains are rectangular and curve domains are one dimensional. All bounds are finite and strictly increasing. A reversed native curve support is mapped into an increasing public domain whose increasing parameter follows the authored edge direction. Arbitrary trim-domain topology and second jets are deferred.## Representation is not evidence@@ -90,3 +90,12 @@ Normal Aetheris code references `Aetheris.Geometry` directly. Forge extension au## LimitationsM0 has no second jets, curvature, contact order, generic tangency certificate, arbitrary trimmed parameter domains, generic curve/surface intersection, CAS, or theorem-specific vocabulary. Procedural patches have public first-jet evaluation but require a future certified evaluator before the interval policy can certify them. No generic predicate materializes intersection curves or mutates topology.++## Differential-geometry ladder++- M0 established bounded patches and evidence-aware signed-side reasoning.+- M1 adds bounded curves and a shared first-jet vocabulary.+- M2 is the intended home for curve `P''`, patch `Puu/Puv/Pvv`, curvature, and Panel G2 evidence.+- Closest point, distance, certified intersection, contact classification, and contact order remain later independent query milestones.++M1 adds no generic curve intersection service. The constructive transverse-cone/world-Z hyperbola remains an admitted construction-specific analytic result; adapting its bounded trim does not grant it topology-authoring authority.diff --git a/tools/Aetheris.Geometry.M1Evidence/Aetheris.Geometry.M1Evidence.csproj b/tools/Aetheris.Geometry.M1Evidence/Aetheris.Geometry.M1Evidence.csprojnew file mode 100644index 00000000..951370b6--- /dev/null+++ b/tools/Aetheris.Geometry.M1Evidence/Aetheris.Geometry.M1Evidence.csproj@@ -0,0 +1,8 @@+<Project Sdk="Microsoft.NET.Sdk">+ <PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup>+ <ItemGroup>+ <ProjectReference Include="..\..\Aetheris.Geometry\Aetheris.Geometry.csproj" />+ <ProjectReference Include="..\..\Aetheris.Surfacing\Aetheris.Surfacing.csproj" />+ <ProjectReference Include="..\..\Aetheris.Piping\Aetheris.Piping.csproj" />+ </ItemGroup>+</Project>diff --git a/tools/Aetheris.Geometry.M1Evidence/Program.cs b/tools/Aetheris.Geometry.M1Evidence/Program.csnew file mode 100644index 00000000..ef8ecb64--- /dev/null+++ b/tools/Aetheris.Geometry.M1Evidence/Program.cs@@ -0,0 +1,69 @@+using System.Diagnostics;+using System.Security.Cryptography;+using System.Text;+using System.Text.Json;+using Aetheris.Geometry;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Geometry.Curves;+using Aetheris.Kernel.Core.Math;+using Aetheris.Piping;+using Aetheris.Surfacing;++var output = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..", "docs", "geometry", "artifacts", "reasoning-m1"));+Directory.CreateDirectory(output);+var x = Direction3D.Create(new Vector3D(1, 0, 0));+var z = Direction3D.Create(new Vector3D(0, 0, 1));+var line = BoundedParametricCurve3.LineSegment("evidence:line", Point3D.Origin, new(10, 0, 0), "evidence", "fixture");+var circle = BoundedParametricCurve3.FromCurveGeometry("evidence:circle", CurveGeometry.FromCircle(new(Point3D.Origin, z, 5, x)), 0, 2 * double.Pi, "evidence", "fixture");+var t = CurveExpression.T; var mm = CurveExpression.Length(1);+var helix = new BoundedParametricCurve3("evidence:helix", new(0, 2 * double.Pi),+ new(CurveExpression.Multiply(mm, CurveExpression.Cos(t)), CurveExpression.Multiply(mm, CurveExpression.Sin(t)), CurveExpression.Multiply(mm, t)), "evidence", "fixture");+var panel = PanelFactory.FromRuled(RuledCanopyTemplate.Create("evidence-panel", 20, 10, 2)).Panel!;+var route = PipeRouteLowering.Lower(StandardPipeElbowTemplate.Create("evidence-route", 4, 10, 8)).Ir!;++var snapshot = new+{+ curves = new[] { Snapshot(line, .5), Snapshot(circle, double.Pi / 2), Snapshot(helix, double.Pi) },+ panel = panel.BoundaryEdges.Select(edge => Snapshot(edge.AuthoredCurve, edge.AuthoredCurve.Domain.Minimum)).ToArray(),+ piping = route.CenterlineCurves.Select(curve => Snapshot(curve, curve.Domain.Minimum)).ToArray()+};+var options = new JsonSerializerOptions { WriteIndented = true };+var json = JsonSerializer.Serialize(snapshot, options) + Environment.NewLine;+File.WriteAllText(Path.Combine(output, "deterministic-evaluations.json"), json, new UTF8Encoding(false));+var hash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(json))).ToLowerInvariant();+File.WriteAllText(Path.Combine(output, "deterministic-hashes.json"), JsonSerializer.Serialize(new+{+ algorithm = "SHA-256", artifact = "deterministic-evaluations.json", sha256 = hash,+ invariant = "Same runtime inputs preserve identities, domains, provenance, ordered pieces, evaluations, and first jets."+}, options) + Environment.NewLine, new UTF8Encoding(false));++const int iterations = 100_000;+var measurements = new[]+{+ Measure("curve-evaluate", iterations, i => line.Evaluate((i % 1000) / 100d)),+ Measure("curve-first-jet", iterations, i => circle.EvaluateJet1((i % 1000) * 2 * double.Pi / 1000)),+ Measure("expression-first-jet", iterations, i => helix.EvaluateJet1((i % 1000) * 2 * double.Pi / 1000)),+ Measure("panel-edge-adapter", iterations, i => panel.BoundaryEdges[i % 4].AuthoredCurve.EvaluateJet1(panel.BoundaryEdges[i % 4].AuthoredCurve.Domain.Minimum)),+ Measure("piping-route-adapter", iterations, i => route.CenterlineCurves[i % 3].EvaluateJet1(route.CenterlineCurves[i % 3].Domain.Minimum))+};+var performance = "# M1 performance evidence\n\nDebug net10.0, Stopwatch wall time, 100,000 operations per case. These are smoke measurements, not optimization claims.\n\n| Case | elapsed ms | ns/op |\n|---|---:|---:|\n" ++ string.Join("\n", measurements.Select(m => $"| {m.Name} | {m.ElapsedMs:F3} | {m.NanosecondsPerOperation:F1} |")) + "\n";+File.WriteAllText(Path.Combine(output, "performance.md"), performance, new UTF8Encoding(false));+Console.WriteLine(JsonSerializer.Serialize(new { output, hash, measurements }, options));++static object Snapshot(BoundedParametricCurve3 curve, double parameter)+{+ var jet = curve.EvaluateJet1(parameter);+ return new { identity = curve.StableId, curve.Domain, curve.Provenance, curve.Representation, curve.NativeFamily, curve.IsPeriodic, parameter, jet.Point, jet.Derivative, jet.UnitTangent, jet.Singularity };+}++static Measurement Measure(string name, int iterations, Action<int> operation)+{+ for (var i = 0; i < 1000; i++) operation(i);+ var stopwatch = Stopwatch.StartNew();+ for (var i = 0; i < iterations; i++) operation(i);+ stopwatch.Stop();+ return new(name, stopwatch.Elapsed.TotalMilliseconds, stopwatch.Elapsed.TotalNanoseconds / iterations);+}++sealed record Measurement(string Name, double ElapsedMs, double NanosecondsPerOperation);