< 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    {
 97828        Axis = axis;
 97829        Negate = negate;
 97830        ExactOverlap = exactOverlap;
 97831        ExactSquaredAxisLength = exactSquaredAxisLength;
 97832        ExactCommonDenominator = exactCommonDenominator;
 97833        HasValue = true;
 97834    }
 35
 36    internal bool HasValue { get; }
 37
 38    internal bool ShouldReplace(
 39        Signed576 overlap,
 40        Signed576 squaredAxisLength,
 41        Signed320 commonDenominator)
 42    {
 939143        if (!HasValue)
 40944            return true;
 898245        return WideArithmetic.CompareNonNegativeNormalizedDepths(
 898246            overlap,
 898247            squaredAxisLength,
 898248            commonDenominator,
 898249            ExactOverlap,
 898250            ExactSquaredAxisLength,
 898251            ExactCommonDenominator) < 0;
 52    }
 53
 54    internal Fixed64 GetRoundedDepth(out bool isClamped) =>
 38155        WideArithmetic.GetRoundedNonNegativeNormalizedDepth(
 38156            ExactOverlap,
 38157            ExactSquaredAxisLength,
 38158            ExactCommonDenominator,
 38159            out isClamped);
 60}