Struct VoxelIndex
Represents the topology-local coordinates of a voxel within a single grid. Rectangular-prism grids interpret the fields as X, Y, and Z. Hex-prism grids interpret them as axial Q, vertical layer, and axial R.
public struct VoxelIndex : IEquatable<VoxelIndex>, IComparable<VoxelIndex>
- Implements
- Inherited Members
Constructors
VoxelIndex(int, int)
Initializes a new instance of VoxelIndex with an X and Y coordinate. Defaults Z to zero.
public VoxelIndex(int xCord, int yCord)
Parameters
VoxelIndex(int, int, int)
Initializes a new instance of VoxelIndex with X, Y, and Z coordinates.
public VoxelIndex(int xCord, int yCord, int zCord)
Parameters
Fields
x
The local X coordinate for rectangular-prism grids, or axial Q coordinate for hex-prism grids.
public int x
Field Value
y
The local Y coordinate for rectangular-prism grids, or vertical layer for hex-prism grids.
public int y
Field Value
z
The local Z coordinate for rectangular-prism grids, or axial R coordinate for hex-prism grids.
public int z
Field Value
Properties
IsAllocated
Flag to determine is the struct instance was constructed or is default
public readonly bool IsAllocated { get; }
Property Value
Methods
CompareTo(VoxelIndex)
public readonly int CompareTo(VoxelIndex other)
Parameters
otherVoxelIndex
Returns
Remarks
Ordering is a stable lexicographic comparison of X/Q, then Y/layer, then Z/R. IsAllocated does not participate in value order.
Equals(VoxelIndex)
public readonly bool Equals(VoxelIndex other)
Parameters
otherVoxelIndex
Returns
Equals(object?)
public override readonly bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
Computes a hash code for the coordinates, ensuring uniqueness in hashing collections. Uses SwiftCollections.Utility.SwiftHashTools to generate a stable and consistent hash.
public override readonly int GetHashCode()
Returns
ToString()
Returns a string representation of the coordinates.
public override readonly string ToString()
Returns
Operators
operator ==(VoxelIndex, VoxelIndex)
public static bool operator ==(VoxelIndex left, VoxelIndex right)
Parameters
leftVoxelIndexrightVoxelIndex
Returns
operator !=(VoxelIndex, VoxelIndex)
public static bool operator !=(VoxelIndex left, VoxelIndex right)
Parameters
leftVoxelIndexrightVoxelIndex