< Summary

Information
Class: Gravitas.CollisionHandling.ExactCoulombResponse3D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/Exact/ExactCoulombResponse3D.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 66
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%22100%
TryGetPrimaryAccumulatedImpulse(...)100%11100%
TryGetSecondaryAccumulatedImpulse(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/Exact/ExactCoulombResponse3D.cs

#LineLine coverage
 1//=======================================================================
 2// ExactCoulombResponse3D.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/// Contains atomically materialized velocity deltas from an exact Coulomb
 14/// response.
 15/// </summary>
 16internal readonly struct ExactCoulombResponse3D
 17{
 18    private readonly Fixed64 _primaryAccumulatedImpulse;
 19    private readonly Fixed64 _secondaryAccumulatedImpulse;
 20    private readonly byte _projectionFlags;
 21
 22    internal ExactCoulombResponse3D(
 23        bool hasAppliedImpulse,
 24        Vector3d firstLinearVelocityDelta,
 25        Vector3d firstAngularVelocityDelta,
 26        Vector3d secondLinearVelocityDelta,
 27        Vector3d secondAngularVelocityDelta,
 28        bool hasPrimaryAccumulatedImpulse,
 29        Fixed64 primaryAccumulatedImpulse,
 30        bool hasSecondaryAccumulatedImpulse,
 31        Fixed64 secondaryAccumulatedImpulse)
 32    {
 48333        HasAppliedImpulse = hasAppliedImpulse;
 48334        FirstLinearVelocityDelta = firstLinearVelocityDelta;
 48335        FirstAngularVelocityDelta = firstAngularVelocityDelta;
 48336        SecondLinearVelocityDelta = secondLinearVelocityDelta;
 48337        SecondAngularVelocityDelta = secondAngularVelocityDelta;
 48338        _primaryAccumulatedImpulse = primaryAccumulatedImpulse;
 48339        _secondaryAccumulatedImpulse = secondaryAccumulatedImpulse;
 48340        _projectionFlags = (byte)(
 48341            (hasPrimaryAccumulatedImpulse ? 1 : 0)
 48342            | (hasSecondaryAccumulatedImpulse ? 2 : 0));
 48343    }
 44
 45    internal bool HasAppliedImpulse { get; }
 46
 47    internal Vector3d FirstLinearVelocityDelta { get; }
 48
 49    internal Vector3d FirstAngularVelocityDelta { get; }
 50
 51    internal Vector3d SecondLinearVelocityDelta { get; }
 52
 53    internal Vector3d SecondAngularVelocityDelta { get; }
 54
 55    internal bool TryGetPrimaryAccumulatedImpulse(out Fixed64 value)
 56    {
 42957        value = _primaryAccumulatedImpulse;
 42958        return (_projectionFlags & 1) != 0;
 59    }
 60
 61    internal bool TryGetSecondaryAccumulatedImpulse(out Fixed64 value)
 62    {
 39463        value = _secondaryAccumulatedImpulse;
 39464        return (_projectionFlags & 2) != 0;
 65    }
 66}