< Summary

Information
Class: Gravitas.CollisionHandling.ExactContactResponseOperand3D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/Exact/ExactContactResponseOperand3D.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 57
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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%
CanRepresentAngularDelta(...)100%22100%
CanApplyAngularDelta(...)100%44100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// ExactContactResponseOperand3D.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/// Describes one participant in an exact rigid-body contact response.
 14/// </summary>
 15internal readonly struct ExactContactResponseOperand3D
 16{
 17    internal ExactContactResponseOperand3D(
 18        in ExactLever3D lever,
 19        Vector3d linearVelocity,
 20        Vector3d angularVelocity,
 21        Vector3d linearImpulseAxis,
 22        Fixed64 inverseMass,
 23        Fixed3x3 inverseInertia,
 24        Fixed64? planarAngularVelocity = null)
 25    {
 3439026        Lever = lever;
 3439027        LinearVelocity = linearVelocity;
 3439028        AngularVelocity = angularVelocity;
 3439029        LinearImpulseAxis = linearImpulseAxis;
 3439030        InverseMass = inverseMass;
 3439031        InverseInertia = inverseInertia;
 3439032        PlanarAngularVelocity = planarAngularVelocity;
 3439033    }
 34
 35    internal ExactLever3D Lever { get; }
 36
 37    internal Vector3d LinearVelocity { get; }
 38
 39    internal Vector3d AngularVelocity { get; }
 40
 41    // The spatial sign conversion of minimum planar yaw does not fit Fixed64.
 42    internal Fixed64? PlanarAngularVelocity { get; }
 43
 44    // Positive 2^31 yaw delta cannot be represented by the planar delta API.
 45    internal bool CanRepresentAngularDelta(Vector3d delta) =>
 3254046        !PlanarAngularVelocity.HasValue || delta.Y != Fixed64.MinValue;
 47
 35148    internal bool CanApplyAngularDelta(Vector3d delta) => PlanarAngularVelocity.HasValue
 35149        ? CanRepresentAngularDelta(delta) && Fixed64.TrySubtract(PlanarAngularVelocity.Value, delta.Y, out _)
 35150        : Vector3d.TryAdd(AngularVelocity, delta, out _);
 51
 52    internal Vector3d LinearImpulseAxis { get; }
 53
 54    internal Fixed64 InverseMass { get; }
 55
 56    internal Fixed3x3 InverseInertia { get; }
 57}