Reference · Cube engine and views
layerOffunction
The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in.
Import it
import { layerOf } from "@johnmorrisdotca/kyuubu";
Definition
function layerOf(centre: Vec3, axis: CubeAxis, n: number): 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. |
n | number | The cube’s side length. |
Returns
number
The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in.
Examples
import { layerOf } from "@johnmorrisdotca/kyuubu";
console.log(layerOf([2, 2, 2], 0, 3));2What it prints (run when this page was built)