flix

0.75.3

Orbit64.Internal.Symmetry

The 48 symmetries of the cube as permutations of the facelet indices.

Internal to the package: Orbit64.Canonical is the public face of it.

A symmetry is a signed permutation of the three axes: 24 rotations and their 24 mirror images. It sends every sticker to another sticker of the same cube. The tables are derived from geometry alone: a facelet is face * n * n + row * n + col over U R F D L B, the layout Orbit64.Net reads and writes. locate places a facelet in space, indexOf is its inverse, and a symmetry is applied to the position and the normal of a sticker together.

Symmetry g has the axis permutation g / 8 and the sign bits g % 8. Row r of its matrix has the single entry -1 if sign bit r is set and 1 otherwise, in column axes(g / 8)[r]. Symmetry 0 is the identity and symmetry 1 mirrors across the R/L plane.

Definitions

def centerFacelet(n: Int32, face: Int32): Option[Int32]§ Source

The facelet at the middle of face face of an odd cube; None for an even cube, which has no such facelet, or a face outside 0 to 5.

def cornerStickers(n: Int32): List[Vector[Int32]]§ Source

The three stickers of each corner, U R F first and then the other seven corners; within a corner the sticker on the U or D face comes first, then the one on R or L, then the one on F or B.

def count(): Int32§ Source

The number of symmetries: the 6 axis permutations times the 8 sign choices.

def destinations(n: Int32, g: Int32): Vector[Int32]§ Source

Where the stickers go under symmetry g: sticker i of the cube moves to index Vector.get(i, destinations(n, g)).

def image(n: Int32, g: Int32, stickers: Vector[Int32]): Result[String, Vector[Int32]]§ Source

stickers moved by symmetry g; the colors stay. An error unless stickers has 6 * n * n entries and g is a symmetry.

def leastImage(n: Int32, stickers: Vector[Int32]): Result[String, Vector[Int32]]§ Source

The least relabeled image of stickers over all 48 symmetries.

Images compare as sticker strings: the first sticker decides, then the second, in face order U R F D L B. Two cubes have the same least image exactly when one is the other turned, mirrored and recolored.

def mirrorAcrossRL(): Int32§ Source

The symmetry that mirrors across the plane between the R and L faces.

def relabel(stickers: Vector[Int32]): Vector[Int32]§ Source

stickers with its colors renamed in order of first appearance, so the first color becomes 0, the next new one 1, and so on.