< Summary

Information
Class: Gravitas.CollisionHandling.ContactEffectiveMassTerms3D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/3D/ContactEffectiveMassTerms3D.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 53
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%
get_SaturatedSum()100%11100%
TryGetValue(...)100%22100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/3D/ContactEffectiveMassTerms3D.cs

#LineLine coverage
 1//=======================================================================
 2// ContactEffectiveMassTerms3D.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using FixedMathSharp;
 9
 10namespace Gravitas.CollisionHandling;
 11
 12/// <summary>
 13/// Stores each body's linear and angular contributions to 3D contact effective mass.
 14/// </summary>
 15internal readonly struct ContactEffectiveMassTerms3D
 16{
 17    internal ContactEffectiveMassTerms3D(
 18        Fixed64 linearA,
 19        Fixed64 linearB,
 20        Fixed64 angularA,
 21        Fixed64 angularB)
 22    {
 61363823        LinearA = linearA;
 61363824        LinearB = linearB;
 61363825        AngularA = angularA;
 61363826        AngularB = angularB;
 61363827    }
 28
 29    internal Fixed64 LinearA { get; }
 30
 31    internal Fixed64 LinearB { get; }
 32
 33    internal Fixed64 AngularA { get; }
 34
 35    internal Fixed64 AngularB { get; }
 36
 37    internal Fixed64 SaturatedSum =>
 59486838        LinearA + LinearB + AngularA + AngularB;
 39
 40    internal bool TryGetValue(out Fixed64 value)
 41    {
 1876842        bool resolved =
 1876843            Fixed64.TryAdd(LinearA, LinearB, out Fixed64 linear);
 1876844        resolved &= Fixed64.TryAdd(
 1876845            linear,
 1876846            AngularA,
 1876847            out Fixed64 first);
 1876848        resolved &= Fixed64.TryAdd(first, AngularB, out value);
 1876849        if (!resolved)
 350            value = default;
 1876851        return resolved;
 52    }
 53}