Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type RubiksCubeBackend n b = (Renderable (Path V2 n) b, TypeableFloat n, N b ~ n, V b ~ V2)
- solvedRubiksCube :: RubiksCube (Colour Double)
- drawSide :: (RubiksCubeBackend n b, Color c) => V2 n -> V2 n -> Side c -> Diagram b
- drawFoldingPattern :: (RubiksCubeBackend n b, Color c) => RubiksCube c -> Diagram b
- data Offsets n = Offsets {}
- offsetX :: forall n. Lens' (Offsets n) n
- offsetY :: forall n. Lens' (Offsets n) n
- drawRubiksCube :: (RubiksCubeBackend n b, Color c) => Offsets n -> RubiksCube c -> Diagram b
- drawMove :: (RubiksCubeBackend n b, Color c) => Move -> Colour Double -> Offsets n -> RubiksCube c -> Diagram b
- data MovesSettings n = MovesSettings {
- _moveSep :: n
- _showStart :: Bool
- _showEnd :: Bool
- _offsets :: Offsets n
- _arrowColour :: Colour Double
- moveSep :: forall n. Lens' (MovesSettings n) n
- showStart :: forall n. Lens' (MovesSettings n) Bool
- showEnd :: forall n. Lens' (MovesSettings n) Bool
- offsets :: forall n. Lens' (MovesSettings n) (Offsets n)
- arrowColour :: forall n. Lens' (MovesSettings n) (Colour Double)
- drawMoves :: (RubiksCubeBackend n b, Color c) => MovesSettings n -> RubiksCube c -> [Move] -> Diagram b
- drawMovesBackward :: (RubiksCubeBackend n b, Color c) => MovesSettings n -> RubiksCube c -> [Move] -> Diagram b
Documentation
type RubiksCubeBackend n b = (Renderable (Path V2 n) b, TypeableFloat n, N b ~ n, V b ~ V2) Source #
solvedRubiksCube :: RubiksCube (Colour Double) Source #
The solved cube.
Draws one 3x3 side of the cube.
drawFoldingPattern :: (RubiksCubeBackend n b, Color c) => RubiksCube c -> Diagram b Source #
Draw the folding pattern of the cube. The front side is at the center of the pattern.
drawRubiksCube :: (RubiksCubeBackend n b, Color c) => Offsets n -> RubiksCube c -> Diagram b Source #
Draw the Rubik's cube in parallel perspective.
{-# LANGUAGE FlexibleContexts, TypeFamilies #-} import Diagrams.RubiksCube import Control.Lens drawCubeExample = let c = solvedRubiksCube ^. undoMoves [R,U,R',U'] in drawRubiksCube with c
drawMove :: (RubiksCubeBackend n b, Color c) => Move -> Colour Double -> Offsets n -> RubiksCube c -> Diagram b Source #
Draw the Rubik's cube in parallel perspective with an arrow indicating the next move. If the the bottom layer is moved, the cube will be shown from below.
{-# LANGUAGE FlexibleContexts, TypeFamilies #-} import Diagrams.RubiksCube import Control.Lens drawMoveExample = let c = solvedRubiksCube ^. undoMoves [L,U,L',U'] in drawMove L with c
data MovesSettings n Source #
MovesSettings | |
|
Eq n => Eq (MovesSettings n) Source # | |
Read n => Read (MovesSettings n) Source # | |
Show n => Show (MovesSettings n) Source # | |
Fractional n => Default (MovesSettings n) Source # | |
moveSep :: forall n. Lens' (MovesSettings n) n Source #
arrowColour :: forall n. Lens' (MovesSettings n) (Colour Double) Source #
:: (RubiksCubeBackend n b, Color c) | |
=> MovesSettings n | |
-> RubiksCube c | the start configuration |
-> [Move] | |
-> Diagram b |
Draws a sequence of moves.
{-# LANGUAGE FlexibleContexts, TypeFamilies #-} import Diagrams.RubiksCube import Control.Lens drawMovesExample = let moves = [B, R, F', R', D', F, F] startPos = solvedRubiksCube ^. undoMoves moves settings = with & showStart .~ True in drawMoves settings startPos moves
:: (RubiksCubeBackend n b, Color c) | |
=> MovesSettings n | |
-> RubiksCube c | the end configuration |
-> [Move] | |
-> Diagram b |
Like drawMoves
, but takes the end configuration instead of the start
configuration. The previous example can be simplified with this:
import Diagrams.RubiksCube import Control.Lens drawMovesExample' = let moves = [B, R, F', R', D', F, F] endPos = solvedRubiksCube settings = with & showStart .~ True in drawMovesBackward settings endPos moves