< Summary

Information
Class: FixedMathSharp.Geometry.TriangleCapsuleSlabWitnesses
Assembly: FixedMathSharp
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Triangles/TriangleCapsuleSlabWitnesses.cs
Line coverage
100%
Covered lines: 237
Uncovered lines: 0
Coverable lines: 237
Total lines: 390
Line coverage: 100%
Branch coverage
100%
Covered branches: 96
Total branches: 96
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetPoints(...)100%11100%
TryGetPoints(...)100%1010100%
TryGetSideWeights(...)100%1818100%
TryGetCapWeights(...)100%1212100%
GetEndpointCapWeights(...)100%22100%
TryGetObliqueWeights(...)100%44100%
TrySlice(...)100%22100%
WithinRadius(...)100%22100%
GetMaterials(...)100%2828100%
GetCorePresentation(...)100%88100%
ClampProjection(...)100%44100%
SumCoordinate(...)100%22100%
InInterval(...)100%22100%
Negate(...)100%11100%
ReadComponent(...)100%22100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Triangles/TriangleCapsuleSlabWitnesses.cs

#LineLine coverage
 1//=======================================================================
 2// TriangleCapsuleSlabWitnesses.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using static FixedMathSharp.Geometry.CylinderContactAlgebra;
 10using static FixedMathSharp.Geometry.ContactQuadratic;
 11using static FixedMathSharp.Geometry.TriangleQuadraticSlice;
 12
 13namespace FixedMathSharp.Geometry;
 14
 15/// <summary>Matched witnesses on the stadium prism's free-core support seam.</summary>
 16internal static class TriangleCapsuleSlabWitnesses
 17{
 18    // Rigid seam products fit forty words (<2520 bits). Affine seam normals
 19    // stay below 344 bits, blended weights below 2515, and materialization
 20    // coefficients below 4000: eighty words retain complete products.
 21    // Rational cap admission squares stay below 3440 bits; quadratic sign
 22    // comparisons reserve their complete squared scratch separately.
 23    internal static void GetPoints(in TriangleCircularGeometry geometry, FixedTriangle triangle,
 24        int mask, ReadOnlySpan<ulong> normal, ReadOnlySpan<int> normalSigns,
 25        WideDirection3d coreOffset, Vector2d authoredAxis, Fixed64 coreLength, ref Vector3d radialPoint,
 26        out Vector3d trianglePoint, out Vector3d coreAndAxialPoint, out FixedPointAnchorTerm3d exactTerm)
 27    {
 10028        bool admitted = TryGetPoints(geometry, triangle, mask, normal, normalSigns, coreOffset, authoredAxis, coreLength
 10029            ref radialPoint, out trianglePoint, out coreAndAxialPoint, out exactTerm);
 30        System.Diagnostics.Debug.Assert(admitted);
 10031    }
 32
 33    internal static bool TryGetPoints(in TriangleCircularGeometry geometry, FixedTriangle triangle,
 34        int mask, ReadOnlySpan<ulong> normal, ReadOnlySpan<int> normalSigns,
 35        WideDirection3d coreOffset, Vector2d authoredAxis, Fixed64 coreLength, ref Vector3d radialPoint,
 36        out Vector3d trianglePoint, out Vector3d coreAndAxialPoint, out FixedPointAnchorTerm3d exactTerm)
 37    {
 20438        int Words = geometry.ParameterWords;
 40839        trianglePoint = coreAndAxialPoint = default; exactTerm = default;
 20440        WideDirection3d axis = new(Signed576.ExtendValue(Signed192.Raw(authoredAxis.X)), default,
 20441            Signed576.ExtendValue(Signed192.Raw(authoredAxis.Y)));
 20442        Signed832 bound = WideDirection3d.Dot(coreOffset, axis);
 20443        Span<Signed832> projections = stackalloc Signed832[3];
 163244        for (int vertex = 0; vertex < 3; vertex++)
 61245            projections[vertex] = WideDirection3d.Dot(geometry.Vertex(vertex), axis);
 20446        Span<ulong> weights = stackalloc ulong[6 * Words];
 20447        Span<int> weightSigns = stackalloc int[6];
 20448        Span<ulong> root = stackalloc ulong[Words];
 61249        weights.Clear(); weightSigns.Clear(); root.Clear();
 20450        bool pole = normalSigns[0] == 0 && normalSigns[2] == 0;
 20451        int cap = normalSigns[1];
 20452        WideDirection3d compact = new(ReadComponent(normal, normalSigns, 0),
 20453            ReadComponent(normal, normalSigns, 1), ReadComponent(normal, normalSigns, 2));
 20454        Signed832 metric = WideArithmetic.AddSigned832(WideArithmetic.MultiplySigned576(compact.X, compact.X),
 20455            WideArithmetic.MultiplySigned576(compact.Z, compact.Z));
 20456        Import(metric, root);
 20457        bool admitted = pole
 20458            ? TryGetCapWeights(geometry, mask, axis, coreOffset, projections, bound, weights, weightSigns)
 20459            : cap == 0 ? TryGetSideWeights(geometry, mask, projections, bound, weights, weightSigns)
 20460            : TryGetObliqueWeights(geometry, mask, axis, compact, cap, projections, bound, root, weights, weightSigns);
 21061        if (!admitted) return false;
 62
 19863        GetMaterials(geometry, triangle, axis, authoredAxis, coreLength, compact, metric, projections, bound,
 19864            cap, pole, root, weights, weightSigns, ref radialPoint, out trianglePoint, out coreAndAxialPoint, out exactT
 19865        return true;
 66    }
 67
 68    private static bool TryGetSideWeights(in TriangleCircularGeometry geometry, int mask,
 69        ReadOnlySpan<Signed832> projections, Signed832 coreBound,
 70        Span<ulong> weights, Span<int> weightSigns)
 71    {
 12672        int Words = geometry.ParameterWords;
 12673        Span<Signed832> axial = stackalloc Signed832[3];
 12674        Signed832 half = Signed832.ExtendValue(geometry.HalfHeight);
 60675        for (int vertex = 0; vertex < 3; vertex++)
 76        {
 24477            axial[vertex] = Signed832.ExtendValue(geometry.Vertex(vertex).Y);
 24478            if ((mask & (1 << vertex)) != 0 && InInterval(projections[vertex], coreBound)
 24479                && InInterval(axial[vertex], half))
 80            {
 6781                At(weights, weightSigns, vertex, weights.Length / weightSigns.Length).Set(Signed832.ExtendValue(Signed57
 6782                return true;
 83            }
 84        }
 85        // After excluding admitted vertices, test both axial boundaries.
 86        // If neither meets the feature, a nonempty intersection must meet
 87        // the negative core boundary: one confined to the positive boundary
 88        // would end at an admitted vertex or an already-tested axial side.
 5989        Span<ulong> distances = stackalloc ulong[6 * Words];
 5990        Span<int> signs = stackalloc int[6];
 11891        Span<ulong> root = stackalloc ulong[Words]; root.Clear();
 13692        for (int side = -1; side <= 1; side += 2)
 93        {
 51294            for (int vertex = 0; vertex < 3; vertex++)
 19295                At(distances, signs, vertex, distances.Length / signs.Length).Set(WideArithmetic.SubtractSigned832(axial
 6496            if (TrySlice(mask, distances, signs, projections, coreBound, root, weights, weightSigns))
 5597                return true;
 98        }
 3299        for (int vertex = 0; vertex < 3; vertex++)
 12100            At(distances, signs, vertex, distances.Length / signs.Length).Set(WideArithmetic.AddSigned832(projections[ve
 4101        return TrySlice(mask, distances, signs, axial, half, root, weights, weightSigns);
 102    }
 103
 104    private static bool TryGetCapWeights(in TriangleCircularGeometry geometry, int mask, WideDirection3d axis,
 105        WideDirection3d coreOffset, ReadOnlySpan<Signed832> projections, Signed832 bound,
 106        Span<ulong> weights, Span<int> weightSigns)
 107    {
 67108        int Words = geometry.ParameterWords;
 67109        Span<ulong> distances = stackalloc ulong[6 * Words];
 67110        Span<int> signs = stackalloc int[6];
 134111        Span<ulong> root = stackalloc ulong[Words]; root.Clear();
 67112        WideDirection3d transverse = new(WideArithmetic.Negate(axis.Z), default, axis.X);
 536113        for (int vertex = 0; vertex < 3; vertex++)
 201114            At(distances, signs, vertex, distances.Length / signs.Length).Set(WideDirection3d.Dot(geometry.Vertex(vertex
 67115        if (TrySlice(mask, distances, signs, projections, bound, root, weights, weightSigns))
 57116            return true;
 117
 118        // With no core/feature intersection, the closest planar pair has a
 119        // triangle vertex or a core endpoint. These are witness constructions,
 120        // not an endpoint-cylinder union used to classify the stadium.
 56121        for (int vertex = 0; vertex < 3; vertex++)
 122        {
 22123            if ((mask & (1 << vertex)) == 0)
 124                continue;
 44125            weights.Clear(); weightSigns.Clear();
 22126            At(weights, weightSigns, vertex, weights.Length / weightSigns.Length).Set(Signed832.ExtendValue(Signed576.On
 22127            if (WithinRadius(geometry, axis, projections, bound, weights, weightSigns))
 4128                return true;
 129        }
 6130        GetEndpointCapWeights(geometry, mask, coreOffset, -1, weights, weightSigns);
 6131        if (WithinRadius(geometry, axis, projections, bound, weights, weightSigns))
 3132            return true;
 133        // The preceding exhaustive closest-feature cases have failed; the
 134        // other core endpoint must supply the admitted cap witness.
 3135        GetEndpointCapWeights(geometry, mask, coreOffset, 1, weights, weightSigns);
 3136        return WithinRadius(geometry, axis, projections, bound, weights, weightSigns);
 137    }
 138
 139    private static void GetEndpointCapWeights(in TriangleCircularGeometry geometry, int mask, WideDirection3d coreOffset
 140        int side, Span<ulong> weights, Span<int> weightSigns)
 141    {
 9142        int Words = geometry.ParameterWords;
 9143        Span<ulong> rationalWeights = stackalloc ulong[3 * CylinderContactAlgebra.Words];
 9144        TriangleCircularGeometry endpoint = geometry.AtCoreRegion(coreOffset, side);
 9145        TriangleCylinderWitnesses.GetCapWeights(endpoint, mask, rationalWeights);
 18146        weights.Clear(); weightSigns.Clear();
 72147        for (int vertex = 0; vertex < 3; vertex++)
 148        {
 27149            Slot(rationalWeights, vertex).CopyTo(At(weights, weightSigns, vertex, weights.Length / weightSigns.Length).R
 27150            At(weights, weightSigns, vertex, weights.Length / weightSigns.Length).Signs[0] = IsZero(Slot(rationalWeights
 151        }
 9152    }
 153
 154    private static bool TryGetObliqueWeights(in TriangleCircularGeometry geometry, int mask, WideDirection3d axis,
 155        WideDirection3d compact, int cap,
 156        ReadOnlySpan<Signed832> projections, Signed832 bound, ReadOnlySpan<ulong> root,
 157        Span<ulong> weights, Span<int> weightSigns)
 158    {
 11159        int Words = geometry.ParameterWords;
 160        // Seam ownership supplies Up, its planar perpendicular, or one
 161        // retained edge crossed with the raw authored axis (<230 bits).
 11162        WideDirection3d tangent = WideDirection3d.Cross(axis, compact);
 163
 11164        Span<ulong> distances = stackalloc ulong[6 * Words];
 11165        Span<int> signs = stackalloc int[6];
 11166        Span<ulong> scratch = stackalloc ulong[4 * Words];
 11167        Span<int> scratchSigns = stackalloc int[4];
 22168        ContactQuadratic radical = At(scratch, scratchSigns, 0, scratch.Length / scratchSigns.Length), factor = At(scrat
 169        // sqrt(K)*tangent·(v-p) =
 170        // (tangent·v + cap*H*tangent.Y)*sqrt(K) - R*n.Y*tangent.Y.
 11171        radical.Set(WideArithmetic.MultiplySigned576(compact.Y, tangent.Y));
 11172        Scale(radical, Signed832.ExtendValue(geometry.Radius), factor);
 88173        for (int vertex = 0; vertex < 3; vertex++)
 174        {
 33175            ContactQuadratic distance = At(distances, signs, vertex, distances.Length / signs.Length);
 33176            factor.CopyTo(distance, -1);
 33177            Signed832 axial = WideArithmetic.MultiplySigned576(geometry.HalfHeight, tangent.Y);
 33178            Signed832 value = WideArithmetic.AddSigned832(WideDirection3d.Dot(geometry.Vertex(vertex), tangent),
 33179                cap > 0 ? axial : Negate(axial));
 66180            Import(value, distance.Radical); distance.Signs[1] = value.Sign;
 181        }
 11182        return TrySlice(mask, distances, signs, projections, bound, root, weights, weightSigns);
 183    }
 184
 185    private static bool TrySlice(int mask, Span<ulong> distances, Span<int> distanceSigns,
 186        ReadOnlySpan<Signed832> projections, Signed832 bound, ReadOnlySpan<ulong> root,
 187        Span<ulong> weights, Span<int> weightSigns)
 188    {
 146189        int Words = weights.Length / weightSigns.Length;
 146190        Span<ulong> values = stackalloc ulong[8 * Words];
 146191        Span<int> signs = stackalloc int[8];
 1168192        for (int vertex = 0; vertex < 3; vertex++)
 438193            At(values, signs, vertex, values.Length / signs.Length).Set(projections[vertex]);
 146194        At(values, signs, 3, values.Length / signs.Length).Set(bound);
 146195        return TriangleQuadraticSlice.TryGetWeights(mask, distances, distanceSigns,
 146196            values[..(6 * Words)], signs[..6], At(values, signs, 3, values.Length / signs.Length), root,
 146197            weights, weightSigns, out _);
 198    }
 199
 200    private static bool WithinRadius(in TriangleCircularGeometry geometry, WideDirection3d axis,
 201        ReadOnlySpan<Signed832> projections, Signed832 bound, Span<ulong> weights, Span<int> signs)
 202    {
 31203        int Words = geometry.ParameterWords;
 31204        Span<ulong> values = stackalloc ulong[16 * Words];
 31205        Span<int> valueSigns = stackalloc int[16];
 62206        Span<ulong> root = stackalloc ulong[Words]; root.Clear();
 62207        ContactQuadratic denominator = At(values, valueSigns, 0, values.Length / valueSigns.Length), projection = At(val
 62208        ContactQuadratic coordinate = At(values, valueSigns, 2, values.Length / valueSigns.Length), scaled = At(values, 
 62209        ContactQuadratic difference = At(values, valueSigns, 4, values.Length / valueSigns.Length), squared = At(values,
 62210        ContactQuadratic sum = At(values, valueSigns, 6, values.Length / valueSigns.Length), limit = At(values, valueSig
 31211        SumWeights(weights, signs, denominator);
 31212        Sum(projections, weights, signs, projection);
 31213        ClampProjection(denominator, projection, bound, root);
 31214        Signed832 axisSquared = axis.SquaredLength;
 31215        sum.Clear();
 186216        for (int component = 0; component < 3; component += 2)
 217        {
 62218            SumCoordinate(geometry, weights, signs, component, coordinate);
 62219            Scale(coordinate, axisSquared, difference);
 62220            Scale(projection, Signed832.ExtendValue(Component(axis, component)), scaled);
 62221            difference.Add(scaled, -1);
 62222            Multiply(difference, difference, root, squared);
 62223            sum.Add(squared);
 224        }
 31225        Signed832 radiusAxis = WideArithmetic.MultiplySigned576(Signed576.NarrowValue(axisSquared), geometry.Radius);
 31226        Scale(denominator, radiusAxis, limit);
 31227        Multiply(limit, limit, root, squared);
 31228        sum.Add(squared, -1);
 31229        return sum.Sign(root) <= 0;
 230    }
 231
 232    private static void GetMaterials(in TriangleCircularGeometry geometry, FixedTriangle triangle, WideDirection3d axis,
 233        Vector2d authoredAxis, Fixed64 coreLength,
 234        WideDirection3d normal, Signed832 metric, ReadOnlySpan<Signed832> projections, Signed832 bound,
 235        int cap, bool pole, ReadOnlySpan<ulong> root, Span<ulong> weights, Span<int> signs,
 236        ref Vector3d radialPoint, out Vector3d trianglePoint, out Vector3d coreAndAxialPoint,
 237        out FixedPointAnchorTerm3d exactTerm)
 238    {
 198239        int Words = geometry.ParameterWords;
 198240        Span<ulong> values = stackalloc ulong[16 * Words];
 198241        Span<int> valueSigns = stackalloc int[16];
 396242        ContactQuadratic denominator = At(values, valueSigns, 0, values.Length / valueSigns.Length), projection = At(val
 396243        ContactQuadratic coordinate = At(values, valueSigns, 2, values.Length / valueSigns.Length), coreNumerator = At(v
 396244        ContactQuadratic coreDenominator = At(values, valueSigns, 4, values.Length / valueSigns.Length), product = At(va
 396245        ContactQuadratic combinedNumerator = At(values, valueSigns, 6, values.Length / valueSigns.Length), combinedDenom
 198246        SumWeights(weights, signs, denominator);
 198247        Sum(projections, weights, signs, projection);
 198248        if (pole)
 65249            ClampProjection(denominator, projection, bound, root);
 198250        int endpointSign = projection.Sign(root);
 198251        Scale(denominator, bound, coordinate);
 396252        coordinate.MultiplySign(endpointSign); coordinate.Add(projection, -1);
 198253        if (coordinate.Sign(root) != 0)
 71254            endpointSign = 0;
 198255        Vector3d endpointCore = endpointSign == 0 ? default
 198256            : TriangleCapsuleSlabEndpointWitnesses.GetCore(authoredAxis, coreLength, -endpointSign, out _);
 198257        int integralMask = 0;
 198258        trianglePoint = new Vector3d(
 198259            RoundTriangleCoordinate(geometry, triangle, 0, weights, signs, denominator, root),
 198260            RoundTriangleCoordinate(geometry, triangle, 1, weights, signs, denominator, root),
 198261            RoundTriangleCoordinate(geometry, triangle, 2, weights, signs, denominator, root));
 262
 198263        Signed832 axisSquared = axis.SquaredLength;
 198264        Signed832 scale = WideArithmetic.MultiplySigned832(axisSquared, geometry.RawScale);
 198265        Scale(denominator, scale, coreDenominator);
 198266        Vector3d core = default;
 198267        radialPoint = default;
 1188268        for (int component = 0; component < 3; component += 2)
 269        {
 396270            Scale(projection, Signed832.ExtendValue(Component(axis, component)), coreNumerator);
 271            int radialSign;
 396272            if (pole)
 273            {
 274                // The cap's combined planar point is q itself, not two
 275                // independently rounded core/projection components.
 130276                SumCoordinate(geometry, weights, signs, component, coordinate);
 130277                Scale(coordinate, axisSquared, combinedNumerator);
 130278                coreDenominator.CopyTo(combinedDenominator);
 260279                combinedNumerator.CopyTo(product); product.Add(coreNumerator, -1);
 130280                radialSign = product.Sign(root);
 281            }
 282            else
 283            {
 284                // K*C - R*n_i*sumWeights*a²*sqrt(K), over K times
 285                // C's denominator, is the exact combined support coordinate.
 266286                Scale(coreNumerator, metric, combinedNumerator);
 266287                Scale(coreDenominator, metric, combinedDenominator);
 266288                Scale(denominator, axisSquared, product);
 266289                Signed832 radialFactor = WideArithmetic.MultiplySigned576(geometry.Radius, Component(normal, component))
 266290                Scale(product, radialFactor, coordinate);
 266291                MultiplyRoot(coordinate, root, product);
 266292                combinedNumerator.Add(product, -1);
 266293                radialSign = -Component(normal, component).Sign * geometry.Radius.Sign;
 294            }
 396295            if (endpointSign != 0)
 296            {
 297                // An integral radial offset leaves the exact endpoint's
 298                // half-core residual meaningful. Test the bounded radial
 299                // value itself, never rounded(P)-rounded(C), which can
 300                // differ by one at a half tie or exceed the scalar domain.
 154301                if (!pole)
 138302                    product.MultiplySign(-1);
 154303                Fixed64 radial = RoundRatio(product, combinedDenominator, root);
 154304                Scale(combinedDenominator, Signed832.ExtendValue(Signed576.ExtendValue(Signed192.Raw(radial))), coordina
 154305                coordinate.Add(product, -1);
 154306                if (coordinate.Sign(root) == 0)
 307                {
 303308                    if (component == 0) { core.X = endpointCore.X; radialPoint.X = radial; }
 150309                    else { core.Z = endpointCore.Z; radialPoint.Z = radial; }
 151310                    integralMask |= 1 << component;
 151311                    continue;
 312                }
 313            }
 314            // An integer base on the radial side of C keeps P-base within
 315            // [-Max,Max], even when P itself cannot fit a scalar. Its parity
 316            // participates in the residual tie, preserving one rounding of P.
 245317            Fixed64 presentation = GetCorePresentation(coreNumerator, coreDenominator, radialSign, root);
 245318            Scale(combinedDenominator, Signed832.ExtendValue(Signed576.ExtendValue(Signed192.Raw(presentation))), produc
 245319            combinedNumerator.Add(product, -1);
 245320            Fixed64 residual = RoundRatio(combinedNumerator, combinedDenominator, root,
 245321                parityOffset: presentation.m_rawValue);
 489322            if (component == 0) { core.X = presentation; radialPoint.X = residual; }
 246323            else { core.Z = presentation; radialPoint.Z = residual; }
 324        }
 198325        Scale(denominator, Signed832.ExtendValue(Signed576.ExtendValue(geometry.RawScale)), coreDenominator);
 198326        if (cap == 0)
 124327            SumCoordinate(geometry, weights, signs, 1, coreNumerator);
 328        else
 74329            Scale(denominator, Signed832.ExtendValue(cap > 0 ? WideArithmetic.Negate(geometry.HalfHeight) : geometry.Hal
 198330        core.Y = RoundRatio(coreNumerator, coreDenominator, root);
 198331        coreAndAxialPoint = core;
 198332        exactTerm = integralMask == 0 ? default : TriangleCapsuleSlabEndpointWitnesses.CreateTerm(
 198333            authoredAxis, endpointSign > 0 ? coreLength : -coreLength, core, integralMask);
 198334    }
 335
 336    private static Fixed64 GetCorePresentation(ContactQuadratic numerator, ContactQuadratic denominator, int radialSign,
 337    {
 245338        int Words = denominator.FieldWords;
 245339        Fixed64 rounded = RoundRatio(numerator, denominator, root);
 245340        Span<ulong> values = stackalloc ulong[2 * Words];
 245341        Span<int> signs = stackalloc int[2];
 245342        ContactQuadratic difference = At(values, signs, 0, values.Length / signs.Length);
 245343        Scale(denominator, Signed832.ExtendValue(Signed576.ExtendValue(Signed192.Raw(rounded))), difference);
 490344        difference.MultiplySign(-1); difference.Add(numerator);
 245345        int comparison = difference.Sign(root);
 245346        if (radialSign >= 0 && comparison > 0)
 20347            return Fixed64.FromRaw(rounded.m_rawValue + 1);
 225348        if (radialSign < 0 && comparison < 0)
 27349            return Fixed64.FromRaw(rounded.m_rawValue - 1);
 198350        return rounded;
 351    }
 352
 353    private static void ClampProjection(ContactQuadratic denominator, ContactQuadratic projection, Signed832 bound, Read
 354    {
 96355        int Words = denominator.FieldWords;
 96356        Span<ulong> values = stackalloc ulong[4 * Words];
 96357        Span<int> signs = stackalloc int[4];
 192358        ContactQuadratic limit = At(values, signs, 0, values.Length / signs.Length), difference = At(values, signs, 1, v
 96359        Scale(denominator, bound, limit);
 192360        projection.CopyTo(difference); difference.Add(limit, -1);
 96361        if (difference.Sign(root) > 0)
 23362            limit.CopyTo(projection);
 363        else
 364        {
 146365            projection.CopyTo(difference); difference.Add(limit);
 73366            if (difference.Sign(root) < 0)
 11367                limit.CopyTo(projection, -1);
 368        }
 73369    }
 370
 371    private static void SumCoordinate(in TriangleCircularGeometry geometry, Span<ulong> weights,
 372        Span<int> signs, int component, ContactQuadratic result)
 373    {
 316374        Span<Signed832> coordinates = stackalloc Signed832[3];
 2528375        for (int vertex = 0; vertex < 3; vertex++)
 948376            coordinates[vertex] = Signed832.ExtendValue(Component(geometry.Vertex(vertex), component));
 316377        Sum(coordinates, weights, signs, result);
 316378    }
 379
 380    private static bool InInterval(Signed832 value, Signed832 bound) =>
 363381        WideArithmetic.SubtractSigned832(value, bound).Sign <= 0
 363382        && WideArithmetic.AddSigned832(value, bound).Sign >= 0;
 201383    private static Signed832 Negate(Signed832 value) => WideArithmetic.SubtractSigned832(default, value);
 384    private static Signed576 ReadComponent(ReadOnlySpan<ulong> values, ReadOnlySpan<int> signs, int component)
 385    {
 612386        ReadOnlySpan<ulong> value = Slot(values, component);
 612387        Signed576 result = new(value[8], value[7], value[6], value[5], value[4], value[3], value[2], value[1], value[0])
 612388        return signs[component] < 0 ? WideArithmetic.Negate(result) : result;
 389    }
 390}

Methods/Properties

GetPoints(FixedMathSharp.Geometry.TriangleCircularGeometry&,FixedMathSharp.Geometry.FixedTriangle,System.Int32,System.ReadOnlySpan`1<System.UInt64>,System.ReadOnlySpan`1<System.Int32>,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Geometry.FixedPointAnchorTerm3d&)
TryGetPoints(FixedMathSharp.Geometry.TriangleCircularGeometry&,FixedMathSharp.Geometry.FixedTriangle,System.Int32,System.ReadOnlySpan`1<System.UInt64>,System.ReadOnlySpan`1<System.Int32>,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Geometry.FixedPointAnchorTerm3d&)
TryGetSideWeights(FixedMathSharp.Geometry.TriangleCircularGeometry&,System.Int32,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
TryGetCapWeights(FixedMathSharp.Geometry.TriangleCircularGeometry&,System.Int32,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Geometry.WideDirection3d,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
GetEndpointCapWeights(FixedMathSharp.Geometry.TriangleCircularGeometry&,System.Int32,FixedMathSharp.Geometry.WideDirection3d,System.Int32,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
TryGetObliqueWeights(FixedMathSharp.Geometry.TriangleCircularGeometry&,System.Int32,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Geometry.WideDirection3d,System.Int32,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.ReadOnlySpan`1<System.UInt64>,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
TrySlice(System.Int32,System.Span`1<System.UInt64>,System.Span`1<System.Int32>,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.ReadOnlySpan`1<System.UInt64>,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
WithinRadius(FixedMathSharp.Geometry.TriangleCircularGeometry&,FixedMathSharp.Geometry.WideDirection3d,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.Span`1<System.UInt64>,System.Span`1<System.Int32>)
GetMaterials(FixedMathSharp.Geometry.TriangleCircularGeometry&,FixedMathSharp.Geometry.FixedTriangle,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64,FixedMathSharp.Geometry.WideDirection3d,FixedMathSharp.Signed832,System.ReadOnlySpan`1<FixedMathSharp.Signed832>,FixedMathSharp.Signed832,System.Int32,System.Boolean,System.ReadOnlySpan`1<System.UInt64>,System.Span`1<System.UInt64>,System.Span`1<System.Int32>,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&,FixedMathSharp.Geometry.FixedPointAnchorTerm3d&)
GetCorePresentation(FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,System.Int32,System.ReadOnlySpan`1<System.UInt64>)
ClampProjection(FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Signed832,System.ReadOnlySpan`1<System.UInt64>)
SumCoordinate(FixedMathSharp.Geometry.TriangleCircularGeometry&,System.Span`1<System.UInt64>,System.Span`1<System.Int32>,System.Int32,FixedMathSharp.Geometry.ContactQuadratic)
InInterval(FixedMathSharp.Signed832,FixedMathSharp.Signed832)
Negate(FixedMathSharp.Signed832)
ReadComponent(System.ReadOnlySpan`1<System.UInt64>,System.ReadOnlySpan`1<System.Int32>,System.Int32)