< Summary

Information
Class: Trailblazer.Pathing.NavigationNodeState
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationNodeState.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 59
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_IsBlocked()100%11100%
TryGetCenteredVolumeFootAnchor(...)100%44100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationNodeState.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationNodeState.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 FixedMathSharp;
 9
 10namespace Trailblazer.Pathing;
 11
 12/// <summary>Exposes effective semantic and mirrored physical state for one snapshot node.</summary>
 13internal readonly struct NavigationNodeState
 14{
 15    internal NavigationNodeState(
 16        NavigationCell cell,
 17        bool isPresent,
 18        byte obstacleCount,
 19        Vector3d center,
 20        Vector3d footAnchor)
 21    {
 96380922        Cell = cell;
 96380923        IsPresent = isPresent;
 96380924        ObstacleCount = obstacleCount;
 96380925        Center = center;
 96380926        FootAnchor = footAnchor;
 96380927    }
 28
 29    internal NavigationCell Cell { get; }
 30
 31    internal bool IsPresent { get; }
 32
 133    internal bool IsBlocked => ObstacleCount > 0;
 34
 35    internal byte ObstacleCount { get; }
 36
 37    internal Vector3d Center { get; }
 38
 39    internal Vector3d FootAnchor { get; }
 40
 41    internal bool TryGetCenteredVolumeFootAnchor(
 42        Fixed64 bodyHeight,
 43        out Vector3d footAnchor)
 44    {
 621145        if (bodyHeight <= Fixed64.Zero
 621146            || !Fixed64.TryMultiplyAdd(
 621147                bodyHeight,
 621148                -Fixed64.Half,
 621149                Center.Y,
 621150                out Fixed64 footY))
 51        {
 952            footAnchor = default;
 953            return false;
 54        }
 55
 620256        footAnchor = new Vector3d(Center.X, footY, Center.Z);
 620257        return true;
 58    }
 59}