< Summary

Information
Class: Gravitas.Colliders.ColliderShapeSnapshot2D
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/Definitions/ColliderShapeSnapshot2D.cs
Line coverage
100%
Covered lines: 32
Uncovered lines: 0
Coverable lines: 32
Total lines: 89
Line coverage: 100%
Branch coverage
100%
Covered branches: 16
Total branches: 16
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%
Equals(...)100%1414100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/Definitions/ColliderShapeSnapshot2D.cs

#LineLine coverage
 1//=======================================================================
 2// ColliderShapeSnapshot2D.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;
 9using System.Runtime.CompilerServices;
 10using FixedMathSharp;
 11
 12namespace Gravitas.Colliders;
 13
 14/// <summary>
 15/// Captures the planar pose, shape version, and mixed slab inputs used to track geometry changes.
 16/// </summary>
 17internal readonly struct ColliderShapeSnapshot2D : IEquatable<ColliderShapeSnapshot2D>
 18{
 19    public ColliderShapeSnapshot2D(
 20        Vector2d center,
 21        Fixed64 rotation,
 22        Vector2d ownerScale,
 23        Vector2d partScale,
 24        Vector2d localOffset,
 25        uint shapeVersion,
 26        Fixed64 mixedSlabCenterY,
 27        Fixed64 mixedHalfThickness)
 28    {
 9744729        Center = center;
 9744730        Rotation = rotation;
 9744731        OwnerScale = ownerScale;
 9744732        PartScale = partScale;
 9744733        LocalOffset = localOffset;
 9744734        ShapeVersion = shapeVersion;
 9744735        MixedSlabCenterY = mixedSlabCenterY;
 9744736        MixedHalfThickness = mixedHalfThickness;
 9744737    }
 38
 39    public Vector2d Center { get; }
 40
 41    public Fixed64 Rotation { get; }
 42
 43    public Vector2d OwnerScale { get; }
 44
 45    public Vector2d PartScale { get; }
 46
 47    public Vector2d LocalOffset { get; }
 48
 49    public uint ShapeVersion { get; }
 50
 51    public Fixed64 MixedSlabCenterY { get; }
 52
 53    public Fixed64 MixedHalfThickness { get; }
 54
 55    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 56    public bool Equals(ColliderShapeSnapshot2D other) =>
 6577257        Center == other.Center
 6577258        && Rotation == other.Rotation
 6577259        && OwnerScale == other.OwnerScale
 6577260        && PartScale == other.PartScale
 6577261        && LocalOffset == other.LocalOffset
 6577262        && ShapeVersion == other.ShapeVersion
 6577263        && MixedSlabCenterY == other.MixedSlabCenterY
 6577264        && MixedHalfThickness == other.MixedHalfThickness;
 65
 66    public override bool Equals(object? obj) =>
 467        obj is ColliderShapeSnapshot2D other && Equals(other);
 68
 69    public override int GetHashCode()
 70    {
 71        unchecked
 72        {
 273            int hash = 17;
 274            hash = hash * 31 + Center.X.GetHashCode();
 275            hash = hash * 31 + Center.Y.GetHashCode();
 276            hash = hash * 31 + Rotation.GetHashCode();
 277            hash = hash * 31 + OwnerScale.X.GetHashCode();
 278            hash = hash * 31 + OwnerScale.Y.GetHashCode();
 279            hash = hash * 31 + PartScale.X.GetHashCode();
 280            hash = hash * 31 + PartScale.Y.GetHashCode();
 281            hash = hash * 31 + LocalOffset.X.GetHashCode();
 282            hash = hash * 31 + LocalOffset.Y.GetHashCode();
 283            hash = hash * 31 + ShapeVersion.GetHashCode();
 284            hash = hash * 31 + MixedSlabCenterY.GetHashCode();
 285            hash = hash * 31 + MixedHalfThickness.GetHashCode();
 286            return hash;
 87        }
 88    }
 89}