本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス · キューブのエンジンと表示

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[]

引数

名前型説明
slotStickerSlot

The sticker’s centre and outward normal.

nnumber

The cube’s side length.

viewMat3

The view matrix, or mounted CubeView for a guide.

pointerreadonly [number, number]

The pointer position relative to the cube’s middle, in pixels with y down.

knumber

The model-to-screen drawing scale.

lensnumber

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));
[]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kyuubu 1.14.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。