< Summary

Information
Class: FixedMathSharp.Geometry.ConvexContactCandidate
Assembly: FixedMathSharp
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Convex/ConvexContactCandidate.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 51
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
NormalRational(...)100%11100%
NormalRadical(...)100%11100%
get_NormalRadicand()100%11100%
get_GapRational()100%11100%
get_GapRationalSign()100%11100%
get_GapRadical()100%11100%
get_GapRadicalSign()100%11100%
get_GapRadicand()100%11100%
get_GapDenominator()100%11100%
Slot(...)100%11100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Convex/ConvexContactCandidate.cs

#LineLine coverage
 1//=======================================================================
 2// ConvexContactCandidate.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/// <summary>
 13/// A nonzero normal a+b sqrt(K) and signed raw gap
 14/// GapSign sqrt((A+B sqrt(C))/D), with positive D and nonnegative radicand.
 15/// </summary>
 16/// <remarks>
 17/// Each little-endian magnitude occupies the caller-selected field width (forty words by default). Slots 0..2 are a,
 18/// 3..5 are b, 6 is K, and 7..10 are A, B, C, D. Signs 0..5, 7, and 8
 19/// are -1, 0, or 1, with zero sign exactly for zero magnitude; unused
 20/// signs do not affect the value. GapSign is zero exactly when the gap is
 21/// zero. Builders prove these invariants before admission; this view neither
 22/// copies nor mutates their borrowed storage.
 23/// </remarks>
 24internal readonly ref struct ConvexContactCandidate
 25{
 26    internal const int Words = 40;
 27    internal const int Slots = 11;
 28
 29    internal ConvexContactCandidate(ReadOnlySpan<ulong> values, ReadOnlySpan<int> signs, int gapSign, int fieldWords = W
 30    {
 24030431        _fieldWords = fieldWords;
 24030432        Values = values;
 24030433        Signs = signs;
 24030434        GapSign = gapSign;
 24030435    }
 36
 37    private readonly int _fieldWords;
 38    internal ReadOnlySpan<ulong> Values { get; }
 39    internal ReadOnlySpan<int> Signs { get; }
 40    internal int GapSign { get; }
 3440741    internal ReadOnlySpan<ulong> NormalRational(int component) => Slot(component);
 3438642    internal ReadOnlySpan<ulong> NormalRadical(int component) => Slot(component + 3);
 4327743    internal ReadOnlySpan<ulong> NormalRadicand => Slot(6);
 47546544    internal ReadOnlySpan<ulong> GapRational => Slot(7);
 23534645    internal int GapRationalSign => Signs[7];
 47397246    internal ReadOnlySpan<ulong> GapRadical => Slot(8);
 23423747    internal int GapRadicalSign => Signs[8];
 23699448    internal ReadOnlySpan<ulong> GapRadicand => Slot(9);
 91743749    internal ReadOnlySpan<ulong> GapDenominator => Slot(10);
 221593850    private ReadOnlySpan<ulong> Slot(int slot) => Values.Slice(slot * _fieldWords, _fieldWords);
 51}