< Summary

Information
Class: Trailblazer.Pathing.NavigationChartExtensions
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Diagnostics/NavigationChart.Extensions.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 56
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
PrintWalkablePositions(...)100%22100%
PrintXZPlane(...)100%66100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Diagnostics/NavigationChart.Extensions.cs

#LineLine coverage
 1using FixedMathSharp;
 2using System;
 3
 4namespace Trailblazer.Pathing;
 5
 6/// <summary>
 7/// Provides extension methods for displaying information about walkable positions and XZ plane slices in a NavigationCh
 8/// </summary>
 9/// <remarks>
 10/// These extension methods are intended to assist with debugging or visualizing navigation data by printing walkable po
 11/// and 2D slices of the navigation chart to the console.
 12/// </remarks>
 13public static class NavigationChartExtensions
 14{
 15    /// <summary>
 16    /// Prints all walkable positions in the specified navigation chart to the console.
 17    /// </summary>
 18    /// <remarks>
 19    /// Each walkable position is printed in the format (x, y, z) under a header containing the chart's name.
 20    /// This method is intended for debugging or informational purposes and writes output directly to the standard conso
 21    /// </remarks>
 22    /// <param name="chart">The navigation chart from which to retrieve and display walkable positions. Cannot be null.<
 23    public static void PrintWalkablePositions(this NavigationChart chart)
 24    {
 125        Console.WriteLine($"Walkable Positions for Chart [{chart.Name}]:");
 26
 627        foreach (Vector3d pos in chart.GetWalkablePositions())
 228            Console.WriteLine($"  ({pos.x}, {pos.y}, {pos.z})");
 129    }
 30
 31    /// <summary>
 32    /// Prints a visual representation of the XZ plane at the specified Y level for the given navigation chart to the co
 33    /// </summary>
 34    /// <remarks>
 35    /// Each cell in the output represents whether the corresponding position is walkable.
 36    /// Walkable positions are indicated by 'O', and non-walkable positions by '.'.
 37    /// This method is intended for debugging or visualization purposes.
 38    /// </remarks>
 39    /// <param name="chart">The navigation chart from which to extract and display the XZ plane.</param>
 40    /// <param name="yLevel">The Y coordinate at which to display the XZ plane.</param>
 41    public static void PrintXZPlane(this NavigationChart chart, int yLevel)
 42    {
 143        Console.WriteLine($"XZ Plane at Y={yLevel} for Chart [{chart.Name}]:");
 44
 645        for (int z = (int)chart.MinBounds.z; z < (int)chart.MaxBounds.z; z++)
 46        {
 1247            for (int x = (int)chart.MinBounds.x; x < (int)chart.MaxBounds.x; x++)
 48            {
 449                Vector3d pos = new(x, yLevel, z);
 450                bool walkable = chart.IsWalkable(pos);
 451                Console.Write(walkable ? "O " : ". ");
 52            }
 253            Console.WriteLine();
 54        }
 155    }
 56}