< Summary

Information
Class: FixedMathSharp.Geometry.WidePointSpanPenetration
Assembly: FixedMathSharp
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Common/WidePointSpanPenetration.cs
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 60
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ShouldReplace(...)100%22100%
GetRoundedDepth(...)100%11100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/Common/WidePointSpanPenetration.cs

#LineLine coverage
 1//=======================================================================
 2// WidePointSpanPenetration.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
 8namespace FixedMathSharp.Geometry;
 9
 10/// <summary>
 11/// Retains one exact point-span SAT penetration for ranking and materialization.
 12/// </summary>
 13internal readonly struct WidePointSpanPenetration
 14{
 15    internal readonly WideAxis3 Axis;
 16    internal readonly bool Negate;
 17    internal readonly Signed576 ExactOverlap;
 18    internal readonly Signed576 ExactSquaredAxisLength;
 19    internal readonly Signed320 ExactCommonDenominator;
 20
 21    internal WidePointSpanPenetration(
 22        WideAxis3 axis,
 23        bool negate,
 24        Signed576 exactOverlap,
 25        Signed576 exactSquaredAxisLength,
 26        Signed320 exactCommonDenominator)
 27    {
 192928        Axis = axis;
 192929        Negate = negate;
 192930        ExactOverlap = exactOverlap;
 192931        ExactSquaredAxisLength = exactSquaredAxisLength;
 192932        ExactCommonDenominator = exactCommonDenominator;
 192933        HasValue = true;
 192934    }
 35
 36    internal bool HasValue { get; }
 37
 38    internal bool ShouldReplace(
 39        Signed576 overlap,
 40        Signed576 squaredAxisLength,
 41        Signed320 commonDenominator)
 42    {
 1489243        if (!HasValue)
 98644            return true;
 1390645        return WideArithmetic.CompareNonNegativeNormalizedDepths(
 1390646            overlap,
 1390647            squaredAxisLength,
 1390648            commonDenominator,
 1390649            ExactOverlap,
 1390650            ExactSquaredAxisLength,
 1390651            ExactCommonDenominator) < 0;
 52    }
 53
 54    internal Fixed64 GetRoundedDepth(out bool isClamped) =>
 42755        WideArithmetic.GetRoundedNonNegativeNormalizedDepth(
 42756            ExactOverlap,
 42757            ExactSquaredAxisLength,
 42758            ExactCommonDenominator,
 42759            out isClamped);
 60}