< Summary

Information
Class: FixedMathSharp.Geometry.FixedPointAnchorTerm2d
Assembly: FixedMathSharp
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Anchors/FixedPointAnchorTerm2d.cs
Line coverage
100%
Covered lines: 31
Uncovered lines: 0
Coverable lines: 31
Total lines: 77
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
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_IsZero()100%22100%
CreateCenteredAxisSupport(...)100%11100%
CreateRadialSupport(...)100%11100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Anchors/FixedPointAnchorTerm2d.cs

#LineLine coverage
 1//=======================================================================
 2// FixedPointAnchorTerm2d.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace FixedMathSharp.Geometry;
 11
 12/// <summary>
 13/// Two-dimensional counterpart of <see cref="FixedPointAnchorTerm3d"/>.
 14/// </summary>
 15internal readonly struct FixedPointAnchorTerm2d :
 16    IEquatable<FixedPointAnchorTerm2d>
 17{
 18    internal readonly long X;
 19    internal readonly long Y;
 20
 21    private FixedPointAnchorTerm2d(long x, long y)
 22    {
 64523        X = x;
 64524        Y = y;
 64525    }
 26
 83427    internal bool IsZero => X == 0L && Y == 0L;
 28
 29    internal static FixedPointAnchorTerm2d CreateCenteredAxisSupport(
 30        Vector2d localAxis,
 31        Fixed64 signedAxisLength,
 32        Vector2d localRadialDirection,
 33        Fixed64 radius,
 34        Vector2d roundedAxialOffset,
 35        Vector2d roundedRadialOffset) =>
 64536        new(
 64537            FixedPointAnchorTerm3d.GetResidual(
 64538                localAxis.X,
 64539                signedAxisLength,
 64540                localRadialDirection.X,
 64541                radius,
 64542                roundedAxialOffset.X,
 64543                roundedRadialOffset.X),
 64544            FixedPointAnchorTerm3d.GetResidual(
 64545                localAxis.Y,
 64546                signedAxisLength,
 64547                localRadialDirection.Y,
 64548                radius,
 64549                roundedAxialOffset.Y,
 64550                roundedRadialOffset.Y));
 51
 52    internal static FixedPointAnchorTerm2d CreateRadialSupport(
 53        Vector2d localRadialDirection,
 54        Fixed64 radius,
 55        Vector2d roundedRadialOffset) =>
 5556        CreateCenteredAxisSupport(
 5557            Vector2d.Zero,
 5558            Fixed64.Zero,
 5559            localRadialDirection,
 5560            radius,
 5561            Vector2d.Zero,
 5562            roundedRadialOffset);
 63
 64    public bool Equals(FixedPointAnchorTerm2d other) =>
 2465        X == other.X && Y == other.Y;
 66
 67    public override int GetHashCode()
 68    {
 69        unchecked
 70        {
 271            int hash = 17;
 272            hash = (hash * 31) + X.GetHashCode();
 273            hash = (hash * 31) + Y.GetHashCode();
 274            return hash;
 75        }
 76    }
 77}