seamsAt関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { seamsAt } from "@johnmorrisdotca/kyuubu";
定義
function seamsAt(slot: StickerSlot, n: number, view: Mat3, pointer: readonly [number, number], k: number, lens: number, band?: number): Seam[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
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 (省略可) | number | The fraction of a sticker’s width treated as a seam. |
戻り値
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.
例
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));[]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。