< Summary

Information
Class: GridForge.Grids.GridTraceInterval
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridTraceInterval.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 79
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
WithTie(...)100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridTraceInterval.cs

#LineLine coverage
 1//=======================================================================
 2// GridTraceInterval.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;
 9using GridForge.Configuration;
 10using GridForge.Spatial;
 11
 12namespace GridForge.Grids;
 13
 14/// <summary>
 15/// Describes the exact closed parameter interval where a segment intersects one grid address.
 16/// </summary>
 17public readonly struct GridTraceInterval
 18{
 19    /// <summary>The exact world, grid-generation, and topology-local address.</summary>
 20    public WorldVoxelIndex Cell { get; }
 21
 22    /// <summary>The normalized grid binding key, independent of the recyclable runtime slot.</summary>
 23    public GridConfigurationKey ConfigurationKey { get; }
 24
 25    /// <summary>Whether physical storage currently contains the addressed voxel.</summary>
 26    public bool IsPhysicallyPresent { get; }
 27
 28    /// <summary>The last committed sequence applied to the traced grid generation.</summary>
 29    public ulong GridLastChangeSequence { get; }
 30
 31    /// <summary>The first inclusive segment parameter in the cell prism.</summary>
 32    public Fixed64 TEnter { get; }
 33
 34    /// <summary>The last inclusive segment parameter in the cell prism.</summary>
 35    public Fixed64 TExit { get; }
 36
 37    /// <summary>
 38    /// Stable group for peers whose interval interiors overlap, or point peers at one exact parameter.
 39    /// </summary>
 40    /// <remarks>
 41    /// Closed intervals that merely hand off at one endpoint remain successive groups. Group membership
 42    /// expresses simultaneous geometric coverage only; it does not imply voxel adjacency.
 43    /// </remarks>
 44    public int TieGroupId { get; }
 45
 46    /// <summary>The canonical identity order within <see cref="TieGroupId"/>.</summary>
 47    public int TieOrder { get; }
 48
 49    internal GridTraceInterval(
 50        WorldVoxelIndex cell,
 51        GridConfigurationKey configurationKey,
 52        bool isPhysicallyPresent,
 53        ulong gridLastChangeSequence,
 54        Fixed64 tEnter,
 55        Fixed64 tExit,
 56        int tieGroupId = -1,
 57        int tieOrder = -1)
 58    {
 289459        Cell = cell;
 289460        ConfigurationKey = configurationKey;
 289461        IsPhysicallyPresent = isPhysicallyPresent;
 289462        GridLastChangeSequence = gridLastChangeSequence;
 289463        TEnter = tEnter;
 289464        TExit = tExit;
 289465        TieGroupId = tieGroupId;
 289466        TieOrder = tieOrder;
 289467    }
 68
 69    internal GridTraceInterval WithTie(int tieGroupId, int tieOrder) =>
 133070        new(
 133071            Cell,
 133072            ConfigurationKey,
 133073            IsPhysicallyPresent,
 133074            GridLastChangeSequence,
 133075            TEnter,
 133076            TExit,
 133077            tieGroupId,
 133078            tieOrder);
 79}