< Summary

Information
Class: Gravitas.CollisionHandling.SolverContact2D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/2D/SolverContact2D.cs
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 94
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/2D/SolverContact2D.cs

#LineLine coverage
 1//=======================================================================
 2// SolverContact2D.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;
 9using Gravitas.Materials;
 10
 11namespace Gravitas.CollisionHandling;
 12
 13
 14
 15/// <summary>
 16/// Solver-ready scalar pure 2D contact data.
 17/// </summary>
 18internal readonly struct SolverContact2D
 19{
 20    public SolverContact2D(
 21        int groupIndex,
 22        int pointIndex,
 23        ulong contactId,
 24        ResponseBody2D bodyA,
 25        ResponseBody2D bodyB,
 26        ContactLever2D relativeA,
 27        ContactLever2D relativeB,
 28        Fixed64 depth,
 29        Vector2d normal,
 30        PhysicsMaterial materialA,
 31        PhysicsMaterial materialB,
 32        Fixed64 cachedNormalImpulse,
 33        Fixed64 cachedTangentImpulse,
 34        ContactGroupKey group = default)
 35    {
 1774836        Group = group;
 1774837        GroupIndex = groupIndex;
 1774838        PointIndex = pointIndex;
 1774839        ContactId = contactId;
 1774840        A = bodyA;
 1774841        B = bodyB;
 1774842        RelativeA = relativeA;
 1774843        RelativeB = relativeB;
 1774844        Depth = depth;
 1774845        Normal = normal;
 1774846        MaterialA = materialA;
 1774847        MaterialB = materialB;
 1774848        PhysicsMaterial.CombineFriction(materialA, materialB, out Fixed64 staticFriction, out Fixed64 dynamicFriction);
 1774849        StaticFriction = staticFriction;
 1774850        DynamicFriction = dynamicFriction;
 1774851        Restitution = PhysicsMaterial.CombineRestitution(materialA, materialB);
 1774852        Tangent = normal.RightHandNormal;
 1774853        CachedNormalImpulse = cachedNormalImpulse;
 1774854        CachedTangentImpulse = cachedTangentImpulse;
 1774855    }
 56
 57    // Cache provenance beside the row; repeated manifold lookups cost more than this small copy.
 58    internal ContactGroupKey Group { get; }
 59
 60    public int GroupIndex { get; }
 61
 62    public int PointIndex { get; }
 63
 64    public ulong ContactId { get; }
 65
 66    public ResponseBody2D A { get; }
 67
 68    public ResponseBody2D B { get; }
 69
 70    public ContactLever2D RelativeA { get; }
 71
 72    public ContactLever2D RelativeB { get; }
 73
 74    public Fixed64 Depth { get; }
 75
 76    public Vector2d Normal { get; }
 77
 78    public PhysicsMaterial MaterialA { get; }
 79
 80    public PhysicsMaterial MaterialB { get; }
 81
 82    public Fixed64 StaticFriction { get; }
 83
 84    public Fixed64 DynamicFriction { get; }
 85
 86    public Fixed64 Restitution { get; }
 87
 88    public Vector2d Tangent { get; }
 89
 90    public Fixed64 CachedNormalImpulse { get; }
 91
 92    public Fixed64 CachedTangentImpulse { get; }
 93
 94}