# SpaceFillingCurve

## Description

`static` `class` `Tinman.Core.Util.SpaceFillingCurve`

Implements a bijective mapping from two- or three-dimensional map coordinates onto one-dimensional indices using hilbert space-filling curves.

The static `Map2D` methods provides a bijective mapping from two-dimensional coordinates to a one-dimensional index:

`(X,Y) => I`

where `X` and `Y` are in the range [0..MaxCoord2D] and `I` is in the range [0..MaxIndex2D].

The static `Map3D` methods provides a bijective mapping from three-dimensional coordinates to a one-dimensional index:

`(X,Y,Z) => I`

where `X`, `Y` and `Z` are in the range [0..MaxCoord3D] and `I` is in the range [0..MaxIndex3D].

## Public / Constants

### Max​Coord2​D

`public` `constant` `MaxCoord2D` → `(0x7FFFFFFF:int32)`

Maximum coordinate value produced by Unmap2D and accepted by `Map2D`.

### Max​Coord3​D

`public` `constant` `MaxCoord3D` → `(0x1FFFFF:int32)`

Maximum coordinate value produced by Unmap3D and accepted by `Map3D`.

### Max​Index2​D

`public` `constant` `MaxIndex2D` → `(0x3FFFFFFFFFFFFFFF:int64)`

Maximum index value produced by `Map2D` and accepted by Unmap2D.

### Max​Index3​D

`public` `constant` `MaxIndex3D` → `(0x7FFFFFFFFFFFFFFF:int64)`

Maximum index value produced by `Map3D` and accepted by Unmap3D.

## Public / Methods

### Map2​D

`[Pure]`
`public` `static` `method` `Map2D1` → `(1)`

in : Vec2I

The coordinates.

returns → int64

The index value.

Maps the given two-dimensional coordinates to an one-dimensional index value.

Provides a bijective mapping from two-dimensional coordinates to a one-dimensional index:

`(X,Y) => I`

where `X` and `Y` are in the range [0..MaxCoord2D] and `I` is in the range [0..MaxIndex2D].

`[Pure]`
`public` `static` `method` `Map2D2` → `(2)`

in : int32

X-component of coordinates.

in : int32

Y-component of coordinates.

returns → int64

The index value.

Maps the given two-dimensional coordinates to an one-dimensional index value.

Provides a bijective mapping from two-dimensional coordinates to a one-dimensional index:

`(X,Y) => I`

where `X` and `Y` are in the range [0..MaxCoord2D] and `I` is in the range [0..MaxIndex2D].

### Map3​D

`[Pure]`
`public` `static` `method` `Map3D1` → `(1)`

in : Vec3I

The coordinates.

returns → int64

The index value.

Maps the given three-dimensional coordinates to an one-dimensional index value.

Provides a bijective mapping from three-dimensional coordinates to a one-dimensional index:

`(X,Y,Z) => I`

where `X`, `Y` and `Z` are in the range [0..MaxCoord3D] and `I` is in the range [0..MaxIndex3D].

`[Pure]`
`public` `static` `method` `Map3D2` → `(3)`

in : int32

X-component of coordinates.

in : int32

Y-component of coordinates.

in : int32

Z-component of coordinates.

returns → int64

The index value.

Maps the given three-dimensional coordinates to an one-dimensional index value.

Provides a bijective mapping from three-dimensional coordinates to a one-dimensional index:

`(X,Y,Z) => I`

where `X`, `Y` and `Z` are in the range [0..MaxCoord3D] and `I` is in the range [0..MaxIndex3D].

### Unmap2​D

`[Pure]`
`public` `static` `method` `Unmap2D` → `(1)`

index in : int64

The index value.

returns → Vec2I

The map coordinates.

Unmaps the given linear index value to a two-dimensional set of map coordinates.

Provides a bijective mapping from a one-dimensional index to two-dimensional coordinates:

`I => (X,Y)`

where `X` and `Y` are in the range [0..MaxCoord2D] and `I` is in the range [0..MaxIndex2D].

### Unmap3​D

`[Pure]`
`public` `static` `method` `Unmap3D` → `(1)`

index in : int64

The index value.

returns → Vec3I

The map coordinates.

Unmaps the given linear index value to a three-dimensional set of map coordinates.

Provides a bijective mapping from a one-dimensional index to three-dimensional coordinates:

`I => (X,Y,Z)`

where `X`, `Y` and `Z` are in the range [0..MaxCoord3D] and `I` is in the range [0..MaxIndex3D].