本文へ移動

Kyuubuキューブ

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

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

目次

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

dragHint関数

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

The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). Several layers about one axis, turned as far, are one slab and get one arrow across it; each layer is still turned by a drag of its own. Null for a turn of the whole cube, which no drag on a sticker makes, and for turns that are not one movement.

インポート

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

定義

function dragHint(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

The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). Several layers about one axis, turned as far, are one slab and get one arrow across it; each layer is still turned by a drag of its own. null for a turn of the whole cube, which no drag on a sticker makes, and for turns that are not one movement.

例

import { dragHint, parseMove, viewMatrix } from "@johnmorrisdotca/kyuubu";

const view = viewMatrix(-30, -20);
const move = parseMove("R", 3)!;
console.log(dragHint(move, 3, view));
{
  axis: 0,
  layers: [ 2 ],
  turns: 3,
  seam: false,
  slots: [
     2,  5,  8,  9, 10, 11, 12,
    13, 14, 15, 16, 17, 20, 23,
    26, 29, 32, 35, 45, 48, 51
  ],
  face: 'F',
  grab: 26,
  drag: [ 0, -1 ],
  quarters: -1,
  atOnce: true,
  arrow: {
    from: [ 2, -2, 3 ],
    along: [ 0, 1, 0 ],
    length: 4.7,
    width: 2,
    normal: [ 0, 0, 1 ]
  }
}

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

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

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