Class GridTracer
Provides utilities for tracing lines or bounding areas in a grid, aligning them to grid voxels. Uses fixed-point calculations to ensure deterministic and accurate grid traversal.
public static class GridTracer
- Inheritance
-
GridTracer
- Inherited Members
Methods
GetCoveredScanCells(GridWorld, FixedBoundArea, Fixed64, Fixed64?)
Retrieves all scan cells within the given XZ-plane area on the supplied world Y layer.
public static IEnumerable<ScanCell> GetCoveredScanCells(GridWorld world, FixedBoundArea area, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
areaFixedBoundAreaThe 2D area whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before snapping.
Returns
- IEnumerable<ScanCell>
An enumerable of covered scan cells grouped by grid.
GetCoveredScanCells(GridWorld, Vector2d, Vector2d, Fixed64, Fixed64?)
Retrieves all scan cells within the given XZ-plane bounding area on the supplied world Y layer.
public static IEnumerable<ScanCell> GetCoveredScanCells(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector2dThe 2D minimum corner whose X component maps to world X and Y component maps to world Z.
boundsMaxVector2dThe 2D maximum corner whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before snapping.
Returns
- IEnumerable<ScanCell>
An enumerable of covered scan cells grouped by grid.
GetCoveredScanCells(GridWorld, Vector3d, Vector3d, Fixed64?)
Retrieves all scan cells within the given bounding area across relevant grids in the supplied world.
public static IEnumerable<ScanCell> GetCoveredScanCells(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector3dThe minimum corner of the bounding area.
boundsMaxVector3dThe maximum corner of the bounding area.
paddingFixed64?Value applied to the min/max bounds before snapping.
Returns
- IEnumerable<ScanCell>
An enumerable of covered scan cells grouped by grid.
GetCoveredScanCellsInto(GridWorld, FixedBoundArea, SwiftList<ScanCell>, Fixed64, Fixed64?)
Clears and fills caller-owned storage with scan cells covered by the supplied XZ-plane area.
public static void GetCoveredScanCellsInto(GridWorld world, FixedBoundArea area, SwiftList<ScanCell> results, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
GetCoveredScanCellsInto(GridWorld, FixedBoundArea, SwiftList<ScanCell>, GridScanScratch, Fixed64, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections for an XZ-plane area.
public static void GetCoveredScanCellsInto(GridWorld world, FixedBoundArea area, SwiftList<ScanCell> results, GridScanScratch scratch, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldareaFixedBoundArearesultsSwiftList<ScanCell>scratchGridScanScratchlayerYFixed64paddingFixed64?
GetCoveredScanCellsInto(GridWorld, Vector2d, Vector2d, SwiftList<ScanCell>, Fixed64, Fixed64?)
Clears and fills caller-owned storage with scan cells covered by the supplied XZ-plane bounding area.
public static void GetCoveredScanCellsInto(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, SwiftList<ScanCell> results, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldboundsMinVector2dboundsMaxVector2dresultsSwiftList<ScanCell>layerYFixed64paddingFixed64?
GetCoveredScanCellsInto(GridWorld, Vector2d, Vector2d, SwiftList<ScanCell>, GridScanScratch, Fixed64, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections for an XZ-plane bounding area.
public static void GetCoveredScanCellsInto(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, SwiftList<ScanCell> results, GridScanScratch scratch, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldboundsMinVector2dboundsMaxVector2dresultsSwiftList<ScanCell>scratchGridScanScratchlayerYFixed64paddingFixed64?
GetCoveredScanCellsInto(GridWorld, Vector3d, Vector3d, SwiftList<ScanCell>, GridScanScratch, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections.
public static void GetCoveredScanCellsInto(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, SwiftList<ScanCell> results, GridScanScratch scratch, Fixed64? padding = null)
Parameters
worldGridWorldboundsMinVector3dboundsMaxVector3dresultsSwiftList<ScanCell>scratchGridScanScratchpaddingFixed64?
GetCoveredScanCellsInto(GridWorld, Vector3d, Vector3d, SwiftList<ScanCell>, Fixed64?)
Clears and fills caller-owned storage with scan cells covered by the supplied bounding area.
public static void GetCoveredScanCellsInto(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, SwiftList<ScanCell> results, Fixed64? padding = null)
Parameters
GetCoveredVoxels(GridWorld, FixedBoundArea, Fixed64, Fixed64?)
Retrieves all grid voxels covered by the given XZ-plane area on the supplied world Y layer.
public static IEnumerable<GridVoxelSet> GetCoveredVoxels(GridWorld world, FixedBoundArea area, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
areaFixedBoundAreaThe 2D area whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before snapping.
Returns
- IEnumerable<GridVoxelSet>
A collection of GridVoxelSet objects representing the covered voxels.
GetCoveredVoxels(GridWorld, Vector2d, Vector2d, Fixed64, Fixed64?)
Retrieves all grid voxels covered by the given XZ-plane bounding area on the supplied world Y layer.
public static IEnumerable<GridVoxelSet> GetCoveredVoxels(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector2dThe 2D minimum corner whose X component maps to world X and Y component maps to world Z.
boundsMaxVector2dThe 2D maximum corner whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before snapping.
Returns
- IEnumerable<GridVoxelSet>
A collection of GridVoxelSet objects representing the covered voxels.
GetCoveredVoxels(GridWorld, Vector3d, Vector3d, Fixed64?)
Retrieves all grid voxels covered by the given bounding area in the supplied world.
public static IEnumerable<GridVoxelSet> GetCoveredVoxels(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, Fixed64? padding = null)
Parameters
worldGridWorldboundsMinVector3dboundsMaxVector3dpaddingFixed64?
Returns
GetCoveredVoxelsInto(GridWorld, FixedBoundArea, SwiftList<Voxel>, Fixed64, Fixed64?)
Clears and fills caller-owned storage with voxels covered by the supplied XZ-plane area.
public static void GetCoveredVoxelsInto(GridWorld world, FixedBoundArea area, SwiftList<Voxel> results, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
areaFixedBoundAreaThe 2D area whose X component maps to world X and Y component maps to world Z.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before normalization.
GetCoveredVoxelsInto(GridWorld, FixedBoundArea, SwiftList<Voxel>, GridTraceScratch, Fixed64, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections for an XZ-plane area.
public static void GetCoveredVoxelsInto(GridWorld world, FixedBoundArea area, SwiftList<Voxel> results, GridTraceScratch scratch, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
areaFixedBoundAreaThe 2D area whose X component maps to world X and Y component maps to world Z.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
scratchGridTraceScratchReusable scratch storage for grid candidates and duplicate-voxel guards.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before normalization.
GetCoveredVoxelsInto(GridWorld, Vector2d, Vector2d, SwiftList<Voxel>, Fixed64, Fixed64?)
Clears and fills caller-owned storage with voxels covered by the supplied XZ-plane bounding area.
public static void GetCoveredVoxelsInto(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, SwiftList<Voxel> results, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector2dThe 2D minimum corner whose X component maps to world X and Y component maps to world Z.
boundsMaxVector2dThe 2D maximum corner whose X component maps to world X and Y component maps to world Z.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before normalization.
GetCoveredVoxelsInto(GridWorld, Vector2d, Vector2d, SwiftList<Voxel>, GridTraceScratch, Fixed64, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections for an XZ-plane bounding area.
public static void GetCoveredVoxelsInto(GridWorld world, Vector2d boundsMin, Vector2d boundsMax, SwiftList<Voxel> results, GridTraceScratch scratch, Fixed64 layerY = default, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector2dThe 2D minimum corner whose X component maps to world X and Y component maps to world Z.
boundsMaxVector2dThe 2D maximum corner whose X component maps to world X and Y component maps to world Z.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
scratchGridTraceScratchReusable scratch storage for grid candidates and duplicate-voxel guards.
layerYFixed64The world Y layer to cover. Defaults to zero.
paddingFixed64?Value applied to the min/max bounds before normalization.
GetCoveredVoxelsInto(GridWorld, Vector3d, Vector3d, SwiftList<Voxel>, GridTraceScratch, Fixed64?)
Clears and fills caller-owned storage using caller-owned scratch collections.
public static void GetCoveredVoxelsInto(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, SwiftList<Voxel> results, GridTraceScratch scratch, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector3dThe minimum corner of the bounding area.
boundsMaxVector3dThe maximum corner of the bounding area.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
scratchGridTraceScratchReusable scratch storage for grid candidates and duplicate-voxel guards.
paddingFixed64?Value applied to the min/max bounds before normalization.
GetCoveredVoxelsInto(GridWorld, Vector3d, Vector3d, SwiftList<Voxel>, Fixed64?)
Clears and fills caller-owned storage with voxels covered by the supplied bounding area.
public static void GetCoveredVoxelsInto(GridWorld world, Vector3d boundsMin, Vector3d boundsMax, SwiftList<Voxel> results, Fixed64? padding = null)
Parameters
worldGridWorldThe world whose grids should be queried.
boundsMinVector3dThe minimum corner of the bounding area.
boundsMaxVector3dThe maximum corner of the bounding area.
resultsSwiftList<Voxel>Caller-owned storage that receives covered voxels.
paddingFixed64?Value applied to the min/max bounds before normalization.
TraceIntervalsInto(GridWorld, Vector3d, Vector3d, SwiftList<GridTraceInterval>, GridTraceIntervalScratch, int, int, int, long)
Traces an arbitrary world-space segment into exact, canonically ordered grid-cell intervals.
public static GridTraceIntervalReport TraceIntervalsInto(GridWorld world, Vector3d start, Vector3d end, SwiftList<GridTraceInterval> results, GridTraceIntervalScratch scratch, int gridCandidateLimit, int addressCandidateLimit, int outputLimit, long candidateWorkLimit)
Parameters
worldGridWorldstartVector3dendVector3dresultsSwiftList<GridTraceInterval>scratchGridTraceIntervalScratchgridCandidateLimitintaddressCandidateLimitintoutputLimitintcandidateWorkLimitlong
Returns
Remarks
Results are cleared on entry and on any ceiling or representability failure. Candidate grids are discovered through the world spatial index. Candidate addresses are bounded around the segment, then exact rectangular or hexagonal prisms reject all broad-phase false positives.
TraceLine(GridWorld, Vector2d, Vector2d, Fixed64?, bool, Fixed64)
Traces a 2D XZ-plane line between two points in the supplied world, snapping them to grid coordinates.
public static IEnumerable<GridVoxelSet> TraceLine(GridWorld world, Vector2d start, Vector2d end, Fixed64? padding = null, bool includeEnd = true, Fixed64 layerY = default)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector2dStarting XZ-plane position in world space.
endVector2dEnding XZ-plane position in world space.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
layerYFixed64The world Y layer to trace. Defaults to zero.
Returns
- IEnumerable<GridVoxelSet>
A collection of GridVoxelSet objects representing the traced path.
Remarks
This method maps FixedMathSharp.Vector2d.X to world X, FixedMathSharp.Vector2d.Y to world Z,
and layerY to world Y. The default layer is world Y = 0.
TraceLine(GridWorld, Vector3d, Vector3d, Fixed64?, bool)
Traces a 3D line between two points in the supplied world. The traced points are returned as grid voxels.
public static IEnumerable<GridVoxelSet> TraceLine(GridWorld world, Vector3d start, Vector3d end, Fixed64? padding = null, bool includeEnd = true)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector3dStarting position in world space.
endVector3dEnding position in world space.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
Returns
- IEnumerable<GridVoxelSet>
A collection of GridVoxelSet objects representing the traced path.
Remarks
Uses a fractional step algorithm inspired by Bresenham’s line algorithm. This implementation leverages fixed-point math to maintain precision across a deterministic grid.
TraceLineInto(GridWorld, Vector2d, Vector2d, SwiftList<Voxel>, GridTraceScratch, Fixed64?, bool, Fixed64)
Clears and fills caller-owned storage with voxels traced by a 2D XZ-plane line using caller-owned scratch collections.
public static void TraceLineInto(GridWorld world, Vector2d start, Vector2d end, SwiftList<Voxel> results, GridTraceScratch scratch, Fixed64? padding = null, bool includeEnd = true, Fixed64 layerY = default)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector2dStarting XZ-plane position in world space.
endVector2dEnding XZ-plane position in world space.
resultsSwiftList<Voxel>Caller-owned storage that receives traced voxels.
scratchGridTraceScratchReusable scratch storage for grid candidates and duplicate-voxel guards.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
layerYFixed64The world Y layer to trace. Defaults to zero.
TraceLineInto(GridWorld, Vector2d, Vector2d, SwiftList<Voxel>, Fixed64?, bool, Fixed64)
Clears and fills caller-owned storage with voxels traced by a 2D XZ-plane line.
public static void TraceLineInto(GridWorld world, Vector2d start, Vector2d end, SwiftList<Voxel> results, Fixed64? padding = null, bool includeEnd = true, Fixed64 layerY = default)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector2dStarting XZ-plane position in world space.
endVector2dEnding XZ-plane position in world space.
resultsSwiftList<Voxel>Caller-owned storage that receives traced voxels.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
layerYFixed64The world Y layer to trace. Defaults to zero.
TraceLineInto(GridWorld, Vector3d, Vector3d, SwiftList<Voxel>, GridTraceScratch, Fixed64?, bool)
Clears and fills caller-owned storage with voxels traced by a 3D line using caller-owned scratch collections.
public static void TraceLineInto(GridWorld world, Vector3d start, Vector3d end, SwiftList<Voxel> results, GridTraceScratch scratch, Fixed64? padding = null, bool includeEnd = true)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector3dStarting position in world space.
endVector3dEnding position in world space.
resultsSwiftList<Voxel>Caller-owned storage that receives traced voxels.
scratchGridTraceScratchReusable scratch storage for grid candidates and duplicate-voxel guards.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
TraceLineInto(GridWorld, Vector3d, Vector3d, SwiftList<Voxel>, Fixed64?, bool)
Clears and fills caller-owned storage with voxels traced by a 3D line.
public static void TraceLineInto(GridWorld world, Vector3d start, Vector3d end, SwiftList<Voxel> results, Fixed64? padding = null, bool includeEnd = true)
Parameters
worldGridWorldThe world whose grids should be traced.
startVector3dStarting position in world space.
endVector3dEnding position in world space.
resultsSwiftList<Voxel>Caller-owned storage that receives traced voxels.
paddingFixed64?Value applied to the start/end positions before snapping.
includeEndboolWhether to include the end voxel in the traced line.
TraceNavigationBodyInto(GridWorld, WorldVoxelIndex, WorldVoxelIndex, Vector3d, Vector3d, Fixed64, Fixed64, SwiftList<GridNavigationBodyTraceCell>, GridNavigationBodyTraceScratch, int, int, int, long)
Writes the canonical cells required by one direct upright-body sweep.
public static GridNavigationBodyTraceReport TraceNavigationBodyInto(GridWorld world, WorldVoxelIndex source, WorldVoxelIndex target, Vector3d startFoot, Vector3d endFoot, Fixed64 horizontalRadius, Fixed64 bodyHeight, SwiftList<GridNavigationBodyTraceCell> results, GridNavigationBodyTraceScratch scratch, int gridCandidateLimit, int addressCandidateLimit, int outputLimit, long candidateWorkLimit)
Parameters
worldGridWorldsourceWorldVoxelIndextargetWorldVoxelIndexstartFootVector3dendFootVector3dhorizontalRadiusFixed64bodyHeightFixed64resultsSwiftList<GridNavigationBodyTraceCell>scratchGridNavigationBodyTraceScratchgridCandidateLimitintaddressCandidateLimitintoutputLimitintcandidateWorkLimitlong
Returns
Remarks
The start and end bodies must have closed-set contact with the declared source and target prisms respectively; exact endpoint tangency is admitted for that identity check. A prism is claimed only when its planar and vertical interiors overlap the swept body at one shared continuous parameter. Boundary-only coincidence and tangency are excluded. Grid, address, output, and combined candidate-work ceilings are independent.