< 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: 86
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 FixedMathSharp;
 9using System;
 10using System.Runtime.CompilerServices;
 11
 12namespace Gravitas.Colliders;
 13
 14internal readonly struct ColliderShapeSnapshot2D : IEquatable<ColliderShapeSnapshot2D>
 15{
 16    public ColliderShapeSnapshot2D(
 17        Vector2d center,
 18        Fixed64 rotation,
 19        Vector2d ownerScale,
 20        Vector2d partScale,
 21        Vector2d localOffset,
 22        uint shapeVersion,
 23        Fixed64 mixedSlabCenterY,
 24        Fixed64 mixedHalfThickness)
 25    {
 2106026        Center = center;
 2106027        Rotation = rotation;
 2106028        OwnerScale = ownerScale;
 2106029        PartScale = partScale;
 2106030        LocalOffset = localOffset;
 2106031        ShapeVersion = shapeVersion;
 2106032        MixedSlabCenterY = mixedSlabCenterY;
 2106033        MixedHalfThickness = mixedHalfThickness;
 2106034    }
 35
 36    public Vector2d Center { get; }
 37
 38    public Fixed64 Rotation { get; }
 39
 40    public Vector2d OwnerScale { get; }
 41
 42    public Vector2d PartScale { get; }
 43
 44    public Vector2d LocalOffset { get; }
 45
 46    public uint ShapeVersion { get; }
 47
 48    public Fixed64 MixedSlabCenterY { get; }
 49
 50    public Fixed64 MixedHalfThickness { get; }
 51
 52    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 53    public bool Equals(ColliderShapeSnapshot2D other) =>
 1458554        Center == other.Center
 1458555        && Rotation == other.Rotation
 1458556        && OwnerScale == other.OwnerScale
 1458557        && PartScale == other.PartScale
 1458558        && LocalOffset == other.LocalOffset
 1458559        && ShapeVersion == other.ShapeVersion
 1458560        && MixedSlabCenterY == other.MixedSlabCenterY
 1458561        && MixedHalfThickness == other.MixedHalfThickness;
 62
 63    public override bool Equals(object? obj) =>
 464        obj is ColliderShapeSnapshot2D other && Equals(other);
 65
 66    public override int GetHashCode()
 67    {
 68        unchecked
 69        {
 270            int hash = 17;
 271            hash = hash * 31 + Center.X.GetHashCode();
 272            hash = hash * 31 + Center.Y.GetHashCode();
 273            hash = hash * 31 + Rotation.GetHashCode();
 274            hash = hash * 31 + OwnerScale.X.GetHashCode();
 275            hash = hash * 31 + OwnerScale.Y.GetHashCode();
 276            hash = hash * 31 + PartScale.X.GetHashCode();
 277            hash = hash * 31 + PartScale.Y.GetHashCode();
 278            hash = hash * 31 + LocalOffset.X.GetHashCode();
 279            hash = hash * 31 + LocalOffset.Y.GetHashCode();
 280            hash = hash * 31 + ShapeVersion.GetHashCode();
 281            hash = hash * 31 + MixedSlabCenterY.GetHashCode();
 282            hash = hash * 31 + MixedHalfThickness.GetHashCode();
 283            return hash;
 84        }
 85    }
 86}