cuboidLayerOffunction
The layer, 0 to the axis's depth − 1 from its negative side, that a cubie centre sits in.
Import it
import { cuboidLayerOf } from "@johnmorrisdotca/kyuubu/cuboid";
Definition
function cuboidLayerOf(centre: Vec3, axis: CubeAxis, dims: CuboidDims): number
Parameters
| Name | Type | Description |
|---|---|---|
centre | Vec3 | The cubie centre in doubled model coordinates. |
axis | CubeAxis | The model axis: 0 for x, 1 for y, or 2 for z. |
dims | CuboidDims | The cuboid’s x, y and z dimensions, in that order. |
Returns
number
The layer, 0 to the axis's depth − 1 from its negative side, that a cubie centre sits in.
Examples
import { cuboidLayerOf } from "@johnmorrisdotca/kyuubu/cuboid";
const dims = [2, 3, 3] as const;
console.log(cuboidLayerOf([1, 0, 0], 0, dims));1What it prints (run when this page was built)