Table of Contents

Struct VoxelIndex

Namespace
GridForge.Spatial
Assembly
GridForge.dll

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

xCord int
yCord int

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

xCord int
yCord int
zCord int

Fields

x

The local X coordinate for rectangular-prism grids, or axial Q coordinate for hex-prism grids.

public int x

Field Value

int

y

The local Y coordinate for rectangular-prism grids, or vertical layer for hex-prism grids.

public int y

Field Value

int

z

The local Z coordinate for rectangular-prism grids, or axial R coordinate for hex-prism grids.

public int z

Field Value

int

Properties

IsAllocated

Flag to determine is the struct instance was constructed or is default

public readonly bool IsAllocated { get; }

Property Value

bool

Methods

CompareTo(VoxelIndex)

public readonly int CompareTo(VoxelIndex other)

Parameters

other VoxelIndex

Returns

int

Equals(VoxelIndex)

public readonly bool Equals(VoxelIndex other)

Parameters

other VoxelIndex

Returns

bool

Equals(object?)

public override readonly bool Equals(object? obj)

Parameters

obj object

Returns

bool

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

int

ToString()

Returns a string representation of the coordinates.

public override readonly string ToString()

Returns

string

Operators

operator ==(VoxelIndex, VoxelIndex)

public static bool operator ==(VoxelIndex left, VoxelIndex right)

Parameters

left VoxelIndex
right VoxelIndex

Returns

bool

operator !=(VoxelIndex, VoxelIndex)

public static bool operator !=(VoxelIndex left, VoxelIndex right)

Parameters

left VoxelIndex
right VoxelIndex

Returns

bool