< Summary

Information
Class: Gravitas.CollisionHandling.ContactLever2D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Response/2D/ContactLever2D.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 39
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_Zero()100%11100%
Create(...)100%22100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// ContactLever2D.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/// Carries a 2D contact lever or signals that the solver must use exact anchor arithmetic.
 14/// </summary>
 15internal readonly struct ContactLever2D
 16{
 17    private ContactLever2D(Vector2d vector, bool isExact)
 18    {
 3559819        Vector = vector;
 3559820        IsExact = isExact;
 3559821    }
 22
 23    internal bool IsExact { get; }
 24
 25    internal Vector2d Vector { get; }
 26
 27    internal static ContactLever2D Zero =>
 437328        new(Vector2d.Zero, isExact: false);
 29
 30    internal static ContactLever2D Create(
 31        in ContactAnchor2D point,
 32        in ContactAnchor2D origin)
 33    {
 3122534        if (point.TryGetOffsetFrom(origin, out Vector2d vector))
 3120335            return new ContactLever2D(vector, isExact: false);
 36
 2237        return new ContactLever2D(default, isExact: true);
 38    }
 39}