本文へ移動

Kyuubuキューブ

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

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

目次

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

rotationHint関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. The arrow lies across the middle of the side the axis goes through that is seen best, as long as the side allows, and runs the way every sticker on it travels; two heads for a half turn. The sides the axis comes out of never cross the screen, so none is drawn on.

Null for moves that are not one turn of the whole cube; face and arrow are null where none of the four sides can be seen well enough (look round first).

インポート

import { rotationHint } from "@johnmorrisdotca/kyuubu";

定義

function rotationHint(moves: CubeMove | readonly CubeMove[], n: number, view: Mat3): DragHint | null

引数

名前型説明
movesCubeMove | readonly CubeMove[]

The turns, in their execution order.

nnumber

The cube’s side length.

viewMat3

The view matrix, or mounted CubeView for a guide.

戻り値

DragHint | null

WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. The arrow lies across the middle of the side the axis goes through that is seen best, as long as the side allows, and runs the way every sticker on it travels; two heads for a half turn. The sides the axis comes out of never cross the screen, so none is drawn on. null for moves that are not one turn of the whole cube; face and arrow are null where none of the four sides can be seen well enough (look round first).

例

import { rotationHint, viewMatrix, wholeMove } from "@johnmorrisdotca/kyuubu";

const view = viewMatrix(-30, -20);
console.log(rotationHint(wholeMove("x", "cw"), 3, view));
{
  axis: 0,
  layers: [ 0, 1, 2 ],
  turns: 3,
  seam: false,
  slots: [
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
    12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
    24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
    48, 49, 50, 51, 52, 53
  ],
  quarters: -1,
  atOnce: false,
  face: 'F',
  grab: null,
  drag: [ 0, -1 ],
  arrow: {
    from: [ 0, -2.6, 3 ],
    along: [ -0, 1, -0 ],
    length: 5.2,
    width: 6,
    normal: [ 0, 0, 1 ]
  }
}

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

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

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