Reference · Cube engine and views
seamsAtfunction
The seams a touch at this place on a sticker is taking hold of, nearest
first: where it lands within SEAM_BAND of a sticker's width of the line
that parts the sticker's layer from the one beside it, along either of the
two directions the sticker can be turned across. Each is a turn about an axis that takes
both layers, and is made only if the drag that follows goes that way: a drag
across the line, or begun anywhere else on the sticker, turns the one layer
as ever. pointer is in pixels from the cube's middle, y down, as the cube
is drawn; none on a 2×2, where both layers are the whole cube.
Import it
import { seamsAt } from "@johnmorrisdotca/kyuubu";
Definition
function seamsAt(slot: StickerSlot, n: number, view: Mat3, pointer: readonly [number, number], k: number, lens: number, band?: number): Seam[]
Parameters
| Name | Type | Description |
|---|---|---|
slot | StickerSlot | The sticker’s centre and outward normal. |
n | number | The cube’s side length. |
view | Mat3 | The view matrix, or mounted CubeView for a guide. |
pointer | readonly [number, number] | The pointer position relative to the cube’s middle, in pixels with y down. |
k | number | The model-to-screen drawing scale. |
lens | number | The perspective distance used to draw the cube. |
band (optional) | number | The fraction of a sticker’s width treated as a seam. |
Returns
Seam[]
The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across. Each is a turn about an axis that takes both layers, and is made only if the drag that follows goes that way: a drag across the line, or begun anywhere else on the sticker, turns the one layer as ever. pointer is in pixels from the cube's middle, y down, as the cube is drawn; none on a 2×2, where both layers are the whole cube.
Examples
import { cubeSlots, seamsAt, viewMatrix } from "@johnmorrisdotca/kyuubu";
const view = viewMatrix(-30, -20);
const slot = cubeSlots(3).slots[0]!;
console.log(seamsAt(slot, 3, view, [0, 0], 100, 600));[]What it prints (run when this page was built)