I have the following problem: I want to draw some moiree effects in tikz. This seems to be no problem. I did it without any error (two circles of trapezia). Now the two rings should be moved a bit. I added things and nothing worked anymore. I give you a reduced code below. Unfortunately the problem arises only if I calculate the movement by pgfmath. If I give them directly, all right, no error.
The (reduced) code:
\documentclass[a4paper,12pt,notitlepage]{article}
\usepackage{tikz}
\usepackage{pgffor}
\usetikzlibrary{scopes}
\newcommand{\drawCircularLines}[2]
{
\foreach \i
[
evaluate=\i as \startAngle using 360/#1*(\i-1)+#2,
evaluate=\i as \endAngle using 360/(2*#1)*(2*\i-1)+#2
]
in {1,...,#1}
{
\draw (\startAngle:2cm) -- (\startAngle:3cm) -- (\endAngle:3cm) -- (\endAngle:2cm) -- cycle;
}
}
\newcommand{\moireeTest}[3][0]
{
\begin{figure}
\centering
\begin{tikzpicture}
{ [color=red]
\drawCircularLines{#2}{0}
}
{ [color=blue]
\drawCircularLines{#3}{#1}
}
\end{tikzpicture}
\caption{Moiree Test mit #2 und #3 Strichen (Delta #1).}
\end{figure}
}
\begin{document}
\pgfmathparse{360/80/1*0}
\moireeTest[\pgfmathresult]{5}{3}
\end{document}
If you replace the \pgfmathresult
by 0
or delete the optional argument you see the correct 3 trapezia in blue.
Can you tell me, where is my fault? Thanks