Class RectangularDirectionUtility
Provides rectangular-prism neighbor direction utilities.
public static class RectangularDirectionUtility
- Inheritance
-
RectangularDirectionUtility
- Inherited Members
Properties
AboveLayer
All 9 neighbor directions on the layer above.
public static ReadOnlySpan<RectangularDirection> AboveLayer { get; }
Property Value
All
All 26 neighbor directions excluding None.
public static ReadOnlySpan<RectangularDirection> All { get; }
Property Value
BelowLayer
All 9 neighbor directions on the layer below.
public static ReadOnlySpan<RectangularDirection> BelowLayer { get; }
Property Value
Diagonal
All 20 diagonal neighbor directions excluding None.
public static ReadOnlySpan<RectangularDirection> Diagonal { get; }
Property Value
Offsets
Predefined offsets for a rectangular-prism 3x3x3 neighbor structure, excluding the center position.
public static ReadOnlySpan<(int x, int y, int z)> Offsets { get; }
Property Value
Perpendicular
All 6 perpendicular neighbor directions excluding None.
public static ReadOnlySpan<RectangularDirection> Perpendicular { get; }
Property Value
Planar
All 8 same-layer XZ-plane directions excluding None.
public static ReadOnlySpan<RectangularDirection> Planar { get; }
Property Value
Primary
The 6 face-adjacent rectangular-prism directions.
public static ReadOnlySpan<RectangularDirection> Primary { get; }
Property Value
Vertical
All 2 vertical directions.
public static ReadOnlySpan<RectangularDirection> Vertical { get; }
Property Value
VerticalDiagonal
All 16 non-vertical directions on the layers above and below.
public static ReadOnlySpan<RectangularDirection> VerticalDiagonal { get; }
Property Value
Methods
GetBoundaryRange(int, int)
Gets the boundary range for a given offset and size, returning (0, 0) for negative offsets, (size-1, size-1) for positive offsets, and (0, size-1) for zero offsets.
public static (int start, int end) GetBoundaryRange(int offset, int size)
Parameters
Returns
GetDirectionFromOffset((int x, int y, int z))
Converts a rectangular local offset in the range [-1, 1] on each axis into a direction.
public static RectangularDirection GetDirectionFromOffset((int x, int y, int z) offset)
Parameters
Returns
IsAxisFacingBoundary(int, int, int)
Determines if a coordinate is facing the boundary of an axis given an offset and size.
public static bool IsAxisFacingBoundary(int coordinate, int offset, int size)
Parameters
coordinateintThe coordinate value.
offsetintThe offset value.
sizeintThe size of the dimension.
Returns
- bool
True if the coordinate is facing the boundary, otherwise false.
IsDiagonalNeighbor(RectangularDirection)
True for any diagonal step (multiple axes).
public static bool IsDiagonalNeighbor(RectangularDirection dir)
Parameters
Returns
IsPerpendicularNeighbor(RectangularDirection)
True for pure axis-aligned directions.
public static bool IsPerpendicularNeighbor(RectangularDirection dir)