Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Document M5 contact query architecture
Yuechen Li463249c99b1e
diff --git a/Aetheris.Geometry.Tests/ContactQueryTests.cs b/Aetheris.Geometry.Tests/ContactQueryTests.csnew file mode 100644index 00000000..07d6c510--- /dev/null+++ b/Aetheris.Geometry.Tests/ContactQueryTests.cs@@ -0,0 +1,248 @@+using System.Security.Cryptography;+using System.Text;+using System.Text.Json;+using Aetheris.Geometry;+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Math;+using Xunit;++namespace Aetheris.Geometry.Tests;++public sealed class ContactQueryTests+{+ private static readonly Plane3 Z0 = new(Point3D.Origin, Direction3D.Create(new(0, 0, 1)));++ [Fact]+ public void Curve_plane_scalar_calibration_is_exact_only_through_available_evidence()+ {+ var linear = ContactQuery.Between(CurveGraph("t", CurveExpression.T), Z0);+ Assert.Equal(ContactClassification.Transverse, linear.Classification);+ Assert.True(linear.ContactExists);+ Assert.Equal((ContactOrderStatus.Exact, 1), (linear.OrderEvidence.Status, linear.OrderEvidence.Order));++ var quadratic = ContactQuery.Between(CurveGraph("t2", CurveExpression.Power(CurveExpression.T, 2)), Z0);+ Assert.Equal(ContactClassification.Tangent, quadratic.Classification);+ Assert.Equal((ContactOrderStatus.Exact, 2), (quadratic.OrderEvidence.Status, quadratic.OrderEvidence.Order));+ Assert.Equal(ContactDerivativeRelation.ZeroWithinTolerance, quadratic.Witnesses[0].Derivatives.Single(x => x.Order == 1).Relation);++ var quartic = ContactQuery.Between(CurveGraph("t4", CurveExpression.Power(CurveExpression.T, 4)), Z0);+ Assert.Equal(ContactClassification.HigherOrderCandidate, quartic.Classification);+ Assert.Equal(ContactOrderStatus.AtLeast, quartic.OrderEvidence.Status);+ Assert.Equal(2, quartic.OrderEvidence.ProvenLowerBound);+ Assert.Null(quartic.OrderEvidence.Order);+ Assert.Equal(2, quartic.OrderEvidence.MaximumDerivativeOrderChecked);+ Assert.Contains("neither proves order 3/4", quartic.OrderEvidence.Diagnostic);+ }++ [Fact]+ public void Curve_plane_structural_coincidence_has_no_finite_order_and_singular_contact_is_unknown()+ {+ var coincident = ContactQuery.Between(BoundedParametricCurve3.LineSegment("in-plane", new(-1, 0, 0), new(1, 0, 0), "fixture"), Z0);+ Assert.Equal(ContactClassification.Coincident, coincident.Classification);+ Assert.True(coincident.ContactExists);+ Assert.Equal(ContactEvidenceScope.Structural, coincident.Scope);+ Assert.Equal(PredicateEvidenceKind.Structural, coincident.Evidence);+ Assert.Equal(ContactOrderStatus.Unknown, coincident.OrderEvidence.Status);+ Assert.Contains("no finite", coincident.OrderEvidence.Diagnostic);++ var singular = BoundedParametricCurve3.Procedural("singular", new(-1, 1), t => (new(t * t * t, 0, t * t * t * t), new Vector3D(3 * t * t, 0, 4 * t * t * t)), "fixture");+ var result = ContactQuery.Between(singular, Z0);+ Assert.Equal(ContactClassification.Unknown, result.Classification);+ Assert.Null(result.ContactExists);+ Assert.Contains("singular", result.OrderEvidence.Diagnostic, StringComparison.OrdinalIgnoreCase);+ }++ [Fact]+ public void Derivative_zero_is_explicitly_tolerance_qualified_and_parameterization_invariant()+ {+ var near = CurveGraph("near", CurveExpression.Add(CurveExpression.Power(CurveExpression.T, 2),+ CurveExpression.Multiply(CurveExpression.Number(1e-12), CurveExpression.T)));+ var result = ContactQuery.Between(near, Z0, new() { AngularTolerance = 1e-9, LinearTolerance = 1e-8 });+ Assert.False(result.OrderEvidence.Status == ContactOrderStatus.Exact && result.OrderEvidence.Order == 1);+ Assert.Equal(ContactDerivativeRelation.ZeroWithinTolerance, result.Witnesses[0].Derivatives.Single(x => x.Order == 1).Relation);++ var t = CurveExpression.T;+ var reversed = new BoundedParametricCurve3("t2-reversed", new(-1, 1), new(+ CurveExpression.Multiply(CurveExpression.Length(-2), t), CurveExpression.Length(0),+ CurveExpression.Multiply(CurveExpression.Length(1), CurveExpression.Power(t, 2))), "fixture");+ var ordinary = ContactQuery.Between(CurveGraph("t2-ordinary", CurveExpression.Power(t, 2)), Z0);+ var scaled = ContactQuery.Between(reversed, Z0);+ Assert.Equal(ordinary.Classification, scaled.Classification);+ Assert.Equal(ordinary.OrderEvidence.Status, scaled.OrderEvidence.Status);+ Assert.Equal(ordinary.OrderEvidence.Order, scaled.OrderEvidence.Order);+ }++ [Fact]+ public void Patch_plane_uses_whole_domain_side_before_local_derivatives()+ {+ var paraboloid = Graph("paraboloid", SurfaceExpression.Add(PowerU(2), PowerV(2)));+ var tangent = ContactQuery.Between(paraboloid, Z0);+ Assert.Equal(ContactClassification.Tangent, tangent.Classification);+ Assert.Equal(SignedSideClassification.Unknown, tangent.SideRelation);+ Assert.Equal(ContactCurvatureRelation.Separating, tangent.CurvatureRelation);+ Assert.Equal(3, tangent.Witnesses[0].DirectionalObservations.Count);++ var saddle = Graph("saddle", SurfaceExpression.Subtract(PowerU(2), PowerV(2)));+ var crossing = ContactQuery.Between(saddle, Z0);+ Assert.Equal(ContactClassification.Crossing, crossing.Classification);+ Assert.Equal(ContactEvidenceScope.WholeDomain, crossing.Scope);+ Assert.Equal(SignedSideClassification.Crossing, crossing.SideRelation);+ Assert.NotEmpty(crossing.Witnesses);+ Assert.Equal(0, crossing.Witnesses[0].Point.Z, 12);+ }++ [Fact]+ public void Patch_plane_reduces_classification_when_second_jet_is_unavailable()+ {+ var firstOnly = BoundedParametricPatch3.Procedural("first-only", Domain(), (u, v) =>+ {+ var du = new Vector3D(1, 0, 2 * u); var dv = new Vector3D(0, 1, 2 * v);+ return new(new(u, v, u * u + v * v), du, dv, Direction3D.Create(du.Cross(dv)), false);+ }, "fixture");+ var result = ContactQuery.Between(firstOnly, Z0);+ Assert.Equal(ContactClassification.Tangent, result.Classification);+ Assert.Equal(ContactCurvatureRelation.Unavailable, result.CurvatureRelation);+ Assert.Equal(ContactOrderStatus.Unknown, result.OrderEvidence.Status);+ }++ [Fact]+ public void Curve_patch_distinguishes_transverse_tangent_second_order_and_unknown()+ {+ var plane = PlanePatch("plane", Domain());+ var transverse = ContactQuery.Between(BoundedParametricCurve3.LineSegment("pierce", new(0, 0, -1), new(0, 0, 1), "fixture"), plane);+ Assert.Equal(ContactClassification.Transverse, transverse.Classification);++ var tangent = ContactQuery.Between(CurveGraph("curve-bowl", CurveExpression.Power(CurveExpression.T, 2)), plane);+ Assert.Equal(ContactClassification.Tangent, tangent.Classification);+ Assert.Equal(ContactCurvatureRelation.Separating, tangent.CurvatureRelation);+ Assert.Equal(IntersectionRelation.Unknown, tangent.IntersectionRelation);+ Assert.Equal(ContactEvidenceScope.Local, tangent.Scope);++ var compatible = ContactQuery.Between(BoundedParametricCurve3.LineSegment("in-plane-distinct", new(-1, 0, 0), new(1, 0, 0), "fixture"), plane);+ Assert.Equal(ContactClassification.SecondOrderCompatible, compatible.Classification);+ Assert.NotEqual(ContactClassification.Coincident, compatible.Classification);++ var singular = BoundedParametricCurve3.Procedural("singular-cp", new(-1, 1), _ => (Point3D.Origin, Vector3D.Zero), "fixture");+ Assert.Equal(ContactClassification.Unknown, ContactQuery.Between(singular, plane).Classification);+ }++ [Fact]+ public void Patch_patch_uses_geometric_directional_curvature_and_never_integer_order()+ {+ var horizontal = PlanePatch("horizontal", Domain());+ var vertical = VerticalPatch("vertical");+ Assert.Equal(ContactClassification.Transverse, ContactQuery.Between(horizontal, vertical).Classification);++ var compatible = ContactQuery.Between(horizontal, PlanePatch("flat-distinct", Domain()));+ Assert.Equal(ContactClassification.SecondOrderCompatible, compatible.Classification);+ Assert.Equal(3, compatible.Witnesses[0].DirectionalObservations.Count);+ Assert.Equal(ContactOrderStatus.Unknown, compatible.OrderEvidence.Status);+ Assert.NotEqual(ContactClassification.Coincident, compatible.Classification);++ var bowl = Graph("bowl", SurfaceExpression.Add(PowerU(2), PowerV(2)));+ var incompatible = ContactQuery.Between(horizontal, bowl);+ Assert.Equal(ContactClassification.Tangent, incompatible.Classification);+ Assert.Equal(ContactCurvatureRelation.Separating, incompatible.CurvatureRelation);++ var cylinder = Graph("cylinder", PowerU(2));+ var directional = ContactQuery.Between(horizontal, cylinder);+ Assert.Equal(ContactClassification.Tangent, directional.Classification);+ Assert.Equal(ContactCurvatureRelation.DirectionDependent, directional.CurvatureRelation);+ Assert.Contains(directional.Witnesses[0].DirectionalObservations, x => x.Relation == ContactCurvatureRelation.Compatible);+ Assert.Contains(directional.Witnesses[0].DirectionalObservations, x => x.Relation == ContactCurvatureRelation.Separating);++ var structural = ContactQuery.Between(horizontal, PlanePatch("horizontal", Domain()));+ Assert.Equal(ContactClassification.Coincident, structural.Classification);+ Assert.Equal(ContactEvidenceScope.Structural, structural.Scope);+ }++ [Fact]+ public void Patch_patch_classification_is_invariant_to_scaling_reversal_and_umbilics_need_no_principal_direction()+ {+ var a = Graph("base-plane", SurfaceExpression.Length(0));+ var reparameterized = new BoundedParametricPatch3("reparameterized-plane", Domain(), new(+ SurfaceExpression.Multiply(SurfaceExpression.Length(-2), SurfaceExpression.U),+ SurfaceExpression.Multiply(SurfaceExpression.Length(3), SurfaceExpression.V), SurfaceExpression.Length(0)), "fixture");+ var result = ContactQuery.Between(a, reparameterized);+ Assert.Equal(ContactClassification.SecondOrderCompatible, result.Classification);+ Assert.All(result.Witnesses[0].DirectionalObservations, x => Assert.Equal(ContactCurvatureRelation.Compatible, x.Relation));+ }++ [Fact]+ public void Equal_principal_curvature_values_alone_do_not_establish_second_order_identity()+ {+ var xCylinder = Graph("x-cylinder", PowerU(2));+ var yCylinder = Graph("y-cylinder", PowerV(2));+ var ka = CurvatureQuery.Patch(xCylinder, 0, 0);+ var kb = CurvatureQuery.Patch(yCylinder, 0, 0);+ Assert.Equal(ka.K1!.Value, kb.K1!.Value, 10);+ Assert.Equal(ka.K2!.Value, kb.K2!.Value, 10);+ var contact = ContactQuery.Between(xCylinder, yCylinder);+ Assert.NotEqual(ContactClassification.SecondOrderCompatible, contact.Classification);+ Assert.NotEqual(ContactClassification.Coincident, contact.Classification);+ }++ [Fact]+ public void Same_support_identity_with_different_domains_remains_unknown()+ {+ var full = PlanePatch("shared-support", Domain());+ var subset = PlanePatch("shared-support", new(new(-.5, .5), new(-.5, .5)));+ var result = ContactQuery.Between(full, subset);+ Assert.Equal(ContactClassification.Unknown, result.Classification);+ Assert.Null(result.ContactExists);+ Assert.Equal(ContactOrderStatus.Unknown, result.OrderEvidence.Status);+ Assert.Contains(result.Diagnostics, x => x.Code == GeometryQueryDiagnosticCode.AmbiguousOverlap);+ }++ [Fact]+ public void Panel_style_G1_and_G2_fixtures_map_without_replacing_panel_semantics()+ {+ var leftFlat = GraphDomain("panel-left-flat", new(new(-1, 0), new(-1, 1)), SurfaceExpression.Length(0));+ var rightBreak = GraphDomain("panel-right-break", new(new(0, 1), new(-1, 1)), PowerU(2));+ var g1PassG2Fail = ContactQuery.Between(leftFlat, rightBreak);+ Assert.Equal(ContactClassification.Tangent, g1PassG2Fail.Classification);+ Assert.Equal(ContactCurvatureRelation.DirectionDependent, g1PassG2Fail.CurvatureRelation);++ var leftSmooth = GraphDomain("panel-left-smooth", new(new(-1, 0), new(-1, 1)), PowerU(2));+ var rightSmooth = GraphDomain("panel-right-smooth", new(new(0, 1), new(-1, 1)), PowerU(2));+ var g2Pass = ContactQuery.Between(leftSmooth, rightSmooth);+ Assert.Equal(ContactClassification.SecondOrderCompatible, g2Pass.Classification);+ Assert.NotEqual(ContactClassification.Coincident, g2Pass.Classification);+ }++ [Fact]+ public void Contact_is_deterministic_and_cannot_author_topology()+ {+ var body = BrepPrimitives.CreateBox(4, 6, 8).Value;+ var before = Counts(body);+ var a = PlanePatch("firewall-a", Domain()); var b = Graph("firewall-b", PowerU(2));+ var first = JsonSerializer.Serialize(ContactQuery.Between(a, b));+ var second = JsonSerializer.Serialize(ContactQuery.Between(a, b));+ var after = Counts(body);+ Assert.Equal(first, second);+ Assert.Equal(Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(first))), Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(second))));+ Assert.Equal(before, after);+ var result = ContactQuery.Between(a, b);+ Assert.False(result.HasTopologyAuthority);+ Assert.DoesNotContain(result.GetType().GetProperties(), p => p.PropertyType == typeof(BrepBody));+ }++ private static BoundedParametricCurve3 CurveGraph(string id, SurfaceScalarExpression z) => new(id, new(-1, 1), new(+ CurveExpression.Multiply(CurveExpression.Length(1), CurveExpression.T), CurveExpression.Length(0),+ CurveExpression.Multiply(CurveExpression.Length(1), z)), "fixture");+ private static SurfaceScalarExpression PowerU(int exponent) => SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.Power(SurfaceExpression.U, exponent));+ private static SurfaceScalarExpression PowerV(int exponent) => SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.Power(SurfaceExpression.V, exponent));+ private static ParametricDomain Domain() => new(new(-1, 1), new(-1, 1));+ private static BoundedParametricPatch3 Graph(string id, SurfaceScalarExpression z) => GraphDomain(id, Domain(), z);+ private static BoundedParametricPatch3 GraphDomain(string id, ParametricDomain domain, SurfaceScalarExpression z) => new(id, domain, new(+ SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.U),+ SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.V), z), "fixture");+ private static BoundedParametricPatch3 PlanePatch(string id, ParametricDomain domain) => BoundedParametricPatch3.Procedural(id, domain,+ (u, v) => new(new(u, v, 0), new(1, 0, 0), new(0, 1, 0), Direction3D.Create(new(0, 0, 1)), false),+ (u, v) => new(new(u, v, 0), new(1, 0, 0), new(0, 1, 0), Vector3D.Zero, Vector3D.Zero, Vector3D.Zero, DifferentialSingularityKind.Regular), "fixture");+ private static BoundedParametricPatch3 VerticalPatch(string id) => BoundedParametricPatch3.Procedural(id, Domain(),+ (u, v) => new(new(u, 0, v), new(1, 0, 0), new(0, 0, 1), Direction3D.Create(new(0, -1, 0)), false),+ (u, v) => new(new(u, 0, v), new(1, 0, 0), new(0, 0, 1), Vector3D.Zero, Vector3D.Zero, Vector3D.Zero, DifferentialSingularityKind.Regular), "fixture");+ private static (int Vertices, int Edges, int Faces, int Curves, int Surfaces) Counts(BrepBody body)+ => (body.Topology.Vertices.Count(), body.Topology.Edges.Count(), body.Topology.Faces.Count(), body.Geometry.Curves.Count(), body.Geometry.Surfaces.Count());+}diff --git a/Aetheris.Geometry/ContactQuery.cs b/Aetheris.Geometry/ContactQuery.csnew file mode 100644index 00000000..aa39760f--- /dev/null+++ b/Aetheris.Geometry/ContactQuery.cs@@ -0,0 +1,469 @@+using Aetheris.Kernel.Core.Math;++namespace Aetheris.Geometry;++/// <summary>A contact classification. Crossing is retained separately from local transversality because a surface may cross while its first jet is stationary.</summary>+public enum ContactClassification+{+ Disjoint,+ Crossing,+ Transverse,+ Tangent,+ SecondOrderCompatible,+ HigherOrderCandidate,+ Coincident,+ Overlapping,+ Unknown+}++public enum ContactEvidenceScope { Local, WholeDomain, Structural }+public enum ContactOrderStatus { Exact, AtLeast, Candidate, Unknown }+public enum ContactDerivativeRelation { NonZeroWithinTolerance, ZeroWithinTolerance, Unavailable }+public enum ContactTangentRelation { Transverse, Compatible, Singular, Unknown }+public enum ContactNormalRelation { Parallel, NonParallel, Singular, NotApplicable, Unknown }+public enum ContactCurvatureRelation { Separating, Compatible, DirectionDependent, Unavailable, NotApplicable, Unknown }+public enum ContactDistanceRelation { Separated, WithinTolerance, StructuralCoincidence, Unknown }++public sealed record ContactPolicy+{+ public static ContactPolicy Default { get; } = new();+ public double LinearTolerance { get; init; } = 1e-9;+ public double AngularTolerance { get; init; } = 1e-9;+ public double CurvatureTolerance { get; init; } = 1e-9;+ public double ParameterTolerance { get; init; } = 1e-10;+ public int IterationBudget { get; init; } = 96;+ public int SubdivisionBudget { get; init; } = 10_000;+ public int MaximumDerivativeOrderObserved { get; init; } = 2;++ public ContactPolicy Validate()+ {+ Positive(LinearTolerance, nameof(LinearTolerance));+ Positive(AngularTolerance, nameof(AngularTolerance));+ Positive(CurvatureTolerance, nameof(CurvatureTolerance));+ Positive(ParameterTolerance, nameof(ParameterTolerance));+ if (IterationBudget < 1) throw new ArgumentOutOfRangeException(nameof(IterationBudget));+ if (SubdivisionBudget < 16) throw new ArgumentOutOfRangeException(nameof(SubdivisionBudget));+ if (MaximumDerivativeOrderObserved is < 1 or > 2) throw new ArgumentOutOfRangeException(nameof(MaximumDerivativeOrderObserved), "M5 observes only first and second jets.");+ return this;+ }++ internal IntersectionPolicy IntersectionPolicy => new()+ {+ LinearTolerance = LinearTolerance,+ AngularTolerance = AngularTolerance,+ ParameterTolerance = ParameterTolerance,+ IterationBudget = IterationBudget,+ SubdivisionBudget = SubdivisionBudget+ };++ private static void Positive(double value, string name)+ {+ if (!double.IsFinite(value) || value <= 0) throw new ArgumentOutOfRangeException(name);+ }+}++/// <summary>+/// Integer order is populated only for an admitted scalar reduction. In M5 this is curve/plane:+/// g(t)=n dot (C(t)-p). Finite agreement through the maximum checked derivative is only a lower+/// bound/candidate, never proof of the next derivative or of coincidence.+/// </summary>+public sealed record ContactOrderEvidence(+ ContactOrderStatus Status,+ int? Order,+ int? ProvenLowerBound,+ int MaximumDerivativeOrderChecked,+ PredicateEvidenceKind Evidence,+ string Diagnostic);++public sealed record ContactDerivativeObservation(+ int Order,+ double? Value,+ ContactDerivativeRelation Relation,+ PredicateEvidenceKind Evidence,+ string Meaning);++/// <summary>A geometric normal-curvature comparison in a physical tangent direction.</summary>+public sealed record ContactDirectionalObservation(+ Direction3D TangentDirection,+ double? NormalCurvatureA,+ double? NormalCurvatureB,+ double? Difference,+ ContactCurvatureRelation Relation,+ PredicateEvidenceKind Evidence,+ string Diagnostic);++public sealed record ContactWitness(+ Point3D Point,+ Point3D PointOnA,+ Point3D PointOnB,+ IntersectionParameters? ParameterOnA,+ IntersectionParameters? ParameterOnB,+ double Residual,+ ContactTangentRelation TangentRelation,+ ContactNormalRelation NormalRelation,+ ContactCurvatureRelation CurvatureRelation,+ IReadOnlyList<ContactDerivativeObservation> Derivatives,+ IReadOnlyList<ContactDirectionalObservation> DirectionalObservations);++/// <summary>Immutable evidence only. A contact result has no trim, topology, construction, placement, or response authority.</summary>+public sealed record ContactQueryResult(+ ContactClassification Classification,+ PredicateEvidenceKind Evidence,+ ContactEvidenceScope Scope,+ IReadOnlyList<ContactWitness> Witnesses,+ ContactDistanceRelation DistanceRelation,+ IntersectionRelation IntersectionRelation,+ SignedSideClassification? SideRelation,+ ContactTangentRelation TangentRelation,+ ContactNormalRelation NormalRelation,+ ContactCurvatureRelation CurvatureRelation,+ ContactOrderEvidence OrderEvidence,+ ContactPolicy ToleranceUsed,+ IntersectionStatistics Statistics,+ IReadOnlyList<GeometryQueryDiagnostic> Diagnostics,+ IntersectionOperand OperandA,+ IntersectionOperand OperandB,+ string Provenance)+{+ public bool? ContactExists => Classification switch+ {+ ContactClassification.Disjoint => false,+ ContactClassification.Unknown or ContactClassification.Overlapping => null,+ _ => true+ };+ public bool HasTopologyAuthority => false;+}++/// <summary>+/// Evidence-aware local contact classification composed from M0-M4 predicates. It observes authored+/// geometry and never materializes or modifies B-rep topology.+/// </summary>+public static class ContactQuery+{+ public static ContactQueryResult Between(BoundedParametricCurve3 curve, Plane3 plane) => Between(curve, plane, ContactPolicy.Default);+ public static ContactQueryResult Between(BoundedParametricCurve3 curve, Plane3 plane, ContactPolicy policy)+ {+ ArgumentNullException.ThrowIfNull(curve); policy.Validate();+ var intersection = IntersectionQuery.Between(curve, plane, policy.IntersectionPolicy);+ if (intersection.Relation == IntersectionRelation.Disjoint) return Terminal(intersection, policy, ContactClassification.Disjoint, ContactEvidenceScope.WholeDomain);+ if (intersection.Relation == IntersectionRelation.Coincident) return Terminal(intersection, policy, ContactClassification.Coincident, ContactEvidenceScope.Structural);++ var source = intersection.WitnessPoints.OrderBy(w => w.Residual).ThenBy(w => w.ParameterOnA?.T).FirstOrDefault();+ if (source?.ParameterOnA?.T is not double t || source.Residual > policy.LinearTolerance)+ return Unknown(intersection, policy, "No bounded curve/plane contact witness was established.");+ try+ {+ var jet1 = curve.EvaluateJet1(t);+ if (!jet1.IsRegular || jet1.UnitTangent is null)+ return Unknown(intersection, policy, "The curve parameterization is singular at the contact witness.");+ var normal = plane.Normal.ToVector();+ var g1 = normal.Dot(jet1.Derivative);+ var normalizedFirst = normal.Dot(jet1.UnitTangent.Value.ToVector());+ var firstRelation = double.Abs(normalizedFirst) > double.Sin(policy.AngularTolerance)+ ? ContactDerivativeRelation.NonZeroWithinTolerance : ContactDerivativeRelation.ZeroWithinTolerance;+ var derivatives = new List<ContactDerivativeObservation>+ {+ new(0, plane.SignedDistance(jet1.Point), ContactDerivativeRelation.ZeroWithinTolerance, PredicateEvidenceKind.ToleranceBounded, "g(t)=n dot (C(t)-p)"),+ new(1, g1, firstRelation, PredicateEvidenceKind.ToleranceBounded, "g'(t)=n dot C'(t); zero/nonzero is angular-tolerance qualified")+ };+ if (firstRelation == ContactDerivativeRelation.NonZeroWithinTolerance)+ {+ var witness = MakeWitness(source, ContactTangentRelation.Transverse, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.NotApplicable, derivatives, []);+ return Result(intersection, policy, ContactClassification.Transverse, ContactEvidenceScope.Local, [witness],+ ContactTangentRelation.Transverse, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.NotApplicable,+ new(ContactOrderStatus.Exact, 1, 1, 1, PredicateEvidenceKind.ToleranceBounded, "Regular scalar reduction has g=0 within tolerance and definitively nonzero g'."));+ }++ if (policy.MaximumDerivativeOrderObserved < 2 || !curve.SupportsSecondJet)+ {+ derivatives.Add(new(2, null, ContactDerivativeRelation.Unavailable, PredicateEvidenceKind.Unknown, "Second jet is unavailable or excluded by policy."));+ var witness = MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Unavailable, derivatives, []);+ return Result(intersection, policy, ContactClassification.Tangent, ContactEvidenceScope.Local, [witness],+ ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Unavailable,+ new(ContactOrderStatus.AtLeast, null, 2, 1, PredicateEvidenceKind.ToleranceBounded, "Only first-order compatibility is supported; exact order is unknown."));+ }++ var jet2 = curve.EvaluateJet2(t);+ if (!jet2.IsRegular || jet2.FirstDerivative.Length <= 1e-12)+ return Unknown(intersection, policy, "The second jet is singular at the scalar contact witness.");+ var g2 = normal.Dot(jet2.SecondDerivative);+ var invariantSecond = g2 / jet2.FirstDerivative.LengthSquared;+ var secondRelation = double.Abs(invariantSecond) > policy.CurvatureTolerance+ ? ContactDerivativeRelation.NonZeroWithinTolerance : ContactDerivativeRelation.ZeroWithinTolerance;+ derivatives.Add(new(2, g2, secondRelation, PredicateEvidenceKind.ToleranceBounded,+ "g''(t)=n dot C''(t); at stationary contact g''/|C'|^2 is parameterization invariant"));+ if (secondRelation == ContactDerivativeRelation.NonZeroWithinTolerance)+ {+ var witness = MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Separating, derivatives, []);+ return Result(intersection, policy, ContactClassification.Tangent, ContactEvidenceScope.Local, [witness],+ ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Separating,+ new(ContactOrderStatus.Exact, 2, 2, 2, PredicateEvidenceKind.ToleranceBounded, "Regular admitted scalar reduction has g and g' zero within tolerance and definitively nonzero invariant g''."));+ }++ var higher = MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Compatible, derivatives, []);+ return Result(intersection, policy, ContactClassification.HigherOrderCandidate, ContactEvidenceScope.Local, [higher],+ ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.Compatible,+ new(ContactOrderStatus.AtLeast, null, 2, 2, PredicateEvidenceKind.ToleranceBounded,+ "All derivatives available through order 2 vanish within tolerance. This neither proves order 3/4 nor coincidence."));+ }+ catch (Exception ex) when (ex is ArithmeticException or ArgumentOutOfRangeException or NotSupportedException)+ {+ return Unknown(intersection, policy, ex.Message);+ }+ }++ public static ContactQueryResult Between(Plane3 plane, BoundedParametricCurve3 curve) => Swap(Between(curve, plane));+ public static ContactQueryResult Between(Plane3 plane, BoundedParametricCurve3 curve, ContactPolicy policy) => Swap(Between(curve, plane, policy));++ public static ContactQueryResult Between(BoundedParametricPatch3 patch, Plane3 plane) => Between(patch, plane, ContactPolicy.Default);+ public static ContactQueryResult Between(BoundedParametricPatch3 patch, Plane3 plane, ContactPolicy policy)+ {+ ArgumentNullException.ThrowIfNull(patch); policy.Validate();+ var intersection = IntersectionQuery.Between(patch, plane, policy.IntersectionPolicy);+ var side = SignedSideQuery.Query(patch, plane, SignedSidePolicy.Certified(policy.LinearTolerance,+ int.Clamp((int)double.Log2(policy.SubdivisionBudget) / 2, 0, 12), policy.SubdivisionBudget));+ if (intersection.Relation == IntersectionRelation.Disjoint) return Terminal(intersection, policy, ContactClassification.Disjoint, ContactEvidenceScope.WholeDomain, side.Classification);+ if (intersection.Relation == IntersectionRelation.Coincident) return Terminal(intersection, policy, ContactClassification.Coincident, ContactEvidenceScope.Structural, side.Classification);++ var source = BestPatchPlaneWitness(patch, plane, intersection, policy);+ if (side.Classification == SignedSideClassification.Crossing)+ {+ var witnesses = source is null ? Array.Empty<ContactWitness>() : new[] { PatchPlaneWitness(patch, plane, source, policy).Witness };+ return Result(intersection, policy, ContactClassification.Crossing, ContactEvidenceScope.WholeDomain, witnesses,+ witnesses.FirstOrDefault()?.TangentRelation ?? ContactTangentRelation.Unknown,+ witnesses.FirstOrDefault()?.NormalRelation ?? ContactNormalRelation.Unknown,+ witnesses.FirstOrDefault()?.CurvatureRelation ?? ContactCurvatureRelation.Unknown,+ UnknownOrder("A 2D signed-side crossing has no generic scalar contact order.", witnesses.Length == 0 ? 0 : policy.MaximumDerivativeOrderObserved), side.Classification);+ }+ if (source is null) return Unknown(intersection, policy, "SignedSide did not yield a regular zero witness.", side.Classification);+ var observation = PatchPlaneWitness(patch, plane, source, policy);+ if (observation.Witness.TangentRelation == ContactTangentRelation.Transverse)+ return Result(intersection, policy, ContactClassification.Transverse, ContactEvidenceScope.Local, [observation.Witness],+ ContactTangentRelation.Transverse, ContactNormalRelation.NonParallel, ContactCurvatureRelation.NotApplicable,+ UnknownOrder("Patch/plane contact does not use scalar integer multiplicity.", 1), side.Classification);+ var classification = observation.Witness.CurvatureRelation == ContactCurvatureRelation.Compatible+ ? ContactClassification.SecondOrderCompatible : ContactClassification.Tangent;+ return Result(intersection, policy, classification, ContactEvidenceScope.Local, [observation.Witness],+ observation.Witness.TangentRelation, observation.Witness.NormalRelation, observation.Witness.CurvatureRelation,+ UnknownOrder("Patch/plane reports directional differential compatibility, not an integer contact order.", policy.MaximumDerivativeOrderObserved), side.Classification);+ }++ public static ContactQueryResult Between(Plane3 plane, BoundedParametricPatch3 patch) => Swap(Between(patch, plane));+ public static ContactQueryResult Between(Plane3 plane, BoundedParametricPatch3 patch, ContactPolicy policy) => Swap(Between(patch, plane, policy));++ public static ContactQueryResult Between(BoundedParametricCurve3 curve, BoundedParametricPatch3 patch) => Between(curve, patch, ContactPolicy.Default);+ public static ContactQueryResult Between(BoundedParametricCurve3 curve, BoundedParametricPatch3 patch, ContactPolicy policy)+ {+ ArgumentNullException.ThrowIfNull(curve); ArgumentNullException.ThrowIfNull(patch); policy.Validate();+ var intersection = IntersectionQuery.Between(curve, patch, policy.IntersectionPolicy);+ if (intersection.Relation == IntersectionRelation.Disjoint) return Terminal(intersection, policy, ContactClassification.Disjoint, ContactEvidenceScope.WholeDomain);+ var source = intersection.WitnessPoints.OrderBy(w => w.Residual).FirstOrDefault();+ if (source?.ParameterOnA?.T is not double t || source.ParameterOnB?.U is not double u || source.ParameterOnB.V is not double v || source.Residual > policy.LinearTolerance)+ return Unknown(intersection, policy, "M4 did not establish a bounded curve/patch contact witness.");+ try+ {+ var cj = curve.EvaluateJet1(t); var pj = patch.EvaluateJet1(u, v);+ if (!cj.IsRegular || cj.UnitTangent is null || pj.Normal is null) return Unknown(intersection, policy, "A first jet is singular at the contact witness.");+ var dot = pj.Normal.Value.ToVector().Dot(cj.UnitTangent.Value.ToVector());+ if (double.Abs(dot) > double.Sin(policy.AngularTolerance))+ {+ var derivatives = new[] { new ContactDerivativeObservation(1, dot, ContactDerivativeRelation.NonZeroWithinTolerance, PredicateEvidenceKind.ToleranceBounded, "patch normal dot curve unit tangent") };+ var witness = MakeWitness(source, ContactTangentRelation.Transverse, ContactNormalRelation.NotApplicable, ContactCurvatureRelation.NotApplicable, derivatives, []);+ return Result(intersection, policy, ContactClassification.Transverse, ContactEvidenceScope.Local, [witness], ContactTangentRelation.Transverse,+ ContactNormalRelation.NotApplicable, ContactCurvatureRelation.NotApplicable, UnknownOrder("Curve/patch M5 does not assign generic integer order.", 1));+ }+ var directional = CurvePatchCurvature(curve, patch, t, u, v, pj.Normal.Value, policy);+ var curvatureRelation = directional?.Relation ?? ContactCurvatureRelation.Unavailable;+ var tangentDerivatives = new[] { new ContactDerivativeObservation(1, dot, ContactDerivativeRelation.ZeroWithinTolerance, PredicateEvidenceKind.ToleranceBounded, "patch normal dot curve unit tangent") };+ var tangentWitness = MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.NotApplicable, curvatureRelation,+ tangentDerivatives, directional is null ? [] : [directional]);+ var classification = curvatureRelation == ContactCurvatureRelation.Compatible ? ContactClassification.SecondOrderCompatible : ContactClassification.Tangent;+ return Result(intersection, policy, classification, ContactEvidenceScope.Local, [tangentWitness], ContactTangentRelation.Compatible,+ ContactNormalRelation.NotApplicable, curvatureRelation, UnknownOrder("Curve/patch reports first/second-order geometry without generic scalar multiplicity.", policy.MaximumDerivativeOrderObserved));+ }+ catch (Exception ex) when (ex is ArithmeticException or ArgumentOutOfRangeException or NotSupportedException) { return Unknown(intersection, policy, ex.Message); }+ }++ public static ContactQueryResult Between(BoundedParametricPatch3 patch, BoundedParametricCurve3 curve) => Swap(Between(curve, patch));+ public static ContactQueryResult Between(BoundedParametricPatch3 patch, BoundedParametricCurve3 curve, ContactPolicy policy) => Swap(Between(curve, patch, policy));++ public static ContactQueryResult Between(BoundedParametricPatch3 a, BoundedParametricPatch3 b) => Between(a, b, ContactPolicy.Default);+ public static ContactQueryResult Between(BoundedParametricPatch3 a, BoundedParametricPatch3 b, ContactPolicy policy)+ {+ ArgumentNullException.ThrowIfNull(a); ArgumentNullException.ThrowIfNull(b); policy.Validate();+ var intersection = IntersectionQuery.Between(a, b, policy.IntersectionPolicy);+ if (intersection.Relation == IntersectionRelation.Disjoint) return Terminal(intersection, policy, ContactClassification.Disjoint, ContactEvidenceScope.WholeDomain);+ if (intersection.Relation == IntersectionRelation.Coincident) return Terminal(intersection, policy, ContactClassification.Coincident, ContactEvidenceScope.Structural);+ var source = intersection.WitnessPoints.OrderBy(w => w.Residual).FirstOrDefault();+ if (source?.ParameterOnA?.U is not double au || source.ParameterOnA.V is not double av || source.ParameterOnB?.U is not double bu || source.ParameterOnB.V is not double bv || source.Residual > policy.LinearTolerance)+ return Unknown(intersection, policy, "M4 did not establish a bounded patch/patch contact witness.");+ try+ {+ var ja = a.EvaluateJet1(au, av); var jb = b.EvaluateJet1(bu, bv);+ if (ja.Normal is null || jb.Normal is null) return Unknown(intersection, policy, "A patch tangent plane is singular at the contact witness.");+ var dot = ja.Normal.Value.ToVector().Dot(jb.Normal.Value.ToVector());+ var parallel = 1 - double.Abs(dot) <= policy.AngularTolerance;+ if (!parallel)+ {+ var witness = MakeWitness(source, ContactTangentRelation.Transverse, ContactNormalRelation.NonParallel, ContactCurvatureRelation.NotApplicable, [], []);+ return Result(intersection, policy, ContactClassification.Transverse, ContactEvidenceScope.Local, [witness], ContactTangentRelation.Transverse,+ ContactNormalRelation.NonParallel, ContactCurvatureRelation.NotApplicable, UnknownOrder("Patch/patch has no generic scalar integer order.", 1));+ }+ var observations = PatchPatchCurvatures(a, b, au, av, bu, bv, ja, dot, policy);+ var curvature = Combine(observations);+ var witness2 = MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.Parallel, curvature, [], observations);+ var classification = curvature == ContactCurvatureRelation.Compatible ? ContactClassification.SecondOrderCompatible : ContactClassification.Tangent;+ return Result(intersection, policy, classification, ContactEvidenceScope.Local, [witness2], ContactTangentRelation.Compatible,+ ContactNormalRelation.Parallel, curvature, UnknownOrder("Patch/patch reports geometric directional compatibility and never assigns integer multiplicity.", policy.MaximumDerivativeOrderObserved));+ }+ catch (Exception ex) when (ex is ArithmeticException or ArgumentOutOfRangeException or NotSupportedException) { return Unknown(intersection, policy, ex.Message); }+ }++ private static (ContactWitness Witness, ContactCurvatureRelation Curvature) PatchPlaneWitness(BoundedParametricPatch3 patch, Plane3 plane, IntersectionWitness source, ContactPolicy policy)+ {+ var u = source.ParameterOnA!.U!.Value; var v = source.ParameterOnA.V!.Value; var jet = patch.EvaluateJet1(u, v);+ if (jet.Normal is null) return (MakeWitness(source, ContactTangentRelation.Singular, ContactNormalRelation.Singular, ContactCurvatureRelation.Unknown, [], []), ContactCurvatureRelation.Unknown);+ var dot = jet.Normal.Value.ToVector().Dot(plane.Normal.ToVector());+ if (1 - double.Abs(dot) > policy.AngularTolerance)+ return (MakeWitness(source, ContactTangentRelation.Transverse, ContactNormalRelation.NonParallel, ContactCurvatureRelation.NotApplicable, [], []), ContactCurvatureRelation.NotApplicable);+ var directions = TangentBasis(jet.Du, jet.Normal.Value);+ var observations = policy.MaximumDerivativeOrderObserved < 2 ? Array.Empty<ContactDirectionalObservation>() : directions.Select(direction =>+ {+ var k = CurvatureQuery.NormalCurvature(patch, u, v, direction.ToVector());+ if (k.Status != DifferentialQueryStatus.Available) return new ContactDirectionalObservation(direction, k.Curvature, 0d, null, ContactCurvatureRelation.Unavailable, PredicateEvidenceKind.Unknown, k.Diagnostic ?? "Normal curvature unavailable.");+ var value = k.Curvature!.Value * (dot >= 0 ? 1 : -1);+ var relation = double.Abs(value) <= policy.CurvatureTolerance ? ContactCurvatureRelation.Compatible : ContactCurvatureRelation.Separating;+ return new ContactDirectionalObservation(direction, value, 0d, value, relation, PredicateEvidenceKind.ToleranceBounded, "Compared with zero plane normal curvature.");+ }).ToArray();+ var combined = Combine(observations);+ return (MakeWitness(source, ContactTangentRelation.Compatible, ContactNormalRelation.Parallel, combined, [], observations), combined);+ }++ private static ContactDirectionalObservation? CurvePatchCurvature(BoundedParametricCurve3 curve, BoundedParametricPatch3 patch, double t, double u, double v, Direction3D patchNormal, ContactPolicy policy)+ {+ if (policy.MaximumDerivativeOrderObserved < 2 || !curve.SupportsSecondJet || !patch.SupportsSecondJet) return null;+ var curveJet = curve.EvaluateJet2(t); if (!curveJet.IsRegular || !curveJet.FirstDerivative.TryNormalize(out var tangent)) return null;+ var patchK = CurvatureQuery.NormalCurvature(patch, u, v, tangent);+ if (patchK.Status != DifferentialQueryStatus.Available) return new(Direction3D.Create(tangent), null, patchK.Curvature, null, ContactCurvatureRelation.Unavailable, PredicateEvidenceKind.Unknown, patchK.Diagnostic ?? "Patch normal curvature unavailable.");+ var curveNormalCurvature = patchNormal.ToVector().Dot(curveJet.SecondDerivative) / curveJet.FirstDerivative.LengthSquared;+ var difference = curveNormalCurvature - patchK.Curvature!.Value;+ var relation = double.Abs(difference) <= policy.CurvatureTolerance ? ContactCurvatureRelation.Compatible : ContactCurvatureRelation.Separating;+ return new(Direction3D.Create(tangent), curveNormalCurvature, patchK.Curvature, difference, relation, PredicateEvidenceKind.ToleranceBounded,+ "Curve normal acceleration compared with patch normal curvature in the curve tangent direction.");+ }++ private static IReadOnlyList<ContactDirectionalObservation> PatchPatchCurvatures(BoundedParametricPatch3 a, BoundedParametricPatch3 b,+ double au, double av, double bu, double bv, SurfaceDifferential ja, double normalDot, ContactPolicy policy)+ {+ if (policy.MaximumDerivativeOrderObserved < 2 || !a.SupportsSecondJet || !b.SupportsSecondJet) return [];+ var sign = normalDot >= 0 ? 1d : -1d;+ return TangentBasis(ja.Du, ja.Normal!.Value).Select(direction =>+ {+ var ka = CurvatureQuery.NormalCurvature(a, au, av, direction.ToVector());+ var kb = CurvatureQuery.NormalCurvature(b, bu, bv, direction.ToVector());+ if (ka.Status != DifferentialQueryStatus.Available || kb.Status != DifferentialQueryStatus.Available)+ return new ContactDirectionalObservation(direction, ka.Curvature, kb.Curvature, null, ContactCurvatureRelation.Unavailable, PredicateEvidenceKind.Unknown, ka.Diagnostic ?? kb.Diagnostic ?? "Normal curvature unavailable.");+ var orientedB = kb.Curvature!.Value * sign; var difference = ka.Curvature!.Value - orientedB;+ var relation = double.Abs(difference) <= policy.CurvatureTolerance ? ContactCurvatureRelation.Compatible : ContactCurvatureRelation.Separating;+ return new ContactDirectionalObservation(direction, ka.Curvature, orientedB, difference, relation, PredicateEvidenceKind.ToleranceBounded,+ "Geometric normal curvatures compared in a shared physical tangent direction.");+ }).ToArray();+ }++ // Three directions determine the symmetric quadratic normal-curvature form, including its mixed term.+ private static IReadOnlyList<Direction3D> TangentBasis(Vector3D seed, Direction3D normal)+ {+ var projected = seed - normal.ToVector() * seed.Dot(normal.ToVector());+ if (!projected.TryNormalize(out var e1)) return [];+ var e2 = normal.ToVector().Cross(e1); e2.TryNormalize(out e2);+ var diagonal = e1 + e2; diagonal.TryNormalize(out diagonal);+ return [Direction3D.Create(e1), Direction3D.Create(e2), Direction3D.Create(diagonal)];+ }++ private static ContactCurvatureRelation Combine(IReadOnlyList<ContactDirectionalObservation> observations)+ {+ if (observations.Count == 0 || observations.Any(x => x.Relation == ContactCurvatureRelation.Unavailable)) return ContactCurvatureRelation.Unavailable;+ var compatible = observations.Count(x => x.Relation == ContactCurvatureRelation.Compatible);+ if (compatible == observations.Count) return ContactCurvatureRelation.Compatible;+ if (compatible > 0) return ContactCurvatureRelation.DirectionDependent;+ return ContactCurvatureRelation.Separating;+ }++ private static IntersectionWitness? BestPatchPlaneWitness(BoundedParametricPatch3 patch, Plane3 plane, IntersectionResult intersection, ContactPolicy policy)+ {+ var fromIntersection = intersection.WitnessPoints.Where(w => w.ParameterOnA?.U is not null && w.Residual <= policy.LinearTolerance)+ .OrderBy(w => w.Residual).ThenBy(w => CenterDistance(patch, w.ParameterOnA!)).FirstOrDefault();+ if (fromIntersection is not null) return fromIntersection;+ var n = int.Clamp((int)double.Sqrt(policy.SubdivisionBudget), 5, 33); if (n % 2 == 0) n--;+ IntersectionWitness? best = null;+ for (var i = 0; i < n; i++) for (var j = 0; j < n; j++)+ {+ var u = patch.Domain.U.Map(i / (double)(n - 1)); var v = patch.Domain.V.Map(j / (double)(n - 1));+ try+ {+ var point = patch.EvaluatePoint(u, v); var residual = double.Abs(plane.SignedDistance(point));+ if (residual > policy.LinearTolerance) continue;+ var candidate = new IntersectionWitness(point, point, point, new(U: u, V: v), null, residual, IntersectionLocalRelation.Unclassified, null);+ if (best is null || residual < best.Residual || residual == best.Residual && CenterDistance(patch, candidate.ParameterOnA!) < CenterDistance(patch, best.ParameterOnA!)) best = candidate;+ }+ catch (ArithmeticException) { }+ }+ return best;+ }++ private static double CenterDistance(BoundedParametricPatch3 patch, IntersectionParameters p)+ {+ var cu = (patch.Domain.U.Minimum + patch.Domain.U.Maximum) / 2; var cv = (patch.Domain.V.Minimum + patch.Domain.V.Maximum) / 2;+ return double.Pow((p.U ?? cu) - cu, 2) + double.Pow((p.V ?? cv) - cv, 2);+ }++ private static ContactWitness MakeWitness(IntersectionWitness source, ContactTangentRelation tangent, ContactNormalRelation normal,+ ContactCurvatureRelation curvature, IReadOnlyList<ContactDerivativeObservation> derivatives, IReadOnlyList<ContactDirectionalObservation> directions)+ => new(source.Point, source.PointOnA, source.PointOnB, source.ParameterOnA, source.ParameterOnB, source.Residual, tangent, normal, curvature, derivatives, directions);++ private static ContactOrderEvidence UnknownOrder(string diagnostic, int maximumChecked = 0)+ => new(ContactOrderStatus.Unknown, null, null, maximumChecked, PredicateEvidenceKind.Unknown, diagnostic);++ private static ContactQueryResult Terminal(IntersectionResult intersection, ContactPolicy policy, ContactClassification classification,+ ContactEvidenceScope scope, SignedSideClassification? side = null)+ {+ var distance = classification == ContactClassification.Disjoint ? ContactDistanceRelation.Separated : ContactDistanceRelation.StructuralCoincidence;+ var order = UnknownOrder(classification == ContactClassification.Coincident ? "Coincidence has no finite contact order." : "No contact exists.");+ return new(classification, intersection.Evidence, scope, [], distance, intersection.Relation, side, ContactTangentRelation.Unknown,+ ContactNormalRelation.Unknown, ContactCurvatureRelation.NotApplicable, order, policy, intersection.Statistics,+ intersection.Diagnostics, intersection.OperandA, intersection.OperandB, "ContactQuery composed from " + intersection.Provenance);+ }++ private static ContactQueryResult Unknown(IntersectionResult intersection, ContactPolicy policy, string diagnostic, SignedSideClassification? side = null)+ => Result(intersection, policy, ContactClassification.Unknown, ContactEvidenceScope.Local, [], ContactTangentRelation.Unknown,+ ContactNormalRelation.Unknown, ContactCurvatureRelation.Unknown, UnknownOrder(diagnostic), side,+ [.. intersection.Diagnostics, new(GeometryQueryDiagnosticCode.EvidenceUnavailable, diagnostic)]);++ private static ContactQueryResult Result(IntersectionResult intersection, ContactPolicy policy, ContactClassification classification,+ ContactEvidenceScope scope, IReadOnlyList<ContactWitness> witnesses, ContactTangentRelation tangent, ContactNormalRelation normal,+ ContactCurvatureRelation curvature, ContactOrderEvidence order, SignedSideClassification? side = null,+ IReadOnlyList<GeometryQueryDiagnostic>? diagnostics = null)+ => new(classification, classification == ContactClassification.Unknown ? PredicateEvidenceKind.Unknown : intersection.Evidence == PredicateEvidenceKind.Unknown ? PredicateEvidenceKind.ToleranceBounded : intersection.Evidence,+ scope, witnesses, witnesses.Count > 0 ? ContactDistanceRelation.WithinTolerance : ContactDistanceRelation.Unknown,+ intersection.Relation, side, tangent, normal, curvature, order, policy, intersection.Statistics,+ diagnostics ?? intersection.Diagnostics, intersection.OperandA, intersection.OperandB, "ContactQuery composed from " + intersection.Provenance);++ private static ContactQueryResult Swap(ContactQueryResult result) => result with+ {+ OperandA = result.OperandB,+ OperandB = result.OperandA,+ Witnesses = result.Witnesses.Select(w => w with+ {+ PointOnA = w.PointOnB,+ PointOnB = w.PointOnA,+ ParameterOnA = w.ParameterOnB,+ ParameterOnB = w.ParameterOnA,+ DirectionalObservations = w.DirectionalObservations.Select(d => d with+ {+ NormalCurvatureA = d.NormalCurvatureB,+ NormalCurvatureB = d.NormalCurvatureA,+ Difference = d.Difference is null ? null : -d.Difference+ }).ToArray()+ }).ToArray()+ };+}diff --git a/Aetheris.slnx b/Aetheris.slnxindex c95def5b..25f258c4 100644--- a/Aetheris.slnx+++ b/Aetheris.slnx@@ -30,6 +30,7 @@<Project Path="tools/Aetheris.Geometry.M2Evidence/Aetheris.Geometry.M2Evidence.csproj" /><Project Path="tools/Aetheris.Geometry.M3Evidence/Aetheris.Geometry.M3Evidence.csproj" /><Project Path="tools/Aetheris.Geometry.M4Evidence/Aetheris.Geometry.M4Evidence.csproj" />+ <Project Path="tools/Aetheris.Geometry.M5Evidence/Aetheris.Geometry.M5Evidence.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-m5/api-architecture.json b/docs/geometry/artifacts/reasoning-m5/api-architecture.jsonnew file mode 100644index 00000000..6332258d--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/api-architecture.json@@ -0,0 +1,72 @@+{+ "owner": "Aetheris.Geometry",+ "matrix": [+ "Curve-Plane",+ "Patch-Plane",+ "Curve-Patch",+ "Patch-Patch"+ ],+ "classifications": [+ "Disjoint",+ "Crossing",+ "Transverse",+ "Tangent",+ "SecondOrderCompatible",+ "HigherOrderCandidate",+ "Coincident",+ "Overlapping",+ "Unknown"+ ],+ "orderStates": [+ "Exact",+ "AtLeast",+ "Candidate",+ "Unknown"+ ],+ "evidence": [+ "Structural",+ "Certified",+ "ToleranceBounded",+ "Sampled",+ "Heuristic",+ "Unknown"+ ],+ "scopes": [+ "Local",+ "WholeDomain",+ "Structural"+ ],+ "policy": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "resultFields": [+ "Classification",+ "Evidence",+ "Scope",+ "Witnesses",+ "DistanceRelation",+ "IntersectionRelation",+ "SideRelation",+ "TangentRelation",+ "NormalRelation",+ "CurvatureRelation",+ "OrderEvidence",+ "ToleranceUsed",+ "Statistics",+ "Diagnostics",+ "OperandA",+ "OperandB",+ "Provenance",+ "ContactExists",+ "HasTopologyAuthority"+ ],+ "classificationSeparateFromOrder": true,+ "topologyAuthority": false,+ "higherDerivativeDecision": "No CurveJet3/PatchJet3. Exact scalar order is bounded to 1/2; higher observations remain lower bounds/candidates."+}diff --git a/docs/geometry/artifacts/reasoning-m5/contact-audit.md b/docs/geometry/artifacts/reasoning-m5/contact-audit.mdnew file mode 100644index 00000000..584823e7--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/contact-audit.md@@ -0,0 +1,37 @@+# M5 contact and tangency audit++Audit date: 2026-08-13++## Reusable domain-neutral substrate++| Area | Existing behavior | Classification | M5 use |+|---|---|---|---|+| `SignedSideQuery` | Bounded patch/plane strict side, crossing, candidate zeros, interval budgets | generic; whole-domain; certified or sampled | Preserved as the authoritative sidedness sub-result and saddle guard. |+| `ClosestPointQuery` | Bounded point/curve/patch distance and parameter candidates | generic; whole-domain optimization; tolerance-bounded/structural | Reused indirectly through M4; no second locator was introduced. |+| `IntersectionQuery` | Curve/plane, patch/plane, curve/patch, patch/patch relation and non-authoritative witnesses | generic; bounded; mixed certified/tolerance evidence | Direct candidate and relation source for every M5 family. |+| first/second jets | Regularity, tangent planes, authored derivatives | generic; local differential; tolerance interpreted | Used only after an M4 witness is established. |+| `CurvatureQuery` | invariant curve curvature, fundamental forms, principal and arbitrary normal curvature | generic; local differential; tolerance-bounded | Reused for curve/patch and directional surface second-order comparison. |+| Panel G0/G1/G2 | sampled seam position, tangent-plane angle, transverse normal-curvature residual | CAD-specific engineering semantics; sampled | Dogfood mapping only; Panel API remains unchanged. |++## CAD/topology-specific logic left in place++- Kernel BRep Boolean recognizers contain many analytic-family `TangentContact` rejections. They protect supported constructive families and zero-thickness topology; they are not generic differential contact classifiers.+- BRep spatial ray queries mark near-tangent or duplicate/coincident hits for point-in-body voting. This is whole-body/topological classification, not reusable contact order.+- Tessellation tangent deviations and coincident-source checks are approximation/mesh controls.+- Surfacing materializers and fillet/blend routes own construction intent and remain separate.+- STEP recovery normal/tangent checks are imported-geometry reconstruction evidence, not generic proof.++## Continuum and FEA seams++Continuum currently owns region/CutCell classification rather than authored-geometry contact. FEA boundary enforcement owns quadrature, support, and solver policy; it does not implement nonlinear mechanical contact. M5 can later supply candidate classification or interference evidence to these systems, but no solver/contact response was added.++## Dangerous conflations found and prevented++1. M4 `ContactObservation` used the word contact for a local differential observation. M5 leaves it in place for compatibility but gives the public claim separate `ContactClassification` and `ContactOrderEvidence` types.+2. A near-zero closest distance was already correctly prevented from becoming touching/coincidence. M5 preserves this gate.+3. A zero gradient can be mistaken for tangent-only contact. The mandatory `z=u²-v²` fixture makes whole-domain crossing override the stationary origin jet.+4. Equal principal-curvature values alone can hide direction/mixed-term differences. M5 compares normal curvature in three shared physical directions.+5. Panel G2 compatibility can be mistaken for coincidence. M5 reports `SecondOrderCompatible`, never structural coincidence, for distinct identities.+6. Finite floating-point jet agreement can be mistaken for exact higher multiplicity. M5's quartic fixture stops at `AtLeast 2` / `HigherOrderCandidate`.++No broad refactor was required. Generic M5 code is owned by `Aetheris.Geometry`; CAD, BRep, Continuum, and FEA authority boundaries are unchanged.diff --git a/docs/geometry/artifacts/reasoning-m5/curve-patch-fixtures.json b/docs/geometry/artifacts/reasoning-m5/curve-patch-fixtures.jsonnew file mode 100644index 00000000..6841b4f2--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/curve-patch-fixtures.json@@ -0,0 +1,356 @@+{+ "transverse": {+ "Classification": "Transverse",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 1,+ "U": null,+ "V": null+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Transverse",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "NotApplicable",+ "Derivatives": [+ {+ "Order": 1,+ "Value": 1,+ "Relation": "NonZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "patch normal dot curve unit tangent"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Crossing",+ "SideRelation": null,+ "TangentRelation": "Transverse",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 1,+ "Evidence": "Unknown",+ "Diagnostic": "Curve/patch M5 does not assign generic integer order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 5642,+ "Iterations": 59,+ "ClosestPointCalls": 1,+ "CandidateRegions": 6008,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "pierce"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "curve-patch-plane"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from M3 near-zero candidate plus interior transverse tangent/normal evidence",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "tangentSecondOrderSeparating": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "Derivatives": [+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "patch normal dot curve unit tangent"+ }+ ],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Curve normal acceleration compared with patch normal curvature in the curve tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Curve/patch reports first/second-order geometry without generic scalar multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 5642,+ "Iterations": 59,+ "ClosestPointCalls": 1,+ "CandidateRegions": 6008,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "InsufficientSecondJetEvidence",+ "Message": "Near-zero distance and local tangency do not establish whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "curve-parabola"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "curve-patch-plane"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local contact candidate remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "secondOrderCompatible": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0.5,+ "U": null,+ "V": null+ },+ "ParameterOnB": {+ "T": null,+ "U": -0.5,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Compatible",+ "Derivatives": [+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "patch normal dot curve unit tangent"+ }+ ],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Curve normal acceleration compared with patch normal curvature in the curve tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Curve/patch reports first/second-order geometry without generic scalar multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 5642,+ "Iterations": 59,+ "ClosestPointCalls": 1,+ "CandidateRegions": 6008,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "InsufficientSecondJetEvidence",+ "Message": "Near-zero distance and local tangency do not establish whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "in-plane"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "curve-patch-plane"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local contact candidate remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "orderRule": "No generic integer order is assigned for curve/patch in M5."+}diff --git a/docs/geometry/artifacts/reasoning-m5/deterministic-hashes.json b/docs/geometry/artifacts/reasoning-m5/deterministic-hashes.jsonnew file mode 100644index 00000000..1dce778b--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/deterministic-hashes.json@@ -0,0 +1,65 @@+{+ "algorithm": "SHA-256",+ "deterministic": [+ {+ "Name": "curve-patch",+ "stable": true,+ "sha256": "f3b9d4672c541469118ba4581becc7eea45c21f066034ab961e260bf0be233b1",+ "classification": "Tangent",+ "order": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Curve/patch reports first/second-order geometry without generic scalar multiplicity."+ },+ "witnessCount": 1+ },+ {+ "Name": "curve-plane",+ "stable": true,+ "sha256": "c050982b91fae3ac6bc55b7200cc86599efa6c1571b4db969a906565e0c1958d",+ "classification": "Tangent",+ "order": {+ "Status": "Exact",+ "Order": 2,+ "ProvenLowerBound": 2,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Regular admitted scalar reduction has g and g\u0027 zero within tolerance and definitively nonzero invariant g\u0027\u0027."+ },+ "witnessCount": 1+ },+ {+ "Name": "patch-patch",+ "stable": true,+ "sha256": "8110db0c25316fb4596a3f75b996d8ef142800df4df5b0149b260bc4c62308f5",+ "classification": "Tangent",+ "order": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "witnessCount": 1+ },+ {+ "Name": "patch-plane",+ "stable": true,+ "sha256": "59ed47acfd18287e059ce95bd72b3fc3055608801c96fc62d0b7b2ae6061c57c",+ "classification": "Tangent",+ "order": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/plane reports directional differential compatibility, not an integer contact order."+ },+ "witnessCount": 1+ }+ ]+}diff --git a/docs/geometry/artifacts/reasoning-m5/panel-g1-g2-dogfood.json b/docs/geometry/artifacts/reasoning-m5/panel-g1-g2-dogfood.jsonnew file mode 100644index 00000000..46c2fdf0--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/panel-g1-g2-dogfood.json@@ -0,0 +1,293 @@+{+ "g1PassG2Fail": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": -1+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": -1+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 2,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 1,+ "Difference": -1,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "panel-left-flat"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "panel-right-break"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "g2Pass": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": -1,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": -1+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": -1+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 2,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 1,+ "NormalCurvatureB": 1,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "panel-left-smooth"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "panel-right-smooth"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "mapping": {+ "G0": "positional meeting",+ "G1": "Tangent / first-order compatible",+ "G2": "SecondOrderCompatible"+ },+ "panelApiReplaced": false,+ "engineeringOwner": "Aetheris.Surfacing.PanelNetworkValidator"+}diff --git a/docs/geometry/artifacts/reasoning-m5/parameterization-invariance.json b/docs/geometry/artifacts/reasoning-m5/parameterization-invariance.jsonnew file mode 100644index 00000000..2dfb7aee--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/parameterization-invariance.json@@ -0,0 +1,519 @@+{+ "patch": {+ "ordinary": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnA": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnB": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "ParameterOnB": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "ordinary"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "distinct-flat"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "reparameterized": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": -0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": -0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": -0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": -0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "ordinary-2"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "reparameterized"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "invariant": true+ },+ "curve": {+ "ordinary": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "Derivatives": [+ {+ "Order": 0,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g(t)=n dot (C(t)-p)"+ },+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027(t)=n dot C\u0027(t); zero/nonzero is angular-tolerance qualified"+ },+ {+ "Order": 2,+ "Value": 2,+ "Relation": "NonZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027\u0027(t)=n dot C\u0027\u0027(t); at stationary contact g\u0027\u0027/|C\u0027|^2 is parameterization invariant"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Touching",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Exact",+ "Order": 2,+ "ProvenLowerBound": 2,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Regular admitted scalar reduction has g and g\u0027 zero within tolerance and definitively nonzero invariant g\u0027\u0027."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-t2"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from whole-domain one-sided interval plus isolated second-order tangent contact",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "reversedScaled": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": -0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": -0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "Derivatives": [+ {+ "Order": 0,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g(t)=n dot (C(t)-p)"+ },+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027(t)=n dot C\u0027(t); zero/nonzero is angular-tolerance qualified"+ },+ {+ "Order": 2,+ "Value": 2,+ "Relation": "NonZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027\u0027(t)=n dot C\u0027\u0027(t); at stationary contact g\u0027\u0027/|C\u0027|^2 is parameterization invariant"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Touching",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Exact",+ "Order": 2,+ "ProvenLowerBound": 2,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Regular admitted scalar reduction has g and g\u0027 zero within tolerance and definitively nonzero invariant g\u0027\u0027."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "reversed-t2"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from whole-domain one-sided interval plus isolated second-order tangent contact",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "invariant": true+ },+ "principalDirectionsRequired": false+}diff --git a/docs/geometry/artifacts/reasoning-m5/patch-patch-fixtures.json b/docs/geometry/artifacts/reasoning-m5/patch-patch-fixtures.jsonnew file mode 100644index 00000000..3c77209c--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/patch-patch-fixtures.json@@ -0,0 +1,836 @@+{+ "transverse": {+ "Classification": "Transverse",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": -0.5,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": -0.5,+ "V": 0+ },+ "ParameterOnB": {+ "T": null,+ "U": -0.5,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Transverse",+ "NormalRelation": "NonParallel",+ "CurvatureRelation": "NotApplicable",+ "Derivatives": [],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Crossing",+ "SideRelation": null,+ "TangentRelation": "Transverse",+ "NormalRelation": "NonParallel",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 1,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch has no generic scalar integer order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "vertical"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from M3 near-zero candidate plus interior transverse tangent planes",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "firstOrderCompatibleSecondOrderIncompatible": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Separating",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 2,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 2,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 2,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "patch-bowl"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "secondOrderCompatible": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnA": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnB": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "ParameterOnB": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "distinct-flat"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "directional": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": -0.5,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": -0.5,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": -0.5+ },+ "ParameterOnB": {+ "T": null,+ "U": 0,+ "V": -0.5+ },+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 2,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 1,+ "Difference": -1,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Geometric normal curvatures compared in a shared physical tangent direction."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch reports geometric directional compatibility and never assigns integer multiplicity."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Compatible tangent planes or boundary-only contact do not certify overlap or whole-domain touching."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "patch-cylinder"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local patch contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "equalPrincipalValuesNotIdentity": {+ "curvatureA": {+ "GaussianCurvature": 0,+ "MeanCurvature": 1,+ "K1": 2,+ "K2": 0,+ "Direction1": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "Direction2": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "OrientedNormal": {+ "X": 0,+ "Y": 0,+ "Z": 1+ },+ "FirstFundamentalForm": {+ "E": 1,+ "F": 0,+ "G": 1+ },+ "SecondFundamentalForm": {+ "E2": 2,+ "F2": 0,+ "G2": 0+ },+ "Evidence": "ToleranceBounded",+ "Status": "Available",+ "Singularity": "Regular",+ "Diagnostic": null+ },+ "curvatureB": {+ "GaussianCurvature": 0,+ "MeanCurvature": 1,+ "K1": 2,+ "K2": 0,+ "Direction1": {+ "X": -0,+ "Y": -1,+ "Z": -0+ },+ "Direction2": {+ "X": -1,+ "Y": 0,+ "Z": 0+ },+ "OrientedNormal": {+ "X": 0,+ "Y": 0,+ "Z": 1+ },+ "FirstFundamentalForm": {+ "E": 1,+ "F": 0,+ "G": 1+ },+ "SecondFundamentalForm": {+ "E2": 0,+ "F2": 0,+ "G2": 2+ },+ "Evidence": "ToleranceBounded",+ "Status": "Available",+ "Singularity": "Regular",+ "Diagnostic": null+ },+ "contact": {+ "Classification": "Transverse",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0.25+ },+ "PointOnA": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0.25+ },+ "PointOnB": {+ "X": -0.5,+ "Y": -0.5,+ "Z": 0.25+ },+ "ParameterOnA": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "ParameterOnB": {+ "T": null,+ "U": -0.5,+ "V": -0.5+ },+ "Residual": 0,+ "TangentRelation": "Transverse",+ "NormalRelation": "NonParallel",+ "CurvatureRelation": "NotApplicable",+ "Derivatives": [],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Transverse",+ "NormalRelation": "NonParallel",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 1,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/patch has no generic scalar integer order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "ConflictingLocalRelations",+ "Message": "Different bounded candidate regions have conflicting local relations."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "patch-cylinder"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "patch-rotated-cylinder"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from conflicting local candidate evidence",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "law": "Equal principal-curvature values without aligned directions/forms do not establish second-order compatibility or identity."+ },+ "structuralCoincidence": {+ "Classification": "Coincident",+ "Evidence": "Structural",+ "Scope": "Structural",+ "Witnesses": [],+ "DistanceRelation": "StructuralCoincidence",+ "IntersectionRelation": "Coincident",+ "SideRelation": null,+ "TangentRelation": "Unknown",+ "NormalRelation": "Unknown",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 0,+ "Evidence": "Unknown",+ "Diagnostic": "Coincidence has no finite contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 0,+ "Iterations": 0,+ "ClosestPointCalls": 1,+ "CandidateRegions": 0,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from shared authored geometry identity",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "sameIdentityDifferentDomain": {+ "Classification": "Unknown",+ "Evidence": "Unknown",+ "Scope": "Local",+ "Witnesses": [],+ "DistanceRelation": "Unknown",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Unknown",+ "NormalRelation": "Unknown",+ "CurvatureRelation": "Unknown",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 0,+ "Evidence": "Unknown",+ "Diagnostic": "M4 did not establish a bounded patch/patch contact witness."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 0,+ "Iterations": 0,+ "ClosestPointCalls": 1,+ "CandidateRegions": 0,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "AmbiguousOverlap",+ "Message": "Shared support identity with different bounded domains does not establish whole-domain coincidence; partial overlap classification is deferred."+ },+ {+ "Code": "EvidenceUnavailable",+ "Message": "M4 did not establish a bounded patch/patch contact witness."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "horizontal"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from shared support identity has non-identical bounded domains",+ "ContactExists": null,+ "HasTopologyAuthority": false+ },+ "comparison": "Three shared physical tangent directions determine the geometric normal-curvature quadratic form; raw parameter derivatives are not compared."+}diff --git a/docs/geometry/artifacts/reasoning-m5/patch-plane-fixtures.json b/docs/geometry/artifacts/reasoning-m5/patch-plane-fixtures.jsonnew file mode 100644index 00000000..37038b27--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/patch-plane-fixtures.json@@ -0,0 +1,410 @@+{+ "paraboloid": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Separating",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Touching",+ "SideRelation": "Unknown",+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/plane reports directional differential compatibility, not an integer contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 64,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": true+ },+ "Diagnostics": [+ {+ "Code": "SubdivisionBudgetExhausted",+ "Message": "Certification remained inconclusive at depth 6 with leaf budget 10000."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "paraboloid"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from SignedSide-backed whole-domain one-sided interval plus tangent-plane contact",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "saddle": {+ "Classification": "Crossing",+ "Evidence": "Certified",+ "Scope": "WholeDomain",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": -2,+ "NormalCurvatureB": 0,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Crossing",+ "SideRelation": "Crossing",+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "A 2D signed-side crossing has no generic scalar contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 4,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 2,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "saddle"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from SignedSide opposite-side bounded witnesses establish crossing",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "saddleGuard": "Whole-domain SignedSide crossing takes precedence over the stationary first jet at the origin.",+ "flat": {+ "Classification": "SecondOrderCompatible",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": "Unknown",+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "Patch/plane reports directional differential compatibility, not an integer contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 0,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 0,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "UnsupportedCertifiedExpression",+ "Message": "Certified interval evaluation requires an authored expression tree; no sampled fallback was performed."+ },+ {+ "Code": "InsufficientSecondJetEvidence",+ "Message": "SignedSide did not establish a strict side or crossing; local contact evidence is not a global touching proof."+ }+ ],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "flat"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from patch/plane relation remains inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ }+}diff --git a/docs/geometry/artifacts/reasoning-m5/performance.json b/docs/geometry/artifacts/reasoning-m5/performance.jsonnew file mode 100644index 00000000..ce2f203b--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/performance.json@@ -0,0 +1,65 @@+{+ "note": "Calibration only; queries reuse M4 candidates and no optimization campaign was performed.",+ "operations": [+ {+ "Name": "curve-plane",+ "iterations": 25,+ "elapsedMilliseconds": 4.8006,+ "nanosecondsPerQuery": 192024,+ "Classification": "Tangent",+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ }+ },+ {+ "Name": "patch-plane",+ "iterations": 25,+ "elapsedMilliseconds": 37.997,+ "nanosecondsPerQuery": 1519880,+ "Classification": "Tangent",+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 64,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": true+ }+ },+ {+ "Name": "curve-patch",+ "iterations": 25,+ "elapsedMilliseconds": 141.3054,+ "nanosecondsPerQuery": 5652216,+ "Classification": "Tangent",+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 5642,+ "Iterations": 59,+ "ClosestPointCalls": 1,+ "CandidateRegions": 6008,+ "BudgetExhausted": false+ }+ },+ {+ "Name": "patch-patch",+ "iterations": 25,+ "elapsedMilliseconds": 246.394,+ "nanosecondsPerQuery": 9855760,+ "Classification": "Tangent",+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 7186,+ "Iterations": 61,+ "ClosestPointCalls": 1,+ "CandidateRegions": 7690,+ "BudgetExhausted": false+ }+ }+ ]+}diff --git a/docs/geometry/artifacts/reasoning-m5/saddle-zero-gradient-crossing.json b/docs/geometry/artifacts/reasoning-m5/saddle-zero-gradient-crossing.jsonnew file mode 100644index 00000000..7d940a84--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/saddle-zero-gradient-crossing.json@@ -0,0 +1,240 @@+{+ "fixture": "z=u^2-v^2 against z=0",+ "originJet": {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "Du": {+ "X": 1,+ "Y": 0,+ "Z": 0,+ "LengthSquared": 1,+ "Length": 1+ },+ "Dv": {+ "X": 0,+ "Y": 1,+ "Z": 0,+ "LengthSquared": 1,+ "Length": 1+ },+ "Duu": {+ "X": 0,+ "Y": 0,+ "Z": 2,+ "LengthSquared": 4,+ "Length": 2+ },+ "Duv": {+ "X": 0,+ "Y": 0,+ "Z": 0,+ "LengthSquared": 0,+ "Length": 0+ },+ "Dvv": {+ "X": 0,+ "Y": 0,+ "Z": -2,+ "LengthSquared": 4,+ "Length": 2+ },+ "Singularity": "Regular",+ "IsRegular": true+ },+ "signedSide": {+ "Classification": "Crossing",+ "EvidenceKind": "Certified",+ "Policy": {+ "Method": "CertifiedInterval",+ "Tolerance": 1E-09,+ "SamplesU": 9,+ "SamplesV": 9,+ "MaximumSubdivisionDepth": 10,+ "MaximumLeafCount": 4096+ },+ "Domain": {+ "U": {+ "Minimum": -1,+ "Maximum": 1+ },+ "V": {+ "Minimum": -1,+ "Maximum": 1+ }+ },+ "PatchIdentity": "saddle",+ "Provenance": "M5 evidence",+ "Representation": "AnalyticExpression",+ "ObservedMinimum": null,+ "ObservedMaximum": null,+ "CertifiedLowerBound": -1.0000000000000013,+ "CertifiedUpperBound": 1.0000000000000013,+ "Witnesses": [+ {+ "U": -0.375,+ "V": -0.875,+ "Point": {+ "X": -0.375,+ "Y": -0.875,+ "Z": -0.625+ },+ "SignedDistance": -0.625,+ "Kind": "certified-negative-region"+ },+ {+ "U": -0.875,+ "V": -0.375,+ "Point": {+ "X": -0.875,+ "Y": -0.375,+ "Z": 0.625+ },+ "SignedDistance": 0.625,+ "Kind": "certified-positive-region"+ }+ ],+ "Statistics": {+ "SampleCount": 0,+ "LeafCount": 4,+ "ResolvedLeaves": 4,+ "UnresolvedLeaves": 0,+ "MaximumDepthReached": 3+ },+ "Diagnostics": []+ },+ "contact": {+ "Classification": "Crossing",+ "Evidence": "Certified",+ "Scope": "WholeDomain",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": null,+ "U": 0,+ "V": 0+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "Derivatives": [],+ "DirectionalObservations": [+ {+ "TangentDirection": {+ "X": 1,+ "Y": 0,+ "Z": 0+ },+ "NormalCurvatureA": 2,+ "NormalCurvatureB": 0,+ "Difference": 2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0,+ "Y": 1,+ "Z": 0+ },+ "NormalCurvatureA": -2,+ "NormalCurvatureB": 0,+ "Difference": -2,+ "Relation": "Separating",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ },+ {+ "TangentDirection": {+ "X": 0.7071067811865476,+ "Y": 0.7071067811865476,+ "Z": 0+ },+ "NormalCurvatureA": 0,+ "NormalCurvatureB": 0,+ "Difference": 0,+ "Relation": "Compatible",+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Compared with zero plane normal curvature."+ }+ ]+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Crossing",+ "SideRelation": "Crossing",+ "TangentRelation": "Compatible",+ "NormalRelation": "Parallel",+ "CurvatureRelation": "DirectionDependent",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "Unknown",+ "Diagnostic": "A 2D signed-side crossing has no generic scalar contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 0,+ "Subdivisions": 4,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 2,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Patch",+ "Identity": {+ "StableId": "saddle"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from SignedSide opposite-side bounded witnesses establish crossing",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "requiredConclusion": "Crossing"+}diff --git a/docs/geometry/artifacts/reasoning-m5/scalar-contact-fixtures.json b/docs/geometry/artifacts/reasoning-m5/scalar-contact-fixtures.jsonnew file mode 100644index 00000000..5304420e--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/scalar-contact-fixtures.json@@ -0,0 +1,475 @@+{+ "definition": "g(t)=plane.normal dot (C(t)-plane.origin)",+ "exactOrderAdmission": "regular g=0 and first nonzero derivative observed through order 2 under explicit tolerance",+ "finiteJetLaw": "t^4 is AtLeast 2 / HigherOrderCandidate, never exact order 4",+ "results": {+ "t": {+ "Classification": "Transverse",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Transverse",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "NotApplicable",+ "Derivatives": [+ {+ "Order": 0,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g(t)=n dot (C(t)-p)"+ },+ {+ "Order": 1,+ "Value": 1,+ "Relation": "NonZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027(t)=n dot C\u0027(t); zero/nonzero is angular-tolerance qualified"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Crossing",+ "SideRelation": null,+ "TangentRelation": "Transverse",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Exact",+ "Order": 1,+ "ProvenLowerBound": 1,+ "MaximumDerivativeOrderChecked": 1,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Regular scalar reduction has g=0 within tolerance and definitively nonzero g\u0027."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 0,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-t"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from continuous signed scalar has opposite strict-side witnesses",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "t2": {+ "Classification": "Tangent",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "Derivatives": [+ {+ "Order": 0,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g(t)=n dot (C(t)-p)"+ },+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027(t)=n dot C\u0027(t); zero/nonzero is angular-tolerance qualified"+ },+ {+ "Order": 2,+ "Value": 2,+ "Relation": "NonZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027\u0027(t)=n dot C\u0027\u0027(t); at stationary contact g\u0027\u0027/|C\u0027|^2 is parameterization invariant"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Touching",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Separating",+ "OrderEvidence": {+ "Status": "Exact",+ "Order": 2,+ "ProvenLowerBound": 2,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "Regular admitted scalar reduction has g and g\u0027 zero within tolerance and definitively nonzero invariant g\u0027\u0027."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-t2"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from whole-domain one-sided interval plus isolated second-order tangent contact",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "t4": {+ "Classification": "HigherOrderCandidate",+ "Evidence": "ToleranceBounded",+ "Scope": "Local",+ "Witnesses": [+ {+ "Point": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnA": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "PointOnB": {+ "X": 0,+ "Y": 0,+ "Z": 0+ },+ "ParameterOnA": {+ "T": 0,+ "U": null,+ "V": null+ },+ "ParameterOnB": null,+ "Residual": 0,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Compatible",+ "Derivatives": [+ {+ "Order": 0,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g(t)=n dot (C(t)-p)"+ },+ {+ "Order": 1,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027(t)=n dot C\u0027(t); zero/nonzero is angular-tolerance qualified"+ },+ {+ "Order": 2,+ "Value": 0,+ "Relation": "ZeroWithinTolerance",+ "Evidence": "ToleranceBounded",+ "Meaning": "g\u0027\u0027(t)=n dot C\u0027\u0027(t); at stationary contact g\u0027\u0027/|C\u0027|^2 is parameterization invariant"+ }+ ],+ "DirectionalObservations": []+ }+ ],+ "DistanceRelation": "WithinTolerance",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Compatible",+ "NormalRelation": "NotApplicable",+ "CurvatureRelation": "Compatible",+ "OrderEvidence": {+ "Status": "AtLeast",+ "Order": null,+ "ProvenLowerBound": 2,+ "MaximumDerivativeOrderChecked": 2,+ "Evidence": "ToleranceBounded",+ "Diagnostic": "All derivatives available through order 2 vanish within tolerance. This neither proves order 3/4 nor coincidence."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "InsufficientSecondJetEvidence",+ "Message": "A local contact candidate does not establish a whole-domain touching relation."+ }+ ],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-t4"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local curve/plane contact remains globally inconclusive",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "structuralZero": {+ "Classification": "Coincident",+ "Evidence": "Structural",+ "Scope": "Structural",+ "Witnesses": [],+ "DistanceRelation": "StructuralCoincidence",+ "IntersectionRelation": "Coincident",+ "SideRelation": null,+ "TangentRelation": "Unknown",+ "NormalRelation": "Unknown",+ "CurvatureRelation": "NotApplicable",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 0,+ "Evidence": "Unknown",+ "Diagnostic": "Coincidence has no finite contact order."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 0,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-zero"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from analytic-line/plane structural zero over bounded segment",+ "ContactExists": true,+ "HasTopologyAuthority": false+ },+ "singular": {+ "Classification": "Unknown",+ "Evidence": "Unknown",+ "Scope": "Local",+ "Witnesses": [],+ "DistanceRelation": "Unknown",+ "IntersectionRelation": "Unknown",+ "SideRelation": null,+ "TangentRelation": "Unknown",+ "NormalRelation": "Unknown",+ "CurvatureRelation": "Unknown",+ "OrderEvidence": {+ "Status": "Unknown",+ "Order": null,+ "ProvenLowerBound": null,+ "MaximumDerivativeOrderChecked": 0,+ "Evidence": "Unknown",+ "Diagnostic": "The curve parameterization is singular at the contact witness."+ },+ "ToleranceUsed": {+ "LinearTolerance": 1E-09,+ "AngularTolerance": 1E-09,+ "CurvatureTolerance": 1E-09,+ "ParameterTolerance": 1E-10,+ "IterationBudget": 96,+ "SubdivisionBudget": 10000,+ "MaximumDerivativeOrderObserved": 2+ },+ "Statistics": {+ "Samples": 257,+ "Subdivisions": 1,+ "Iterations": 0,+ "ClosestPointCalls": 0,+ "CandidateRegions": 1,+ "BudgetExhausted": false+ },+ "Diagnostics": [+ {+ "Code": "InsufficientSecondJetEvidence",+ "Message": "A local contact candidate does not establish a whole-domain touching relation."+ },+ {+ "Code": "EvidenceUnavailable",+ "Message": "The curve parameterization is singular at the contact witness."+ }+ ],+ "OperandA": {+ "Kind": "Curve",+ "Identity": {+ "StableId": "scalar-singular"+ },+ "Provenance": {+ "Source": "M5 evidence",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "OperandB": {+ "Kind": "Plane",+ "Identity": null,+ "Provenance": {+ "Source": "query-plane",+ "SemanticOwner": null,+ "IsGenerated": false+ }+ },+ "Provenance": "ContactQuery composed from local curve/plane contact remains globally inconclusive",+ "ContactExists": null,+ "HasTopologyAuthority": false+ }+ }+}diff --git a/docs/geometry/artifacts/reasoning-m5/topology-firewall.json b/docs/geometry/artifacts/reasoning-m5/topology-firewall.jsonnew file mode 100644index 00000000..5fb31b46--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/topology-firewall.json@@ -0,0 +1,20 @@+{+ "before": {+ "Vertices": 8,+ "Edges": 12,+ "Faces": 6,+ "Curves": 12,+ "Surfaces": 6+ },+ "after": {+ "Vertices": 8,+ "Edges": 12,+ "Faces": 6,+ "Curves": 12,+ "Surfaces": 6+ },+ "unchanged": true,+ "HasTopologyAuthority": false,+ "resultContainsBrep": false,+ "law": "ContactQuery is evidence-only and cannot create trims, split topology, reposition geometry, or generate response."+}diff --git a/docs/geometry/artifacts/reasoning-m5/validation-report.json b/docs/geometry/artifacts/reasoning-m5/validation-report.jsonnew file mode 100644index 00000000..4842a568--- /dev/null+++ b/docs/geometry/artifacts/reasoning-m5/validation-report.json@@ -0,0 +1,66 @@+{+ "milestone": "AETHERIS-GEOMETRY-REASONING-M5",+ "date": "2026-08-13",+ "status": "success",+ "restore": {+ "command": "dotnet restore Aetheris.slnx",+ "success": true,+ "summary": "All projects are up-to-date for restore."+ },+ "build": {+ "command": "dotnet build Aetheris.slnx -f net10.0 --no-restore /m:1",+ "success": true,+ "warnings": 0,+ "errors": 0+ },+ "tests": {+ "command": "dotnet test Aetheris.slnx -f net10.0 --no-build --no-restore /m:1 --logger console;verbosity=minimal",+ "success": true,+ "passed": 2755,+ "failed": 0,+ "skipped": 0,+ "projects": {+ "Aetheris.CLI.Tests": 362,+ "Aetheris.Collaboration.Tests": 5,+ "Aetheris.Continuum.Tests": 148,+ "Aetheris.FEA.Tests": 12,+ "Aetheris.Forge.Host.Tests": 10,+ "Aetheris.FrictionLab.Tests": 0,+ "Aetheris.Geometry.Tests": 58,+ "Aetheris.Kernel.Core.Tests": 940,+ "Aetheris.Kernel.Firmament.Tests": 1112,+ "Aetheris.Modules.Tests": 37,+ "Aetheris.Semantics.Tests": 9,+ "Aetheris.Server.Tests": 54,+ "Aetheris.Samples.DatabaseDrivenCad.Tests": 8+ },+ "m5FocusedTests": 12,+ "note": "Aetheris.FrictionLab.Tests currently contains no discoverable tests; dotnet test returned success."+ },+ "cliGroundTruth": {+ "helpCommand": "dotnet run --project Aetheris.CLI/Aetheris.CLI.csproj -f net10.0 -- --help",+ "inspectHelpSuccess": true,+ "validateCommand": "aetheris validate docs/geometry/artifacts/reasoning-m0/historical-panel-only.firmament",+ "validation": "valid (0 fatal, 2 warning)",+ "inspectCommand": "aetheris inspect docs/geometry/artifacts/reasoning-m0/historical-panel-only.firmament --json",+ "inspectSuccess": true,+ "model": "HistoricalPanelOnly"+ },+ "scientificCalibration": {+ "t": "Transverse / Exact order 1",+ "t2": "Tangent / Exact order 2",+ "t4": "HigherOrderCandidate / AtLeast order 2; no exact order 4",+ "saddle": "Crossing despite zero gradient at origin",+ "parameterizationInvariant": true,+ "deterministic": true,+ "topologyUnchanged": true+ },+ "evidenceGenerator": {+ "command": "dotnet run --project tools/Aetheris.Geometry.M5Evidence/Aetheris.Geometry.M5Evidence.csproj -f net10.0 --no-restore",+ "success": true+ },+ "diffChecks": {+ "gitDiffCheck": "passed",+ "gitStatusShort": "only the intended M5 source, tests, tool, docs, artifacts, and solution registration are modified/untracked"+ }+}diff --git a/docs/geometry/contact.md b/docs/geometry/contact.mdnew file mode 100644index 00000000..81991c42--- /dev/null+++ b/docs/geometry/contact.md@@ -0,0 +1,79 @@+# Evidence-aware contact reasoning++Status: AETHERIS-GEOMETRY-REASONING-M5++## What contact adds++`IntersectionQuery` answers whether bounded objects are disjoint, cross, touch, coincide, overlap, or remain unresolved. `ContactQuery` consumes that M4 result and asks a different, local differential question: at an established witness, are the objects transverse, first-order compatible, or second-order compatible?++The two claims remain separate. `Tangent` is local. `Touching` is an M4 whole-domain relation requiring no-crossing evidence. A locally tangent curve/patch result can therefore carry `IntersectionRelation.Unknown`; this is intentional, not contradictory.++The public overloads are:++```csharp+ContactQuery.Between(curve, plane);+ContactQuery.Between(patch, plane, policy);+ContactQuery.Between(curve, patch, policy);+ContactQuery.Between(patchA, patchB, policy);+```++Both operand orders are supported. `ContactPolicy` records linear, angular, curvature, and parameter tolerances; iteration/subdivision budgets; and the maximum derivative order observed (one or two in M5). Every result records the policy actually used.++## Result semantics++`ContactQueryResult` reports nullable `ContactExists` (`true`, `false`, or unresolved), classification and evidence, local/whole-domain/structural scope, witnesses and authored parameters, the composed distance/intersection/side relations, tangent and normal relations, curvature observations, separate `ContactOrderEvidence`, statistics, typed diagnostics, identities, and provenance.++- `Disjoint` is a whole-domain conclusion inherited from M4.+- `Crossing` preserves a whole-domain side change that need not be transverse at every zero. The saddle `z=u²-v²` crosses its plane although its gradient vanishes at the origin.+- `Transverse` is a local regular contact whose first-order tangent spaces are not compatible.+- `Tangent` is local first-order compatibility. It says nothing by itself about global touching.+- `SecondOrderCompatible` means geometric normal-curvature forms agree, within policy, in the compared directions. It is not coincidence.+- `HigherOrderCandidate` means every derivative M5 could observe in an admitted scalar reduction vanished within tolerance. It is not an exact higher order.+- `Coincident` requires structural evidence and has no finite contact order.+- `Unknown` is a normal result for missing witnesses, singular parameterizations, unavailable jets, exhausted evidence, or unsupported conclusions.++`ContactEvidenceScope` makes locality explicit. `HasTopologyAuthority` is permanently false.++## Contact order++Classification and order are separate results. `ContactOrderEvidence` has `Exact`, `AtLeast`, `Candidate`, and `Unknown` states, plus an optional order, optional proven lower bound, maximum derivative order checked, evidence, and diagnostic.++M5 admits an exact integer definition only for regular curve/plane scalar reduction:++```text+g(t) = dot(n, C(t)-p0)++order k at t*:+g(t*) = ... = g^(k-1)(t*) = 0+g^k(t*) != 0+```++All zero/nonzero decisions are tolerance-qualified. Regular `g=0`, nonzero `g'` supports local exact order 1. Regular `g=0`, zero-within-tolerance `g'`, and nonzero invariant `g''/|C'|²` supports local exact order 2. If `g`, `g'`, and `g''` all vanish within tolerance, M5 reports at least order 2 / `HigherOrderCandidate`; it does not report order 3 or 4.++Patch/plane, curve/patch, and patch/patch report directional first/second-order geometry without a generic integer multiplicity. General surface/surface contact is not forced into a scalar root model.++> Agreement or vanishing of all derivatives currently available to Aetheris does not imply infinite-order coincidence or establish a higher exact contact order without additional evidence.++## Directional surface evidence++Second-order patch comparisons use `CurvatureQuery.NormalCurvature`, not raw `Duu/Duv/Dvv` across unrelated parameterizations. M5 constructs two orthogonal physical tangent directions and their diagonal. Agreement in those three directions determines the symmetric normal-curvature quadratic form, including the mixed term. Opposite authored normal orientation is aligned before comparison.++Each `ContactDirectionalObservation` records the physical tangent direction, both oriented normal curvatures, their difference, tolerance-qualified relation, evidence, and diagnostic. Partial agreement becomes `DirectionDependent`. Principal directions are not required, so umbilics remain supported.++Curve/patch compares curve normal acceleration with patch normal curvature in the curve tangent direction. Patch/plane compares patch normal curvature with the plane's zero normal curvature.++## Evidence and tolerances++`Structural`, `Certified`, `ToleranceBounded`, `Sampled`, `Heuristic`, and `Unknown` retain their existing meanings. Representation kind is not evidence. Floating-point AD evaluation is tolerance-bounded, not algebraically exact. A derivative below tolerance is explicitly `ZeroWithinTolerance`; its raw value is retained.++The composed result preserves weaker sub-results. For example, certified `SignedSideQuery` intentionally cannot certify touching and may return `Unknown`, while M4's additional interval and local evidence establishes `IntersectionRelation.Touching`. M5 records both instead of silently upgrading SignedSide.++## Authority and consumers++Contact is observational. It cannot split topology, create trims, modify a BRep, reposition geometry, generate fillets, or produce collision response. Panel retains G0/G1/G2 engineering semantics: G1 maps to local first-order compatibility and G2 maps to second-order compatibility, but `ContactQuery` does not replace `PanelNetworkValidator`.++Future Continuum CutCell, FEA mechanical-contact candidate, and interference consumers can use classification as evidence input. M5 does not implement nonlinear contact mechanics or boundary authoring.++## Future work++Possible later work includes higher-order curve jets, certified higher contact order for admitted scalar/algebraic families, specialized algebraic contact, and certified overlap loci. M5 intentionally does not add arbitrary-order AD or patch third jets.diff --git a/docs/geometry/intersection.md b/docs/geometry/intersection.mdindex c94a7247..02bad8f1 100644--- a/docs/geometry/intersection.md+++ b/docs/geometry/intersection.md@@ -44,9 +44,8 @@ Curve/patch and patch/patch first call M3 `ClosestPointQuery`. A stabilized dist`IntersectionWitness` is evidence only. `WitnessesAreAuthoritativeTrims` is permanently false, and the public result contains no BRep, trim, Boolean, face, edge, or mutation operation. No witness curves are emitted in M4, avoiding accidental trim reuse.-`ContactObservation` records tangent/normal and available second-jet observations. It deliberately does not expose multiplicity or contact order. A future `ContactClassification` / `ContactOrder` query can consume these observations without changing intersection authority.+`ContactObservation` records tangent/normal and available second-jet observations. It deliberately does not expose multiplicity or contact order. M5 `ContactQuery` consumes M4 witnesses and relations, returns separate `ContactClassification` and `ContactOrderEvidence`, and does not change intersection authority. See [contact.md](contact.md).## Tolerance and determinismTolerance is interpretation, not coordinate rounding. Residuals remain raw. Stable traversal orders are used for samples, subdivisions, bisection, candidate lattices, witnesses, and diagnostics. Budget exhaustion returns `Unknown` rather than a local answer that ignores unresolved regions.-diff --git a/docs/geometry/reasoning.md b/docs/geometry/reasoning.mdindex a446bd83..445d1306 100644--- a/docs/geometry/reasoning.md+++ b/docs/geometry/reasoning.md@@ -1,6 +1,6 @@# Authored geometry reasoning-Status: AETHERIS-GEOMETRY-REASONING-M4+Status: AETHERIS-GEOMETRY-REASONING-M5## Architecture and authority@@ -101,12 +101,13 @@ The public domain-neutral query ladder is now:2. `ClosestPointQuery`: bounded unsigned distance and candidate parameters for points, curves, and patches.3. `CurvatureQuery`: local first/second-order differential observations.4. `IntersectionQuery`: bounded relation evidence for curve/plane, patch/plane, curve/patch, and patch/patch.+5. `ContactQuery`: local first/second-order classification and separately bounded contact-order evidence.-Intersection composes the earlier layers. Patch/plane delegates whole-domain classification to SignedSide. Curve/patch and patch/patch use closest distance as the first gate, then jets only to classify a local candidate. Local differential evidence never silently becomes a global touching proof. See [intersection.md](intersection.md).+Intersection composes the earlier layers. Contact then composes Intersection, SignedSide, and Curvature without adding a second witness locator. Patch/plane preserves whole-domain sidedness before interpreting a local jet. Curve/patch and patch/patch use M4 distance/intersection candidates, then compare geometric normal curvature in shared physical directions. Local differential evidence never silently becomes a global touching proof. See [intersection.md](intersection.md) and [contact.md](contact.md).## Limitations-M4 does not add contact order/multiplicity, arbitrary trimmed parameter domains, traced surface/surface intersection curves, CAS, rational splines/NURBS, or theorem-specific vocabulary. `Overlapping` is reserved but is not inferred numerically. Section and boundary procedural patches remain first-jet-only unless an honest second evaluator is supplied. No reasoning query materializes intersection curves or mutates topology.+M5 admits exact order 1/2 only for regular curve/plane scalar reductions. It does not add arbitrary higher contact order, patch integer multiplicity, arbitrary trimmed parameter domains, traced surface/surface intersection curves, CAS, rational splines/NURBS, or theorem-specific vocabulary. `Overlapping` is reserved but is not inferred numerically. Section and boundary procedural patches remain first-jet-only unless an honest second evaluator is supplied. No reasoning query materializes contact/intersection curves or mutates topology.## Differential-geometry ladder@@ -115,6 +116,7 @@ M4 does not add contact order/multiplicity, arbitrary trimmed parameter domains,- M2 adds curve `P''`, patch `Puu/Puv/Pvv`, curvature, and sampled Panel G1/G2 evidence.- M3 adds closest point/distance across authored points, curves, and patches.- M4 adds bounded evidence-aware intersection predicates and preserves the topology firewall.-- A future milestone may add `ContactClassification` / `ContactOrder` as a separate query over local observations.+- M5 adds separate `ContactClassification` and `ContactOrderEvidence`, directional surface observations, and explicit local/whole-domain/structural scope.+- Future work may add higher-order jets or certified algebraic contact for narrowly admitted families; finite available jets never imply infinite order.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.M5Evidence/Aetheris.Geometry.M5Evidence.csproj b/tools/Aetheris.Geometry.M5Evidence/Aetheris.Geometry.M5Evidence.csprojnew file mode 100644index 00000000..a2a93ce7--- /dev/null+++ b/tools/Aetheris.Geometry.M5Evidence/Aetheris.Geometry.M5Evidence.csproj@@ -0,0 +1,12 @@+<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" />+ </ItemGroup>+</Project>diff --git a/tools/Aetheris.Geometry.M5Evidence/Program.cs b/tools/Aetheris.Geometry.M5Evidence/Program.csnew file mode 100644index 00000000..c797c380--- /dev/null+++ b/tools/Aetheris.Geometry.M5Evidence/Program.cs@@ -0,0 +1,197 @@+using System.Diagnostics;+using System.Security.Cryptography;+using System.Text;+using System.Text.Json;+using System.Text.Json.Serialization;+using Aetheris.Geometry;+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Math;+using Aetheris.Surfacing;++var output = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..", "docs", "geometry", "artifacts", "reasoning-m5"));+Directory.CreateDirectory(output);+var json = new JsonSerializerOptions { WriteIndented = true }; json.Converters.Add(new JsonStringEnumConverter());+var z0 = new Plane3(Point3D.Origin, Direction3D.Create(new(0, 0, 1)));+var t = CurveExpression.T;++var scalar = new Dictionary<string, ContactQueryResult>+{+ ["t"] = ContactQuery.Between(CurveGraph("scalar-t", t), z0),+ ["t2"] = ContactQuery.Between(CurveGraph("scalar-t2", CurveExpression.Power(t, 2)), z0),+ ["t4"] = ContactQuery.Between(CurveGraph("scalar-t4", CurveExpression.Power(t, 4)), z0),+ ["structuralZero"] = ContactQuery.Between(BoundedParametricCurve3.LineSegment("scalar-zero", new(-1, 0, 0), new(1, 0, 0), "M5 evidence"), z0),+ ["singular"] = ContactQuery.Between(BoundedParametricCurve3.Procedural("scalar-singular", new(-1, 1), x => (new(x * x * x, 0, x * x * x * x), new Vector3D(3 * x * x, 0, 4 * x * x * x)), "M5 evidence"), z0)+};+Write("scalar-contact-fixtures.json", new+{+ definition = "g(t)=plane.normal dot (C(t)-plane.origin)",+ exactOrderAdmission = "regular g=0 and first nonzero derivative observed through order 2 under explicit tolerance",+ finiteJetLaw = "t^4 is AtLeast 2 / HigherOrderCandidate, never exact order 4",+ results = scalar+});++var paraboloid = Graph("paraboloid", SurfaceExpression.Add(PowerU(2), PowerV(2)));+var saddle = Graph("saddle", SurfaceExpression.Subtract(PowerU(2), PowerV(2)));+Write("patch-plane-fixtures.json", new+{+ paraboloid = ContactQuery.Between(paraboloid, z0),+ saddle = ContactQuery.Between(saddle, z0),+ saddleGuard = "Whole-domain SignedSide crossing takes precedence over the stationary first jet at the origin.",+ flat = ContactQuery.Between(PlanePatch("flat", Domain()), z0)+});+Write("saddle-zero-gradient-crossing.json", new+{+ fixture = "z=u^2-v^2 against z=0",+ originJet = saddle.EvaluateJet2(0, 0),+ signedSide = SignedSideQuery.Query(saddle, z0, SignedSidePolicy.Certified()),+ contact = ContactQuery.Between(saddle, z0),+ requiredConclusion = ContactClassification.Crossing+});++var plane = PlanePatch("curve-patch-plane", Domain());+Write("curve-patch-fixtures.json", new+{+ transverse = ContactQuery.Between(BoundedParametricCurve3.LineSegment("pierce", new(0, 0, -1), new(0, 0, 1), "M5 evidence"), plane),+ tangentSecondOrderSeparating = ContactQuery.Between(CurveGraph("curve-parabola", CurveExpression.Power(t, 2)), plane),+ secondOrderCompatible = ContactQuery.Between(BoundedParametricCurve3.LineSegment("in-plane", new(-1, 0, 0), new(1, 0, 0), "M5 evidence"), plane),+ orderRule = "No generic integer order is assigned for curve/patch in M5."+});++var horizontal = PlanePatch("horizontal", Domain());+var vertical = VerticalPatch("vertical");+var distinctFlat = PlanePatch("distinct-flat", Domain());+var bowl = Graph("patch-bowl", SurfaceExpression.Add(PowerU(2), PowerV(2)));+var cylinder = Graph("patch-cylinder", PowerU(2));+var rotatedCylinder = Graph("patch-rotated-cylinder", PowerV(2));+Write("patch-patch-fixtures.json", new+{+ transverse = ContactQuery.Between(horizontal, vertical),+ firstOrderCompatibleSecondOrderIncompatible = ContactQuery.Between(horizontal, bowl),+ secondOrderCompatible = ContactQuery.Between(horizontal, distinctFlat),+ directional = ContactQuery.Between(horizontal, cylinder),+ equalPrincipalValuesNotIdentity = new+ {+ curvatureA = CurvatureQuery.Patch(cylinder, 0, 0),+ curvatureB = CurvatureQuery.Patch(rotatedCylinder, 0, 0),+ contact = ContactQuery.Between(cylinder, rotatedCylinder),+ law = "Equal principal-curvature values without aligned directions/forms do not establish second-order compatibility or identity."+ },+ structuralCoincidence = ContactQuery.Between(horizontal, PlanePatch("horizontal", Domain())),+ sameIdentityDifferentDomain = ContactQuery.Between(horizontal, PlanePatch("horizontal", new(new(-.5, .5), new(-.5, .5)))),+ comparison = "Three shared physical tangent directions determine the geometric normal-curvature quadratic form; raw parameter derivatives are not compared."+});++var reparameterized = new BoundedParametricPatch3("reparameterized", Domain(), new(+ SurfaceExpression.Multiply(SurfaceExpression.Length(-2), SurfaceExpression.U),+ SurfaceExpression.Multiply(SurfaceExpression.Length(3), SurfaceExpression.V), SurfaceExpression.Length(0)), "M5 evidence");+var ordinaryContact = ContactQuery.Between(Graph("ordinary", SurfaceExpression.Length(0)), distinctFlat);+var reparameterizedContact = ContactQuery.Between(Graph("ordinary-2", SurfaceExpression.Length(0)), reparameterized);+var reversedCurve = new BoundedParametricCurve3("reversed-t2", new(-1, 1), new(+ CurveExpression.Multiply(CurveExpression.Length(-2), t), CurveExpression.Length(0),+ CurveExpression.Multiply(CurveExpression.Length(1), CurveExpression.Power(t, 2))), "M5 evidence");+Write("parameterization-invariance.json", new+{+ patch = new { ordinary = ordinaryContact, reparameterized = reparameterizedContact, invariant = ordinaryContact.Classification == reparameterizedContact.Classification },+ curve = new { ordinary = scalar["t2"], reversedScaled = ContactQuery.Between(reversedCurve, z0), invariant = scalar["t2"].OrderEvidence.Status == ContactQuery.Between(reversedCurve, z0).OrderEvidence.Status },+ principalDirectionsRequired = false+});++var leftFlat = GraphDomain("panel-left-flat", new(new(-1, 0), new(-1, 1)), SurfaceExpression.Length(0));+var rightBreak = GraphDomain("panel-right-break", new(new(0, 1), new(-1, 1)), PowerU(2));+var leftSmooth = GraphDomain("panel-left-smooth", new(new(-1, 0), new(-1, 1)), PowerU(2));+var rightSmooth = GraphDomain("panel-right-smooth", new(new(0, 1), new(-1, 1)), PowerU(2));+Write("panel-g1-g2-dogfood.json", new+{+ g1PassG2Fail = ContactQuery.Between(leftFlat, rightBreak),+ g2Pass = ContactQuery.Between(leftSmooth, rightSmooth),+ mapping = new { G0 = "positional meeting", G1 = "Tangent / first-order compatible", G2 = "SecondOrderCompatible" },+ panelApiReplaced = false,+ engineeringOwner = typeof(PanelNetworkValidator).FullName+});++var body = BrepPrimitives.CreateBox(4, 6, 8).Value; var before = Counts(body);+var firewall = ContactQuery.Between(horizontal, bowl); var after = Counts(body);+Write("topology-firewall.json", new+{+ before,+ after,+ unchanged = before == after,+ firewall.HasTopologyAuthority,+ resultContainsBrep = firewall.GetType().GetProperties().Any(p => p.PropertyType == typeof(BrepBody)),+ law = "ContactQuery is evidence-only and cannot create trims, split topology, reposition geometry, or generate response."+});++Write("api-architecture.json", new+{+ owner = "Aetheris.Geometry",+ matrix = new[] { "Curve-Plane", "Patch-Plane", "Curve-Patch", "Patch-Patch" },+ classifications = Enum.GetNames<ContactClassification>(),+ orderStates = Enum.GetNames<ContactOrderStatus>(),+ evidence = Enum.GetNames<PredicateEvidenceKind>(),+ scopes = Enum.GetNames<ContactEvidenceScope>(),+ policy = ContactPolicy.Default,+ resultFields = typeof(ContactQueryResult).GetProperties().Select(x => x.Name).ToArray(),+ classificationSeparateFromOrder = true,+ topologyAuthority = false,+ higherDerivativeDecision = "No CurveJet3/PatchJet3. Exact scalar order is bounded to 1/2; higher observations remain lower bounds/candidates."+});++var operations = new (string Name, Func<ContactQueryResult> Run)[]+{+ ("curve-plane", () => ContactQuery.Between(CurveGraph("perf-t2", CurveExpression.Power(t, 2)), z0)),+ ("patch-plane", () => ContactQuery.Between(paraboloid, z0)),+ ("curve-patch", () => ContactQuery.Between(CurveGraph("perf-cp", CurveExpression.Power(t, 2)), plane)),+ ("patch-patch", () => ContactQuery.Between(horizontal, bowl))+};+var timings = new List<object>();+foreach (var operation in operations)+{+ for (var i = 0; i < 3; i++) operation.Run(); const int count = 25; var watch = Stopwatch.StartNew(); ContactQueryResult? last = null;+ for (var i = 0; i < count; i++) last = operation.Run(); watch.Stop();+ timings.Add(new+ {+ operation.Name,+ iterations = count,+ elapsedMilliseconds = watch.Elapsed.TotalMilliseconds,+ nanosecondsPerQuery = watch.Elapsed.TotalNanoseconds / count,+ last!.Classification,+ last.Statistics+ });+}+Write("performance.json", new { note = "Calibration only; queries reuse M4 candidates and no optimization campaign was performed.", operations = timings });++var deterministic = operations.OrderBy(x => x.Name, StringComparer.Ordinal).Select(operation =>+{+ var first = JsonSerializer.Serialize(operation.Run(), json); var second = JsonSerializer.Serialize(operation.Run(), json);+ return new+ {+ operation.Name,+ stable = first == second,+ sha256 = Sha(first),+ classification = operation.Run().Classification,+ order = operation.Run().OrderEvidence,+ witnessCount = operation.Run().Witnesses.Count+ };+}).ToArray();+Write("deterministic-hashes.json", new { algorithm = "SHA-256", deterministic });+Console.WriteLine(JsonSerializer.Serialize(new { output, generated = Directory.GetFiles(output).Select(Path.GetFileName).Order().ToArray() }, json));++void Write(string name, object value) => File.WriteAllText(Path.Combine(output, name), JsonSerializer.Serialize(value, json) + Environment.NewLine, new UTF8Encoding(false));+string Sha(string value) => Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(value))).ToLowerInvariant();+TopologyCounts Counts(BrepBody b) => new(b.Topology.Vertices.Count(), b.Topology.Edges.Count(), b.Topology.Faces.Count(), b.Geometry.Curves.Count(), b.Geometry.Surfaces.Count());+ParametricDomain Domain() => new(new(-1, 1), new(-1, 1));+SurfaceScalarExpression PowerU(int exponent) => SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.Power(SurfaceExpression.U, exponent));+SurfaceScalarExpression PowerV(int exponent) => SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.Power(SurfaceExpression.V, exponent));+BoundedParametricCurve3 CurveGraph(string id, SurfaceScalarExpression z) => new(id, new(-1, 1), new(+ CurveExpression.Multiply(CurveExpression.Length(1), CurveExpression.T), CurveExpression.Length(0), CurveExpression.Multiply(CurveExpression.Length(1), z)), "M5 evidence");+BoundedParametricPatch3 Graph(string id, SurfaceScalarExpression z) => GraphDomain(id, Domain(), z);+BoundedParametricPatch3 GraphDomain(string id, ParametricDomain domain, SurfaceScalarExpression z) => new(id, domain, new(+ SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.U), SurfaceExpression.Multiply(SurfaceExpression.Length(1), SurfaceExpression.V), z), "M5 evidence");+BoundedParametricPatch3 PlanePatch(string id, ParametricDomain domain) => BoundedParametricPatch3.Procedural(id, domain,+ (u, v) => new(new(u, v, 0), new(1, 0, 0), new(0, 1, 0), Direction3D.Create(new(0, 0, 1)), false),+ (u, v) => new(new(u, v, 0), new(1, 0, 0), new(0, 1, 0), Vector3D.Zero, Vector3D.Zero, Vector3D.Zero, DifferentialSingularityKind.Regular), "M5 evidence");+BoundedParametricPatch3 VerticalPatch(string id) => BoundedParametricPatch3.Procedural(id, Domain(),+ (u, v) => new(new(u, 0, v), new(1, 0, 0), new(0, 0, 1), Direction3D.Create(new(0, -1, 0)), false),+ (u, v) => new(new(u, 0, v), new(1, 0, 0), new(0, 0, 1), Vector3D.Zero, Vector3D.Zero, Vector3D.Zero, DifferentialSingularityKind.Regular), "M5 evidence");++internal sealed record TopologyCounts(int Vertices, int Edges, int Faces, int Curves, int Surfaces);