Module: utils/arrays
Functions
from2Dto1D
โธ from2Dto1D(x
, y
, width
): number
Converts a 2D array index to a 1D index
Parameters
Name | Type | Description |
---|---|---|
x | number | column index |
y | number | row index |
width | number | length of each row in array |
Returns
number
index of (x, y) in flat array
Defined in
src/utils/arrays.ts:23
from3Dto1D
โธ from3Dto1D(x
, y
, z
, width
, depth
): number
Converts a 3D array index to a 1D index
Parameters
Name | Type | Description |
---|---|---|
x | number | row in slice index |
y | number | depth/slice index |
z | number | column index |
width | number | length of each row in array |
depth | number | number of rows in array |
Returns
number
index of (x, y, z) in flat array
Defined in
src/utils/arrays.ts:11