< Summary

Information
Class: Gravitas.Colliders.ColliderPartitionState2D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/State/ColliderPartitionState2D.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 62
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
MarkBroadPhaseChanged()100%11100%
MarkPartitioned()100%11100%
MarkUnpartitioned()100%11100%
MatchesGridBounds(...)100%66100%
SetPreviousGridBounds(...)100%11100%
ClearCoordinates()100%22100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/State/ColliderPartitionState2D.cs

#LineLine coverage
 1//=======================================================================
 2// ColliderPartitionState2D.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 System.Runtime.CompilerServices;
 9using FixedMathSharp;
 10using GridForge.Spatial;
 11using SwiftCollections;
 12
 13namespace Gravitas.Colliders;
 14
 15/// <summary>
 16/// Tracks planar partition memberships, previous grid bounds, and broad-phase changes.
 17/// </summary>
 18internal struct ColliderPartitionState2D
 19{
 20    public bool IsPartitioned { get; private set; }
 21
 22    public uint BroadPhaseVersion { get; private set; }
 23
 24    public Vector2d LastGridBoundsMin { get; private set; }
 25
 26    public Vector2d LastGridBoundsMax { get; private set; }
 27
 28    public int LastPartitionKind { get; private set; }
 29
 30    public SwiftList<WorldVoxelIndex>? Coordinates;
 31
 32    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 2204733    public void MarkBroadPhaseChanged() => BroadPhaseVersion++;
 34
 35    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 36    public void MarkPartitioned()
 37    {
 2204738        IsPartitioned = true;
 2204739        MarkBroadPhaseChanged();
 2204740    }
 41
 42    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 308043    public void MarkUnpartitioned() => IsPartitioned = false;
 44
 45    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 46    public bool MatchesGridBounds(Vector2d min, Vector2d max, int partitionKind) =>
 1491647        IsPartitioned
 1491648        && LastGridBoundsMin == min
 1491649        && LastGridBoundsMax == max
 1491650        && LastPartitionKind == partitionKind;
 51
 52    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 53    public void SetPreviousGridBounds(Vector2d min, Vector2d max, int partitionKind = 0)
 54    {
 2204755        LastGridBoundsMin = min;
 2204756        LastGridBoundsMax = max;
 2204757        LastPartitionKind = partitionKind;
 2204758    }
 59
 60    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 134461    public void ClearCoordinates() => Coordinates?.Clear();
 62}