%% cubedraw.sty: pictures of the Rubik's Cube in which
%% every piece is drawn whole.  See cubedraw-doc.pdf.
%%
%% Copyright (c) 2026 Luís M. S. Russo
%% Released under the MIT License; see the file LICENSE.
%%
%% \cubeflat[opts]{state}: state is 54 letters in W O G R B Y X,
%% faces U L F R B D, row by row.  The coordinates below are
%% computed by diagrams.py, in
%% https://github.com/LuisRusso-INESC-ID/Rubicks-Count
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cubedraw}[2026/12/03 v1.0 Rubik's Cube pictures]
\RequirePackage{tikz}
\definecolor{cubeW}{RGB}{255,255,255}
\definecolor{cubeO}{RGB}{255,89,0}
\definecolor{cubeG}{RGB}{0,155,72}
\definecolor{cubeR}{RGB}{185,0,0}
\definecolor{cubeB}{RGB}{0,69,173}
\definecolor{cubeY}{RGB}{255,213,0}
\definecolor{cubeX}{RGB}{185,185,185}
\newif\ifcubelabels
\newif\ifcubearrows
\newcount\cube@n
\def\cube@parse#1{\cube@n=0 \cube@parsei#1\relax}
\def\cube@parsei#1{%
  \ifx#1\relax\else
    \advance\cube@n by 1
    \expandafter\def\csname cube@s@\the\cube@n\endcsname{#1}%
    \expandafter\cube@parsei
  \fi}
\def\cube@col#1{cube\csname cube@s@#1\endcsname}
\def\cube@st#1#2{\filldraw[fill=\cube@col{#1},
  draw=\cube@col{#1},line width=.2pt] #2;}
\def\cube@ct#1#2{\filldraw[fill=\cube@col{#1},draw=black,
  line width=.3pt] #2;}
\def\cube@ol#1{\draw[line width=.3pt] #1;}
\def\cube@inkW{black}\def\cube@inkY{black}\def\cube@inkX{black}
\def\cube@inkO{white}\def\cube@inkG{white}
\def\cube@inkR{white}\def\cube@inkB{white}
\def\cube@ink#1{\csname cube@ink\csname cube@s@#1\endcsname
  \endcsname}
\def\cube@lab#1#2#3{\ifcubelabels\node[font=\scriptsize
  \bfseries,text=\cube@ink{#2}] at #3 {#1};\fi}
\def\cube@arr#1{\ifcubearrows
  \draw[black,line width=2pt,dash pattern=on 6pt off 2pt,
    shorten <=-.5pt,shorten >=5pt] #1;
  \draw[white,line width=1pt,dash pattern=on 5pt off 3pt,
    -{Stealth[length=9pt,width=7pt,color=black,fill=white,
    line width=.5pt]}] #1;\fi}
\usetikzlibrary{arrows.meta}
\newcommand{\cubeflat}[2][]{%
\cube@parse{#2}%
\begin{tikzpicture}[scale=.18,#1]%
\fill[black] (0.000,-4.600) arc[start angle=180,delta
  angle=90,radius=0.4] -- (11.600,-5.000) arc[start angle=-90,delta
  angle=90,radius=0.4] -- (12.000,1.600) arc[start angle=0,delta
  angle=90,radius=0.4] -- (0.400,2.000) arc[start angle=90,delta
  angle=90,radius=0.4] -- cycle;%
\cube@st{1}{(0.000,0.000) -- (2.000,0.000) -- (2.000,1.000) --
  (0.000,1.000) -- cycle}%
\cube@st{2}{(11.030,0.000) .. controls (11.030,0.736) and
  (11.132,0.940) .. (11.500,0.940) .. controls (11.868,0.940) and
  (11.970,0.736) .. (11.970,0.000) -- cycle}%
\cube@st{3}{(9.000,0.000) -- (11.000,0.000) -- (11.000,1.000) --
  (9.000,1.000) -- cycle}%
\cube@st{4}{(2.030,0.000) .. controls (2.030,0.736) and
  (2.132,0.940) .. (2.500,0.940) .. controls (2.868,0.940) and
  (2.970,0.736) .. (2.970,0.000) -- cycle}%
\cube@ct{5}{(11.500,1.060) .. controls (11.845,1.060) and
  (11.940,1.155) .. (11.940,1.500) .. controls (11.940,1.845) and
  (11.845,1.940) .. (11.500,1.940) -- (0.500,1.940) .. controls
  (0.155,1.940) and (0.060,1.845) .. (0.060,1.500) .. controls
  (0.060,1.155) and (0.155,1.060) .. (0.500,1.060) -- cycle}%
\cube@st{6}{(8.030,0.000) .. controls (8.030,0.736) and
  (8.132,0.940) .. (8.500,0.940) .. controls (8.868,0.940) and
  (8.970,0.736) .. (8.970,0.000) -- cycle}%
\cube@st{7}{(3.000,0.000) -- (5.000,0.000) -- (5.000,1.000) --
  (3.000,1.000) -- cycle}%
\cube@st{8}{(5.030,0.000) .. controls (5.030,0.736) and
  (5.132,0.940) .. (5.500,0.940) .. controls (5.868,0.940) and
  (5.970,0.736) .. (5.970,0.000) -- cycle}%
\cube@st{9}{(6.000,0.000) -- (8.000,0.000) -- (8.000,1.000) --
  (6.000,1.000) -- cycle}%
\cube@st{10}{(1.000,-1.000) -- (2.000,-1.000) -- (2.000,0.000) --
  (1.000,0.000) -- cycle}%
\cube@st{11}{(2.030,0.000) .. controls (2.030,-0.736) and
  (2.132,-0.940) .. (2.500,-0.940) .. controls (2.868,-0.940) and
  (2.970,-0.736) .. (2.970,0.000) -- cycle}%
\cube@st{12}{(3.000,-1.000) -- (4.000,-1.000) -- (4.000,0.000) --
  (3.000,0.000) -- cycle}%
\cube@st{13}{(1.000,-1.030) .. controls (1.736,-1.030) and
  (1.940,-1.132) .. (1.940,-1.500) .. controls (1.940,-1.868) and
  (1.736,-1.970) .. (1.000,-1.970) -- cycle}%
\cube@ct{14}{(2.500,-1.940) .. controls (2.845,-1.940) and
  (2.940,-1.845) .. (2.940,-1.500) .. controls (2.940,-1.155) and
  (2.845,-1.060) .. (2.500,-1.060) -- (2.500,-1.060) .. controls
  (2.155,-1.060) and (2.060,-1.155) .. (2.060,-1.500) .. controls
  (2.060,-1.845) and (2.155,-1.940) .. (2.500,-1.940) -- cycle}%
\cube@st{15}{(4.000,-1.030) .. controls (3.264,-1.030) and
  (3.060,-1.132) .. (3.060,-1.500) .. controls (3.060,-1.868) and
  (3.264,-1.970) .. (4.000,-1.970) -- cycle}%
\cube@st{16}{(1.000,-3.000) -- (2.000,-3.000) -- (2.000,-2.000) --
  (1.000,-2.000) -- cycle}%
\cube@st{17}{(2.030,-3.000) .. controls (2.030,-2.264) and
  (2.132,-2.060) .. (2.500,-2.060) .. controls (2.868,-2.060) and
  (2.970,-2.264) .. (2.970,-3.000) -- cycle}%
\cube@st{18}{(3.000,-3.000) -- (4.000,-3.000) -- (4.000,-2.000) --
  (3.000,-2.000) -- cycle}%
\cube@st{19}{(4.000,-1.000) -- (5.000,-1.000) -- (5.000,0.000) --
  (4.000,0.000) -- cycle}%
\cube@st{20}{(5.030,0.000) .. controls (5.030,-0.736) and
  (5.132,-0.940) .. (5.500,-0.940) .. controls (5.868,-0.940) and
  (5.970,-0.736) .. (5.970,0.000) -- cycle}%
\cube@st{21}{(6.000,-1.000) -- (7.000,-1.000) -- (7.000,0.000) --
  (6.000,0.000) -- cycle}%
\cube@st{22}{(4.000,-1.030) .. controls (4.736,-1.030) and
  (4.940,-1.132) .. (4.940,-1.500) .. controls (4.940,-1.868) and
  (4.736,-1.970) .. (4.000,-1.970) -- cycle}%
\cube@ct{23}{(5.500,-1.940) .. controls (5.845,-1.940) and
  (5.940,-1.845) .. (5.940,-1.500) .. controls (5.940,-1.155) and
  (5.845,-1.060) .. (5.500,-1.060) -- (5.500,-1.060) .. controls
  (5.155,-1.060) and (5.060,-1.155) .. (5.060,-1.500) .. controls
  (5.060,-1.845) and (5.155,-1.940) .. (5.500,-1.940) -- cycle}%
\cube@st{24}{(7.000,-1.030) .. controls (6.264,-1.030) and
  (6.060,-1.132) .. (6.060,-1.500) .. controls (6.060,-1.868) and
  (6.264,-1.970) .. (7.000,-1.970) -- cycle}%
\cube@st{25}{(4.000,-3.000) -- (5.000,-3.000) -- (5.000,-2.000) --
  (4.000,-2.000) -- cycle}%
\cube@st{26}{(5.030,-3.000) .. controls (5.030,-2.264) and
  (5.132,-2.060) .. (5.500,-2.060) .. controls (5.868,-2.060) and
  (5.970,-2.264) .. (5.970,-3.000) -- cycle}%
\cube@st{27}{(6.000,-3.000) -- (7.000,-3.000) -- (7.000,-2.000) --
  (6.000,-2.000) -- cycle}%
\cube@st{28}{(7.000,-1.000) -- (8.000,-1.000) -- (8.000,0.000) --
  (7.000,0.000) -- cycle}%
\cube@st{29}{(8.030,0.000) .. controls (8.030,-0.736) and
  (8.132,-0.940) .. (8.500,-0.940) .. controls (8.868,-0.940) and
  (8.970,-0.736) .. (8.970,0.000) -- cycle}%
\cube@st{30}{(9.000,-1.000) -- (10.000,-1.000) -- (10.000,0.000) --
  (9.000,0.000) -- cycle}%
\cube@st{31}{(7.000,-1.030) .. controls (7.736,-1.030) and
  (7.940,-1.132) .. (7.940,-1.500) .. controls (7.940,-1.868) and
  (7.736,-1.970) .. (7.000,-1.970) -- cycle}%
\cube@ct{32}{(8.500,-1.940) .. controls (8.845,-1.940) and
  (8.940,-1.845) .. (8.940,-1.500) .. controls (8.940,-1.155) and
  (8.845,-1.060) .. (8.500,-1.060) -- (8.500,-1.060) .. controls
  (8.155,-1.060) and (8.060,-1.155) .. (8.060,-1.500) .. controls
  (8.060,-1.845) and (8.155,-1.940) .. (8.500,-1.940) -- cycle}%
\cube@st{33}{(10.000,-1.030) .. controls (9.264,-1.030) and
  (9.060,-1.132) .. (9.060,-1.500) .. controls (9.060,-1.868) and
  (9.264,-1.970) .. (10.000,-1.970) -- cycle}%
\cube@st{34}{(7.000,-3.000) -- (8.000,-3.000) -- (8.000,-2.000) --
  (7.000,-2.000) -- cycle}%
\cube@st{35}{(8.030,-3.000) .. controls (8.030,-2.264) and
  (8.132,-2.060) .. (8.500,-2.060) .. controls (8.868,-2.060) and
  (8.970,-2.264) .. (8.970,-3.000) -- cycle}%
\cube@st{36}{(9.000,-3.000) -- (10.000,-3.000) -- (10.000,-2.000) --
  (9.000,-2.000) -- cycle}%
\cube@st{37}{(10.000,-1.000) -- (11.000,-1.000) -- (11.000,0.000) --
  (10.000,0.000) -- cycle}%
\cube@st{38}{(11.030,0.000) .. controls (11.030,-0.736) and
  (11.132,-0.940) .. (11.500,-0.940) .. controls (11.868,-0.940) and
  (11.970,-0.736) .. (11.970,0.000) -- cycle}%
\cube@st{39}{(0.000,-1.000) -- (1.000,-1.000) -- (1.000,0.000) --
  (0.000,0.000) -- cycle}%
\cube@st{40}{(10.000,-1.030) .. controls (10.736,-1.030) and
  (10.940,-1.132) .. (10.940,-1.500) .. controls (10.940,-1.868) and
  (10.736,-1.970) .. (10.000,-1.970) -- cycle}%
\cube@ct{41}{(11.500,-1.940) .. controls (11.845,-1.940) and
  (11.940,-1.845) .. (11.940,-1.500) .. controls (11.940,-1.155) and
  (11.845,-1.060) .. (11.500,-1.060) -- (11.500,-1.060) .. controls
  (11.155,-1.060) and (11.060,-1.155) .. (11.060,-1.500) .. controls
  (11.060,-1.845) and (11.155,-1.940) .. (11.500,-1.940) -- cycle}%
\cube@st{42}{(1.000,-1.030) .. controls (0.264,-1.030) and
  (0.060,-1.132) .. (0.060,-1.500) .. controls (0.060,-1.868) and
  (0.264,-1.970) .. (1.000,-1.970) -- cycle}%
\cube@st{43}{(10.000,-3.000) -- (11.000,-3.000) -- (11.000,-2.000)
  -- (10.000,-2.000) -- cycle}%
\cube@st{44}{(11.030,-3.000) .. controls (11.030,-2.264) and
  (11.132,-2.060) .. (11.500,-2.060) .. controls (11.868,-2.060) and
  (11.970,-2.264) .. (11.970,-3.000) -- cycle}%
\cube@st{45}{(0.000,-3.000) -- (1.000,-3.000) -- (1.000,-2.000) --
  (0.000,-2.000) -- cycle}%
\cube@st{46}{(3.000,-4.000) -- (5.000,-4.000) -- (5.000,-3.000) --
  (3.000,-3.000) -- cycle}%
\cube@st{47}{(5.030,-3.000) .. controls (5.030,-3.736) and
  (5.132,-3.940) .. (5.500,-3.940) .. controls (5.868,-3.940) and
  (5.970,-3.736) .. (5.970,-3.000) -- cycle}%
\cube@st{48}{(6.000,-4.000) -- (8.000,-4.000) -- (8.000,-3.000) --
  (6.000,-3.000) -- cycle}%
\cube@st{49}{(2.030,-3.000) .. controls (2.030,-3.736) and
  (2.132,-3.940) .. (2.500,-3.940) .. controls (2.868,-3.940) and
  (2.970,-3.736) .. (2.970,-3.000) -- cycle}%
\cube@ct{50}{(11.500,-4.940) .. controls (11.845,-4.940) and
  (11.940,-4.845) .. (11.940,-4.500) .. controls (11.940,-4.155) and
  (11.845,-4.060) .. (11.500,-4.060) -- (0.500,-4.060) .. controls
  (0.155,-4.060) and (0.060,-4.155) .. (0.060,-4.500) .. controls
  (0.060,-4.845) and (0.155,-4.940) .. (0.500,-4.940) -- cycle}%
\cube@st{51}{(8.030,-3.000) .. controls (8.030,-3.736) and
  (8.132,-3.940) .. (8.500,-3.940) .. controls (8.868,-3.940) and
  (8.970,-3.736) .. (8.970,-3.000) -- cycle}%
\cube@st{52}{(0.000,-4.000) -- (2.000,-4.000) -- (2.000,-3.000) --
  (0.000,-3.000) -- cycle}%
\cube@st{53}{(11.030,-3.000) .. controls (11.030,-3.736) and
  (11.132,-3.940) .. (11.500,-3.940) .. controls (11.868,-3.940) and
  (11.970,-3.736) .. (11.970,-3.000) -- cycle}%
\cube@st{54}{(9.000,-4.000) -- (11.000,-4.000) -- (11.000,-3.000) --
  (9.000,-3.000) -- cycle}%
\cube@ol{(2.030,0.000) .. controls (2.030,-0.736) and (2.132,-0.940)
  .. (2.500,-0.940) .. controls (2.868,-0.940) and (2.970,-0.736) ..
  (2.970,0.000) .. controls (2.970,0.736) and (2.868,0.940) ..
  (2.500,0.940) .. controls (2.132,0.940) and (2.030,0.736) ..
  (2.030,0.000) -- cycle}%
\cube@ol{(2.030,-3.000) .. controls (2.030,-2.264) and
  (2.132,-2.060) .. (2.500,-2.060) .. controls (2.868,-2.060) and
  (2.970,-2.264) .. (2.970,-3.000) .. controls (2.970,-3.736) and
  (2.868,-3.940) .. (2.500,-3.940) .. controls (2.132,-3.940) and
  (2.030,-3.736) .. (2.030,-3.000) -- cycle}%
\cube@ol{(1.000,-1.030) .. controls (1.736,-1.030) and
  (1.940,-1.132) .. (1.940,-1.500) .. controls (1.940,-1.868) and
  (1.736,-1.970) .. (1.000,-1.970) .. controls (0.264,-1.970) and
  (0.060,-1.868) .. (0.060,-1.500) .. controls (0.060,-1.132) and
  (0.264,-1.030) .. (1.000,-1.030) -- cycle}%
\cube@ol{(0.000,-1.000) -- (2.000,-1.000) -- (2.000,1.000) --
  (0.000,1.000) -- cycle}%
\cube@ol{(0.000,-4.000) -- (2.000,-4.000) -- (2.000,-2.000) --
  (0.000,-2.000) -- cycle}%
\cube@ol{(5.030,0.000) .. controls (5.030,-0.736) and (5.132,-0.940)
  .. (5.500,-0.940) .. controls (5.868,-0.940) and (5.970,-0.736) ..
  (5.970,0.000) .. controls (5.970,0.736) and (5.868,0.940) ..
  (5.500,0.940) .. controls (5.132,0.940) and (5.030,0.736) ..
  (5.030,0.000) -- cycle}%
\cube@ol{(5.030,-3.000) .. controls (5.030,-2.264) and
  (5.132,-2.060) .. (5.500,-2.060) .. controls (5.868,-2.060) and
  (5.970,-2.264) .. (5.970,-3.000) .. controls (5.970,-3.736) and
  (5.868,-3.940) .. (5.500,-3.940) .. controls (5.132,-3.940) and
  (5.030,-3.736) .. (5.030,-3.000) -- cycle}%
\cube@ol{(4.000,-1.030) .. controls (4.736,-1.030) and
  (4.940,-1.132) .. (4.940,-1.500) .. controls (4.940,-1.868) and
  (4.736,-1.970) .. (4.000,-1.970) .. controls (3.264,-1.970) and
  (3.060,-1.868) .. (3.060,-1.500) .. controls (3.060,-1.132) and
  (3.264,-1.030) .. (4.000,-1.030) -- cycle}%
\cube@ol{(3.000,-1.000) -- (5.000,-1.000) -- (5.000,1.000) --
  (3.000,1.000) -- cycle}%
\cube@ol{(3.000,-4.000) -- (5.000,-4.000) -- (5.000,-2.000) --
  (3.000,-2.000) -- cycle}%
\cube@ol{(8.030,0.000) .. controls (8.030,-0.736) and (8.132,-0.940)
  .. (8.500,-0.940) .. controls (8.868,-0.940) and (8.970,-0.736) ..
  (8.970,0.000) .. controls (8.970,0.736) and (8.868,0.940) ..
  (8.500,0.940) .. controls (8.132,0.940) and (8.030,0.736) ..
  (8.030,0.000) -- cycle}%
\cube@ol{(8.030,-3.000) .. controls (8.030,-2.264) and
  (8.132,-2.060) .. (8.500,-2.060) .. controls (8.868,-2.060) and
  (8.970,-2.264) .. (8.970,-3.000) .. controls (8.970,-3.736) and
  (8.868,-3.940) .. (8.500,-3.940) .. controls (8.132,-3.940) and
  (8.030,-3.736) .. (8.030,-3.000) -- cycle}%
\cube@ol{(7.000,-1.030) .. controls (7.736,-1.030) and
  (7.940,-1.132) .. (7.940,-1.500) .. controls (7.940,-1.868) and
  (7.736,-1.970) .. (7.000,-1.970) .. controls (6.264,-1.970) and
  (6.060,-1.868) .. (6.060,-1.500) .. controls (6.060,-1.132) and
  (6.264,-1.030) .. (7.000,-1.030) -- cycle}%
\cube@ol{(6.000,-1.000) -- (8.000,-1.000) -- (8.000,1.000) --
  (6.000,1.000) -- cycle}%
\cube@ol{(6.000,-4.000) -- (8.000,-4.000) -- (8.000,-2.000) --
  (6.000,-2.000) -- cycle}%
\cube@ol{(11.030,0.000) .. controls (11.030,-0.736) and
  (11.132,-0.940) .. (11.500,-0.940) .. controls (11.868,-0.940) and
  (11.970,-0.736) .. (11.970,0.000) .. controls (11.970,0.736) and
  (11.868,0.940) .. (11.500,0.940) .. controls (11.132,0.940) and
  (11.030,0.736) .. (11.030,0.000) -- cycle}%
\cube@ol{(11.030,-3.000) .. controls (11.030,-2.264) and
  (11.132,-2.060) .. (11.500,-2.060) .. controls (11.868,-2.060) and
  (11.970,-2.264) .. (11.970,-3.000) .. controls (11.970,-3.736) and
  (11.868,-3.940) .. (11.500,-3.940) .. controls (11.132,-3.940) and
  (11.030,-3.736) .. (11.030,-3.000) -- cycle}%
\cube@ol{(10.000,-1.030) .. controls (10.736,-1.030) and
  (10.940,-1.132) .. (10.940,-1.500) .. controls (10.940,-1.868) and
  (10.736,-1.970) .. (10.000,-1.970) .. controls (9.264,-1.970) and
  (9.060,-1.868) .. (9.060,-1.500) .. controls (9.060,-1.132) and
  (9.264,-1.030) .. (10.000,-1.030) -- cycle}%
\cube@ol{(9.000,-1.000) -- (11.000,-1.000) -- (11.000,1.000) --
  (9.000,1.000) -- cycle}%
\cube@ol{(9.000,-4.000) -- (11.000,-4.000) -- (11.000,-2.000) --
  (9.000,-2.000) -- cycle}%
\cube@lab{B}{41}{(11.500,-1.500)}%
\cube@lab{D}{50}{(6.000,-4.500)}%
\cube@lab{F}{23}{(5.500,-1.500)}%
\cube@lab{L}{14}{(2.500,-1.500)}%
\cube@lab{R}{32}{(8.500,-1.500)}%
\cube@lab{U}{5}{(6.000,1.500)}%
\cube@arr{(1.50,-0.50) -- (3.50,-0.50)}
\cube@arr{(3.50,-0.50) -- (3.50,-2.50)}
\cube@arr{(3.50,-2.50) -- (1.50,-2.50)}
\cube@arr{(1.50,-2.50) -- (1.50,-0.50)}
\cube@arr{(4.50,-0.50) -- (6.50,-0.50)}
\cube@arr{(6.50,-0.50) -- (6.50,-2.50)}
\cube@arr{(6.50,-2.50) -- (4.50,-2.50)}
\cube@arr{(4.50,-2.50) -- (4.50,-0.50)}
\cube@arr{(7.50,-0.50) -- (9.50,-0.50)}
\cube@arr{(9.50,-0.50) -- (9.50,-2.50)}
\cube@arr{(9.50,-2.50) -- (7.50,-2.50)}
\cube@arr{(7.50,-2.50) -- (7.50,-0.50)}
\cube@arr{(10.50,-2.50) -- (10.50,-0.50)}
\cube@arr{(0.50,-0.50) -- (0.50,-2.50)}
\cube@arr{(9.60,0.50) -- (7.00,0.50)}
\cube@arr{(6.60,0.50) -- (4.00,0.50)}
\cube@arr{(3.60,0.50) -- (1.00,0.50)}
\cube@arr{(1.40,-3.50) -- (4.00,-3.50)}
\cube@arr{(4.40,-3.50) -- (7.00,-3.50)}
\cube@arr{(7.40,-3.50) -- (10.00,-3.50)}
\end{tikzpicture}}
\endinput
