0

I am trying the create analog clock dial with roman or standard numbers on display and at the same time create another one but the mirror image of it. I managed to do that but for some reason a third one appears. Below is my attempt code.

\documentclass[tikz, margin=2mm]{standalone}
\usetikzlibrary{spy,decorations.fractals}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\tikzset{
hour pointer/.style={line cap=round, thick},
minute pointer/.style={thin, line cap=round},
ticks sep/.style={outer sep=-#1}, ticks sep={0pt},
ticks size/.store in=\clocktickssize,
ticks size=.25cm,
ticks/.style={thin},
main ticks/.style={very thick},
clock/.style={draw, minimum size=4cm, circle},
clock text/.code={\let\clocktext\textrm},
hour pointer size/.store in=\hourpointersize,
hour pointer size=0.5cm,
minute pointer size/.store in=\minutepointersize,
minute pointer size=0.75cm,
clock text sep/.store in=\clocktextsep,
clock text sep=1em,
pics/clock/.style args={#1:#2}{
    code={%
    \pgfmathsetmacro{\hourangle}{90-#1*30-#2*0.5}    \pgfmathsetmacro{\minuteangle}{90-#2*6}
    \node[clock] (-clock) {};
    \foreach \angle [count=\xi] in {60,30,...,-270}
    {
        \draw[clock text, ticks] (-clock.\angle) -- ++(\angle:- \clocktickssize) node[anchor=center, shift={(\angle:-\clocktextsep)}] {\clocktext{\xi}};
    };
    \foreach \angle in {0,90,180,270} \draw[ticks, main ticks] (-clock.\angle) -- ++(\angle:-\clocktickssize);
    \draw[minute pointer] (-clock.center) -- ++(\minuteangle:\minutepointersize);
    \draw[hour pointer] (-clock.center) -- ++(\hourangle:\hourpointersize);}}}
  \tikzset{
  mirror scope/.is family,
  mirror scope/angle/.store in=\mirrorangle,
  mirror scope/center/.store in=\mirrorcenter,
  mirror setup/.code={\tikzset{mirror scope/.cd,#1}},
 mirror scope/.style={mirror setup={#1},spy scope={
        rectangle,lens={rotate=\mirrorangle,yscale=-1,rotate=-1*\mirrorangle},size=80cm}},}
 \usetikzlibrary{arrows.meta}
 \newcommand\mirror[1][]{\spy[overlay,#1] on (\mirrorcenter) in node at (\mirrorcenter)}
 \begin{document}
 \begin{tikzpicture}
 \pic[left=6cm,
 clock text/.code={\let\clocktext\rom},
 clock/.style={minimum size=5cm, draw}] (Original) at (0,0)   {clock=15:00};

\begin{scope}[mirror scope={center={5,0},angle=90}]
\pic[right=3cm,
 clock text/.code={\let\clocktext\rom},
 clock/.style={minimum size=5cm, draw}] (Reversed) at (4,0) {clock=15:00};
\mirror;  
%\foreach \clock in { Reversed, Original} \node[above=.25cm] %at (\clock -clock.north) {\clock\ Clock};
\end{scope}
\end{tikzpicture}
\end{document}

And the output is enter image description here The first two on the left are okay. But the third one should not be there. Obviously my coding is not right or not efficient. Any suggestion to mirror the image alternatively or how to adjust the original code to get only first two images. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.