< Summary

Line coverage
100%
Covered lines: 215
Uncovered lines: 0
Coverable lines: 215
Total lines: 399
Line coverage: 100%
Branch coverage
100%
Covered branches: 136
Total branches: 136
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/FiniteAxis/CapsulePlaneRaySelection.CrossFrame.cs

#LineLine coverage
 1//=======================================================================
 2// CapsulePlaneRaySelection.CrossFrame.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;
 9
 10namespace FixedMathSharp.Geometry;
 11
 12/// <content>Exact finite triangle admission across independently scaled capsule charts.</content>
 13internal ref partial struct CapsulePlaneRaySelection
 14{
 15    /// <summary>Tests this source-frame point against a triangle in the target frame of the same capsule.</summary>
 16    internal readonly bool ContainsTrianglePoint(in CapsulePlaneRayFrame target, FixedTriangle triangle,
 17        in CapsulePlaneRayFrame source)
 18    {
 2219        if (!HasValue) return false;
 2020        Signed320 sourceScale = source.Finite.ShapeFrame.CoordinateDenominator;
 2021        Signed320 targetScale = target.Finite.ShapeFrame.CoordinateDenominator;
 2022        if (sourceScale.Equals(targetScale))
 1023            return target.ContainsTrianglePoint(triangle, X, Y, Z, Denominator, Root);
 24        // Native coordinates represent 2D times the same capsule-local point.
 25        // Cross multiplication changes its chart without rounding; positive
 26        // frame denominators add at most 132 bits (three limbs) per field.
 1027        int words = Math.Max(Math.Max(ContactQuadratic.ActiveWords(X), ContactQuadratic.ActiveWords(Y)),
 1028            Math.Max(ContactQuadratic.ActiveWords(Z), ContactQuadratic.ActiveWords(Denominator))) + 5;
 1029        Span<ulong> values = stackalloc ulong[8 * words];
 1030        Span<int> signs = stackalloc int[8];
 1031        var point = new FiniteSectionPoint(values, signs, words, 0);
 1032        Signed576 scale = Signed576.ExtendValue(targetScale);
 1033        ContactQuadratic.Scale(X, scale, point.Coordinate(0));
 1034        ContactQuadratic.Scale(Y, scale, point.Coordinate(1));
 1035        ContactQuadratic.Scale(Z, scale, point.Coordinate(2));
 1036        ContactQuadratic.Scale(Denominator, Signed576.ExtendValue(sourceScale), point.Denominator);
 1037        return target.ContainsTrianglePoint(triangle, point.Coordinate(0), point.Coordinate(1),
 1038            point.Coordinate(2), point.Denominator, Root);
 39    }
 40}

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/FiniteAxis/CapsulePlaneRaySelection.cs

#LineLine coverage
 1//=======================================================================
 2// CapsulePlaneRaySelection.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;
 9
 10namespace FixedMathSharp.Geometry;
 11
 12
 13
 14/// <summary>Borrowed exact point and depth storage for an admitted capsule plane ray.</summary>
 15/// <content>Native event selection, retained coefficient banks and witness reconstruction.</content>
 16internal ref partial struct CapsulePlaneRaySelection
 17{
 18    internal const int FieldWords = 64;
 19    internal const int RootWords = 48;
 20    private const int QuadraticStorageWords = 12 * FieldWords + RootWords;
 21    internal const int StorageWords = QuadraticStorageWords + CapsulePlaneRayValue.StorageWords;
 22    internal const int SignCount = 12;
 23    internal const int ValueSignCount = CapsulePlaneRayValue.SignCount;
 24    internal readonly int CoefficientWords, RadicalWords, PolynomialWords;
 96025    private readonly int QuadraticWords => 12 * CoefficientWords + RadicalWords;
 26    internal static int GetStorageWords(int fieldWords, int rootWords, int valueWords) =>
 827427        12 * fieldWords + rootWords + CapsulePlaneRayValue.GetStorageWords(valueWords);
 28    internal readonly Span<ulong> Values;
 29    internal readonly Span<int> Signs;
 30    internal readonly Span<sbyte> ValueSigns;
 31    internal bool HasValue;
 32    private bool usesValueRoot;
 33    private CapsulePlaneRayValueMetadata valueMetadata;
 34    internal int Primitive;
 35    internal CapsulePlaneRayEventSource CurrentSource, MaximumSource;
 36    internal CapsulePlaneRayEvent CurrentEvent, MaximumEvent;
 618737    internal readonly ContactQuadratic X => ContactQuadratic.At(Values, Signs, 0, CoefficientWords);
 579038    internal readonly ContactQuadratic Y => ContactQuadratic.At(Values, Signs, 1, CoefficientWords);
 575539    internal readonly ContactQuadratic Z => ContactQuadratic.At(Values, Signs, 2, CoefficientWords);
 666440    internal readonly ContactQuadratic Denominator => ContactQuadratic.At(Values, Signs, 3, CoefficientWords);
 695241    internal readonly ContactQuadratic DepthNumerator => ContactQuadratic.At(Values, Signs, 4, CoefficientWords);
 797242    internal readonly ContactQuadratic DepthDenominator => ContactQuadratic.At(Values, Signs, 5, CoefficientWords);
 992343    internal readonly ReadOnlySpan<ulong> Root => Values.Slice(12 * CoefficientWords, RadicalWords);
 28944    internal readonly CapsulePlaneRaySelectionMetadata Metadata => new(HasValue, usesValueRoot, Primitive,
 28945        MaximumSource, MaximumEvent, valueMetadata);
 46
 47    /// <summary>Compares exact base anchors without materializing or evaluating their exits.</summary>
 48    internal readonly int ComparePoint(scoped in CapsulePlaneRaySelection other, scoped in CapsulePlaneRayFrame frame) =
 52849        frame.ComparePoints(X, Y, Z, Denominator, Root, other.X, other.Y, other.Z, other.Denominator, other.Root);
 50
 51    internal CapsulePlaneRaySelection(Span<ulong> values, Span<int> signs, Span<sbyte> valueSigns,
 52        int fieldWords = FieldWords, int rootWords = RootWords, int valueWords = CapsulePlaneRayValue.PolynomialWords)
 53    {
 329154        if (values.Length < GetStorageWords(fieldWords, rootWords, valueWords) || signs.Length < SignCount || valueSigns
 355            throw new ArgumentException("The capsule ray selection storage is too small.");
 986456        CoefficientWords = fieldWords; RadicalWords = rootWords; PolynomialWords = valueWords;
 1315257        Values = values[..GetStorageWords(fieldWords, rootWords, valueWords)]; Signs = signs[..SignCount]; HasValue = fa
 986458        ValueSigns = valueSigns[..ValueSignCount]; usesValueRoot = false; valueMetadata = default;
 657659        CurrentSource = MaximumSource = default; CurrentEvent = MaximumEvent = default;
 328860    }
 61
 62    private readonly CapsulePlaneRayValue Value
 63    {
 64        get
 65        {
 67966            var value = new CapsulePlaneRayValue(Values[QuadraticWords..], ValueSigns, PolynomialWords);
 135867            value.Restore(valueMetadata); return value;
 68        }
 69    }
 70
 71    internal void Keep(scoped ContactQuadratic x, scoped ContactQuadratic y, scoped ContactQuadratic z, scoped ContactQu
 72        scoped ContactQuadratic numerator, scoped ContactQuadratic divisor, scoped ReadOnlySpan<ulong> root, int primiti
 73        in CapsulePlaneRayFrame frame)
 74    {
 205575        if (HasValue)
 76        {
 28977            int comparison = usesValueRoot ? -Value.CompareQuadratic(numerator, divisor, root)
 28978                : ContactQuadratic.CompareRatios(numerator, divisor, root, DepthNumerator, DepthDenominator, Root);
 47379            if (comparison < 0) return;
 10580            if (comparison == 0)
 81            {
 5882                int order = frame.ComparePoints(x, y, z, denominator, root, X, Y, Z, Denominator, Root);
 11283                if (order > 0 || order == 0 && primitive >= Primitive) return;
 84            }
 85        }
 726886        x.CopyTo(X); y.CopyTo(Y); z.CopyTo(Z); denominator.CopyTo(Denominator);
 363487        numerator.CopyTo(DepthNumerator); divisor.CopyTo(DepthDenominator);
 181788        Span<ulong> destination = Values.Slice(12 * CoefficientWords, RadicalWords);
 363489        root.CopyTo(destination); destination[root.Length..].Clear();
 363490        HasValue = true; Primitive = primitive;
 363491        usesValueRoot = false; valueMetadata = default;
 363492        MaximumSource = CurrentSource; MaximumEvent = CurrentEvent;
 181793    }
 94
 95    internal readonly int CompareDepth(scoped in CapsulePlaneRaySelection other)
 96    {
 87497        if (usesValueRoot)
 11698            return other.usesValueRoot ? Value.Compare(other.Value)
 11699                : Value.CompareQuadratic(other.DepthNumerator, other.DepthDenominator, other.Root);
 758100        return other.usesValueRoot ? -other.Value.CompareQuadratic(DepthNumerator, DepthDenominator, Root)
 758101            : ContactQuadratic.CompareRatios(DepthNumerator, DepthDenominator, Root,
 758102                other.DepthNumerator, other.DepthDenominator, other.Root);
 103    }
 104
 105    /// <summary>Compares this physical raw depth with a nonnegative exact squared raw-depth ratio.</summary>
 106    internal readonly int CompareSquaredDepth(in CapsulePlaneRayFrame frame, scoped ContactQuadratic numerator,
 107        scoped ContactQuadratic denominator, scoped ReadOnlySpan<ulong> radical)
 108    {
 18109        int words = Math.Max(ContactQuadratic.ActiveWords(numerator), ContactQuadratic.ActiveWords(denominator)) + 14;
 28110        if (!usesValueRoot) words = Math.Max(words,
 10111            2 * Math.Max(ContactQuadratic.ActiveWords(DepthNumerator), ContactQuadratic.ActiveWords(DepthDenominator))
 10112                + WideArithmetic.GetActiveMagnitudeLength(Root) + 1);
 72113        Span<ulong> values = stackalloc ulong[8 * words], metric = stackalloc ulong[13], scale = stackalloc ulong[5], sq
 18114        Span<int> signs = stackalloc int[8];
 36115        var n = ContactQuadratic.At(values, signs, 0, words); var d = ContactQuadratic.At(values, signs, 1, words);
 36116        var rn = ContactQuadratic.At(values, signs, 2, words); var rd = ContactQuadratic.At(values, signs, 3, words);
 18117        Signed320 doubleD = WideArithmetic.AddSigned320(frame.Finite.ShapeFrame.CoordinateDenominator, frame.Finite.Shap
 18118        WideArithmetic.GetMagnitude(doubleD, out scale[4], out scale[3], out scale[2], out scale[1], out scale[0]);
 36119        WideArithmetic.MultiplyMagnitudes(scale, scale, square); WideArithmetic.GetMagnitude(frame.NormalSquared, metric
 120        // t² competes with nativeDepth²*(2D)²/|N|² in this ray chart.
 36121        ContactQuadratic.Scale(numerator, square, 1, n); ContactQuadratic.Scale(denominator, metric, 1, d);
 26122        if (usesValueRoot) return Value.CompareSquaredQuadratic(n, d, radical);
 10123        ContactQuadratic.Multiply(DepthNumerator, DepthNumerator, Root, rn);
 10124        ContactQuadratic.Multiply(DepthDenominator, DepthDenominator, Root, rd);
 10125        return ContactQuadratic.CompareRatios(rn, rd, Root, n, d, radical);
 126    }
 127
 128    /// <summary>
 129    /// Compares physical depths from certified coplanar member frames in the
 130    /// same capsule chart. Their reduced normal metrics must be identical.
 131    /// </summary>
 132    internal readonly int CompareCoplanarDepth(scoped in CapsulePlaneRaySelection other,
 133        in CapsulePlaneRayFrame frame, in CapsulePlaneRayFrame otherFrame)
 134    {
 135        System.Diagnostics.Debug.Assert(frame.NormalSquared.Equals(otherFrame.NormalSquared));
 592136        Signed320 divisor = frame.Finite.ShapeFrame.CoordinateDenominator;
 592137        Signed320 otherDivisor = otherFrame.Finite.ShapeFrame.CoordinateDenominator;
 740138        if (divisor.Equals(otherDivisor)) return CompareDepth(other);
 450139        if (usesValueRoot && other.usesValueRoot) return Value.Compare(other.Value, divisor, otherDivisor);
 140
 438141        int words = Math.Max(CoefficientWords, other.CoefficientWords) + 5;
 876142        Span<ulong> values = stackalloc ulong[4 * words]; Span<int> signs = stackalloc int[4];
 438143        ContactQuadratic first = ContactQuadratic.At(values, signs, 0, words);
 438144        ContactQuadratic second = ContactQuadratic.At(values, signs, 1, words);
 438145        Signed576 scale = Signed576.ExtendValue(divisor);
 438146        Signed576 otherScale = Signed576.ExtendValue(otherDivisor);
 438147        if (usesValueRoot)
 148        {
 36149            ContactQuadratic.Scale(other.DepthNumerator, scale, first);
 36150            ContactQuadratic.Scale(other.DepthDenominator, otherScale, second);
 36151            return Value.CompareQuadratic(first, second, other.Root);
 152        }
 402153        if (other.usesValueRoot)
 154        {
 36155            ContactQuadratic.Scale(DepthNumerator, otherScale, first);
 36156            ContactQuadratic.Scale(DepthDenominator, scale, second);
 36157            return -other.Value.CompareQuadratic(first, second, Root);
 158        }
 366159        ContactQuadratic.Scale(DepthDenominator, scale, first);
 366160        ContactQuadratic.Scale(other.DepthDenominator, otherScale, second);
 366161        return ContactQuadratic.CompareRatios(DepthNumerator, first, Root, other.DepthNumerator, second, other.Root);
 162    }
 163
 164    internal void KeepEvaluated(scoped CapsulePlaneRaySelection other, in CapsulePlaneRayFrame frame)
 165    {
 960166        if (!other.HasValue) return;
 1916167        CurrentSource = other.MaximumSource; CurrentEvent = other.MaximumEvent;
 958168        if (other.usesValueRoot)
 169        {
 125170            CapsulePlaneRayValue value = other.Value;
 125171            KeepValue(other.X, other.Y, other.Z, other.Denominator, other.Root, value, other.Primitive, frame);
 125172            return;
 173        }
 833174        Keep(other.X, other.Y, other.Z, other.Denominator, other.DepthNumerator,
 833175            other.DepthDenominator, other.Root, other.Primitive, frame);
 833176    }
 177
 178    internal void Restore(CapsulePlaneRaySelectionMetadata metadata)
 179    {
 2718180        HasValue = metadata.HasValue; usesValueRoot = metadata.UsesValueRoot; Primitive = metadata.Primitive;
 1812181        CurrentSource = MaximumSource = metadata.Source; CurrentEvent = MaximumEvent = metadata.Event;
 906182        valueMetadata = metadata.Value;
 906183    }
 184
 185    internal void KeepValue(scoped ContactQuadratic x, scoped ContactQuadratic y, scoped ContactQuadratic z,
 186        scoped ContactQuadratic denominator, scoped ReadOnlySpan<ulong> root,
 187        scoped CapsulePlaneRayValue value, int primitive, in CapsulePlaneRayFrame frame)
 188    {
 307189        if (HasValue)
 190        {
 40191            int comparison = usesValueRoot ? value.Compare(Value)
 40192                : value.CompareQuadratic(DepthNumerator, DepthDenominator, Root);
 62193            if (comparison < 0) return;
 18194            if (comparison == 0)
 195            {
 7196                int order = frame.ComparePoints(x, y, z, denominator, root, X, Y, Z, Denominator, Root);
 11197                if (order > 0 || order == 0 && primitive >= Primitive) return;
 198            }
 199        }
 1124200        x.CopyTo(X); y.CopyTo(Y); z.CopyTo(Z); denominator.CopyTo(Denominator);
 281201        Span<ulong> destination = Values.Slice(12 * CoefficientWords, RadicalWords);
 562202        root.CopyTo(destination); destination[root.Length..].Clear();
 281203        var retained = new CapsulePlaneRayValue(Values[QuadraticWords..], ValueSigns, PolynomialWords);
 562204        retained.CopyFrom(value); valueMetadata = retained.Metadata;
 562205        HasValue = usesValueRoot = true; Primitive = primitive;
 562206        MaximumSource = CurrentSource; MaximumEvent = CurrentEvent;
 281207    }
 208
 209    internal bool TryGetDepth(in CapsulePlaneRayFrame frame, out Fixed64 depth)
 540210        => TryGetDepth(frame, out depth, out _);
 211
 212    internal bool TryGetDepth(in CapsulePlaneRayFrame frame, out Fixed64 depth, out bool clamped)
 213    {
 1896214        depth = default; clamped = false;
 949215        if (!HasValue) return false;
 947216        Signed320 doubleScale = WideArithmetic.AddSigned320(frame.Finite.ShapeFrame.CoordinateDenominator, frame.Finite.
 1073217        if (usesValueRoot) return Value.TryGetDepth(frame.NormalSquared, doubleScale, out depth, out clamped);
 1642218        Span<ulong> metric = stackalloc ulong[13]; WideArithmetic.GetMagnitude(frame.NormalSquared, metric);
 1642219        Span<ulong> scale = stackalloc ulong[5]; WideArithmetic.GetMagnitude(doubleScale, out scale[4], out scale[3], ou
 821220        clamped = !ContactQuadratic.TryRoundRootRatio(DepthNumerator, DepthDenominator, Root, metric, scale, out depth);
 825221        if (clamped) depth = Fixed64.MaxValue;
 821222        return true;
 223    }
 224
 225    internal bool ContainsTrianglePoint(in CapsulePlaneRayFrame frame, FixedTriangle triangle) =>
 349226        HasValue && frame.ContainsTrianglePoint(triangle, X, Y, Z, Denominator, Root);
 227
 228    /// <summary>Materializes the physical source point directly into a requested rigid sampling frame.</summary>
 229    internal bool TryGetPointInRigidFrame(in CapsulePlaneRayFrame frame, Vector3d samplingOrigin,
 230        FixedQuaternion samplingRotation, Vector3d center, FixedQuaternion rotation, out Vector3d point)
 231    {
 38232        point = default;
 39233        if (!HasValue) return false;
 37234        int words = Math.Max(CoefficientWords, ContactQuadratic.ActiveWords(Denominator) + 5);
 74235        Span<ulong> values = stackalloc ulong[2 * words]; Span<int> signs = stackalloc int[2];
 37236        ContactQuadratic d = ContactQuadratic.At(values, signs, 0, words);
 37237        ContactQuadratic.Scale(Denominator, GetCoordinateScale(frame), d);
 37238        return QuadraticPointMaterialization.TryGetPointInRigidFrame(center, rotation, samplingOrigin, samplingRotation,
 37239            X, Y, Z, d, Root, out point);
 240    }
 241    internal bool TryGetAuthoredPoint(in CapsulePlaneRayFrame frame, Vector3d meshOrigin, FixedQuaternion meshRotation,
 242        Vector3d center, FixedQuaternion rotation, out Vector3d point)
 243    {
 600244        point = default;
 601245        if (!HasValue) return false;
 1198246        Span<ulong> values = stackalloc ulong[2 * CoefficientWords]; Span<int> signs = stackalloc int[2];
 599247        ContactQuadratic d = ContactQuadratic.At(values, signs, 0, CoefficientWords);
 599248        ContactQuadratic.Scale(Denominator, GetCoordinateScale(frame), d);
 599249        return QuadraticPointMaterialization.TryGetPointInRigidFrame(center, rotation, meshOrigin, meshRotation,
 599250            X, Y, Z, d, Root, out point);
 251    }
 252
 253    internal bool TryGetExitAnchor(in CapsulePlaneRayFrame frame, int orientation,
 254        Vector3d center, FixedQuaternion rotation, out FixedPointAnchor anchor,
 255        out Fixed64 depth, out bool clamped)
 256    {
 1224257        anchor = default; depth = default; clamped = false;
 411258        if (orientation is not (1 or -1)) throw new ArgumentOutOfRangeException(nameof(orientation));
 406259        if (!HasValue) return false;
 404260        bool depthRepresented = TryGetDepth(frame, out depth, out clamped);
 261        System.Diagnostics.Debug.Assert(depthRepresented);
 808262        Span<ulong> values = stackalloc ulong[16 * CoefficientWords]; Span<int> signs = stackalloc int[16];
 808263        ContactQuadratic x = ContactQuadratic.At(values, signs, 0, CoefficientWords), y = ContactQuadratic.At(values, si
 808264        ContactQuadratic z = ContactQuadratic.At(values, signs, 2, CoefficientWords), d = ContactQuadratic.At(values, si
 808265        ContactQuadratic term = ContactQuadratic.At(values, signs, 4, CoefficientWords), work = ContactQuadratic.At(valu
 808266        ContactQuadratic zero = ContactQuadratic.At(values, signs, 6, CoefficientWords), scaled = ContactQuadratic.At(va
 404267        zero.Clear();
 404268        Signed320 coordinateScale = WideArithmetic.AddSigned320(frame.Finite.ShapeFrame.CoordinateDenominator, frame.Fin
 404269        WideDirection3d direction = orientation > 0 ? frame.Normal : -frame.Normal;
 404270        int endpoint = frame.Finite.Length == Fixed64.Zero ? 0 : Primitive == 1 ? -1 : Primitive == 2 ? 1 : 0;
 404271        Vector3d axial = default, radial;
 404272        if (usesValueRoot)
 273        {
 64274            CapsulePlaneRayValue value = Value;
 275            // A body primitive exists only for a positive-length core;
 276            // zero-core producers admit the sphere as the upper cap.
 64277            if (Primitive == 0)
 278            {
 18279                ContactQuadratic.Scale(Denominator, Signed576.ExtendValue(frame.Finite.ShapeFrame.Cap), work);
 36280                Y.CopyTo(term); term.Add(work, -1);
 18281                ContactQuadratic.Scale(Denominator, direction.Y, scaled);
 19282                if (value.SignLinear(term, scaled, Root) == 0) endpoint = 1;
 52283                else { Y.CopyTo(term); term.Add(work); if (value.SignLinear(term, scaled, Root) == 0) endpoint = -1; }
 284            }
 64285            if (endpoint == 0 && frame.Finite.Length != Fixed64.Zero)
 286            {
 16287                bool axialRepresented = value.TryGetPoint(zero, Y, zero, Denominator, Root,
 16288                    new WideDirection3d(default, direction.Y, default), coordinateScale, out axial);
 289                System.Diagnostics.Debug.Assert(axialRepresented);
 16290                y.Clear();
 291            }
 292            else
 293            {
 48294                Y.CopyTo(y);
 48295                Signed320 cap = endpoint < 0 ? WideArithmetic.Negate(frame.Finite.ShapeFrame.Cap)
 48296                    : endpoint > 0 ? frame.Finite.ShapeFrame.Cap : default;
 96297                ContactQuadratic.Scale(Denominator, Signed576.ExtendValue(cap), term); y.Add(term, -1);
 298            }
 64299            WideDirection3d radialDirection = endpoint == 0 && frame.Finite.Length != Fixed64.Zero
 64300                ? new(direction.X, default, direction.Z) : direction;
 64301            bool radialRepresented = value.TryGetPoint(X, y, Z, Denominator, Root, radialDirection, coordinateScale, out
 302            System.Diagnostics.Debug.Assert(radialRepresented);
 303        }
 304        else
 305        {
 340306            SetExitCoordinates(frame, orientation, x, y, z, d, term, work);
 340307            ContactQuadratic.Scale(d, Signed576.ExtendValue(frame.Finite.ShapeFrame.Cap), work);
 340308            if (Primitive == 0)
 309            {
 338310                y.CopyTo(term); term.Add(work, -1);
 237311                if (term.Sign(Root) == 0) endpoint = 1;
 371312                else { y.CopyTo(term); term.Add(work); if (term.Sign(Root) == 0) endpoint = -1; }
 313            }
 340314            ContactQuadratic.Scale(d, GetCoordinateScale(frame), scaled);
 340315            if (endpoint == 0 && frame.Finite.Length != Fixed64.Zero)
 316            {
 33317                bool axialRepresented = QuadraticPointMaterialization.TryGetWorldPoint(Vector3d.Zero, FixedQuaternion.Id
 33318                    zero, y, zero, scaled, Root, out axial);
 319                System.Diagnostics.Debug.Assert(axialRepresented);
 33320                y.Clear();
 321            }
 307322            else y.Add(work, -endpoint);
 340323            bool radialRepresented = QuadraticPointMaterialization.TryGetWorldPoint(Vector3d.Zero, FixedQuaternion.Ident
 340324                x, y, z, scaled, Root, out radial);
 325            System.Diagnostics.Debug.Assert(radialRepresented);
 326        }
 404327        FixedPointAnchorTerm3d exactTerm = default;
 404328        if (endpoint != 0)
 329        {
 283330            Fixed64 signedLength = endpoint > 0 ? frame.Finite.Length : -frame.Finite.Length;
 283331            axial = new Vector3d(Fixed64.Zero, signedLength / Fixed64.Two, Fixed64.Zero);
 332            // The endpoint's half-raw remainder stays separate from the
 333            // independently rounded, bounded radial exit.
 283334            exactTerm = FixedPointAnchorTerm3d.CreateCenteredAxisSupport(Vector3d.Up, signedLength,
 283335                Vector3d.Zero, Fixed64.Zero, axial, Vector3d.Zero);
 336        }
 404337        anchor = new FixedPointAnchor(center, rotation, axial, radial, exactTerm);
 404338        return true;
 339    }
 340
 341    private void SetExitCoordinates(in CapsulePlaneRayFrame frame, int orientation, scoped ContactQuadratic x,
 342        scoped ContactQuadratic y, scoped ContactQuadratic z, scoped ContactQuadratic d,
 343        scoped ContactQuadratic term, scoped ContactQuadratic work)
 344    {
 340345        ContactQuadratic.Multiply(Denominator, DepthDenominator, Root, d);
 340346        ContactQuadratic.Multiply(Denominator, DepthNumerator, Root, term);
 2720347        for (int axis = 0; axis < 3; axis++)
 348        {
 1020349            ContactQuadratic source = axis == 0 ? X : axis == 1 ? Y : Z;
 1020350            ContactQuadratic target = axis == 0 ? x : axis == 1 ? y : z;
 1020351            ContactQuadratic.Multiply(source, DepthDenominator, Root, target);
 1020352            Signed576 direction = axis == 0 ? frame.Normal.X : axis == 1 ? frame.Normal.Y : frame.Normal.Z;
 2040353            ContactQuadratic.Scale(term, direction, work); target.Add(work, orientation);
 354        }
 340355    }
 356
 357    private static Signed576 GetCoordinateScale(in CapsulePlaneRayFrame frame) =>
 976358        Signed576.ExtendValue(WideArithmetic.AddSigned320(frame.Finite.ShapeFrame.CoordinateDenominator, frame.Finite.Sh
 359}

Methods/Properties

ContainsTrianglePoint(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Geometry.FixedTriangle,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
get_QuadraticWords()
GetStorageWords(System.Int32,System.Int32,System.Int32)
get_X()
get_Y()
get_Z()
get_Denominator()
get_DepthNumerator()
get_DepthDenominator()
get_Root()
get_Metadata()
ComparePoint(FixedMathSharp.Geometry.CapsulePlaneRaySelection&,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
.ctor(System.Span`1<System.UInt64>,System.Span`1<System.Int32>,System.Span`1<System.SByte>,System.Int32,System.Int32,System.Int32)
get_Value()
Keep(FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,System.ReadOnlySpan`1<System.UInt64>,System.Int32,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
CompareDepth(FixedMathSharp.Geometry.CapsulePlaneRaySelection&)
CompareSquaredDepth(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,System.ReadOnlySpan`1<System.UInt64>)
CompareCoplanarDepth(FixedMathSharp.Geometry.CapsulePlaneRaySelection&,FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
KeepEvaluated(FixedMathSharp.Geometry.CapsulePlaneRaySelection,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
Restore(FixedMathSharp.Geometry.CapsulePlaneRaySelectionMetadata)
KeepValue(FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,System.ReadOnlySpan`1<System.UInt64>,FixedMathSharp.Geometry.CapsulePlaneRayValue,System.Int32,FixedMathSharp.Geometry.CapsulePlaneRayFrame&)
TryGetDepth(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Fixed64&)
TryGetDepth(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Fixed64&,System.Boolean&)
ContainsTrianglePoint(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Geometry.FixedTriangle)
TryGetPointInRigidFrame(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Vector3d&)
TryGetAuthoredPoint(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Vector3d&)
TryGetExitAnchor(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,System.Int32,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Geometry.FixedPointAnchor&,FixedMathSharp.Fixed64&,System.Boolean&)
SetExitCoordinates(FixedMathSharp.Geometry.CapsulePlaneRayFrame&,System.Int32,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic,FixedMathSharp.Geometry.ContactQuadratic)
GetCoordinateScale(FixedMathSharp.Geometry.CapsulePlaneRayFrame&)