2

enter image description here

This is a picture of a disk, made of a thin layer of molten plastic, and then of the same disk after we stretch it and bend it to overlap itself: the deformed disk. I would like to make clear to the viewer which part of the original disk goes where in the deformed disk. I think this picture would be easier to understand with a little fading of both the disk and the deformed disk, but I can't seem to get the deformed disk to fade, probably because it overlaps itself.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\newcommand*{\NNN}{300}
\newcommand*{\XXX}{.9}
\newcommand*{\YYY}{4}
\newcommand*{\x}{cos(2*pi*\i/\NNN r)}
\newcommand*{\y}{sin(2*pi*\i/\NNN r)}
\newcommand*{\xp}{cos(2*pi*(\i+1)/\NNN r)}
\newcommand*{\yp}{sin(2*pi*(\i+1)/\NNN r)}
\fill[gray!20,draw=gray!30,ultra thick] (-4,0) circle (1cm);
\node at (-2.5,0) {\({}\to{}\)};
\fill[gray!40,draw=gray!30,ultra thick] ({exp(\XXX)},0)
\foreach \i in {0,...,\NNN}
{
-- ({exp(\XXX*\xp)*cos(\YYY*\yp r)},{exp(\XXX*\xp)*sin(\YYY*\yp r)})
} -- cycle;
\fill[gray!20,draw=gray!30,ultra thick,even odd rule] ({exp(\XXX)},0)
\foreach \i in {0,...,\NNN}
{
-- ({exp(\XXX*\xp)*cos(\YYY*\yp r)},{exp(\XXX*\xp)*sin(\YYY*\yp r)})
} -- cycle;
\end{tikzpicture}
\end{document}
5
  • 1
    Did you try the even odd rule key (cf. p.172, pgfmanual, v3.0.1a)? Commented Feb 3, 2017 at 12:52
  • @PaulGaborit: thanks. The even odd rule helps a little. It would still benefit from fading, I think. Commented Feb 3, 2017 at 14:44
  • Can you explain more clearly the expected result? Commented Feb 3, 2017 at 14:46
  • @PaulGaborit: I added some more detail and included the even odd rule. Commented Feb 3, 2017 at 14:53
  • What have you tried, fading wise, and what was unsatisfactory about the results? I ask because I don't have any idea what you want the result to look like.
    – cfr
    Commented Feb 3, 2017 at 22:35

1 Answer 1

4

You can use the preaction option to avoid the double computation. You can declare function to simplify formula.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \def\NNN{200}
  \def\XXX{.9}
  \def\YYY{4}
  \tikzset{
    declare function={
      x(\i) = cos(2*pi*\i/\NNN r);
      y(\i) = sin(2*pi*\i/\NNN r);
    },
  }
  \path[fill=gray!20,draw=gray,ultra thick] (-4,0) circle (1cm);
  \draw[-latex] (-2.7,0) -- (-2.3,0);
  \path[fill=gray!20,draw=gray,ultra thick,even odd rule,
        preaction={fill=gray!40,nonzero rule}]
  ({exp(\XXX)},0) \foreach \i in {0,...,\NNN} {
    -- ({exp(\XXX*x(\i+1))*cos(\YYY*y(\i+1) r)},
        {exp(\XXX*x(\i+1))*sin(\YYY*y(\i+1) r)})
  } -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .