I've uploading the picture I'm trying to replicate. (It's the one at the top left.) The code I'm posting below can sketch all 7 curves, but I've limited the loop to only sketch the inner loop, for clarity. I've broken it down into a smaller picture that I'm going to rotate about the origin 7 times, but when I rotate the picture, it rotates about the "wrong" point. (The first code below is the picture I'm going to rotate about the point O below it. The second code is what happens when I actually do the rotation.)
To break this down a bit more simply, in a nutshell, the code does this:
[whole bunch of calculations]
\draw (1) arc(...) arc(...);
When I include a rotation
\foreach \w in {0,...,6}{
\begin{scope}[rotate=\w*360/7]
[whole bunch of calculations]
\draw (1) arc(...) arc(...);
\end{scope}
}:
the picture rotates about the point (1). How do I define the center of rotation to be the point (0,0)? I mean, I could do the rotation manually, but the code is already much longer than I had originally thought it would be for so simple an image. And I'm curious to see how it can be done this way.
Thanks!
-Dan
Single curve:
Code: Select all
\documentclass{article}\usepackage{tikz}\usepackage{etoolbox}\usetikzlibrary{intersections}\begin{document}\newcommand\coords[1]{\path[transform canvas] (#1);\pgfgetlastxy{\xcoord}{\ycoord}\pgfmathsetmacro{\Xcoord}{scalar{\xcoord}/28.452756}\pgfmathsetmacro{\Ycoord}{scalar{\ycoord}/28.452756}\xdef\x{\Xcoord}\xdef\y{\Ycoord}}\def\n{7}\def\r{1}\def\R{6}\pgfmathsetmacro{\t}{360/\n}\pgfmathsetmacro{\A}{90-\t/2}\pgfmathsetmacro{\f}{cot(\t)/2}\pgfmathsetmacro{\p}{\R*sqrt(2-2*cos(\t))-\r}\pgfmathsetmacro{\d}{\R*sqrt(2-2*cos(\t)}\pgfmathsetmacro{\step}{(\p-\r)/(\n-1)}\begin{tikzpicture}\coordinate[label={O}] (O) at (0,0); \fill (O) circle(2pt);\coordinate (aI) at (90:\R);;\coordinate (aII) at ({90+\t}:\R);\coordinate (aIII) at ({90+2*\t}:\R);\coordinate (aVII) at ({90+6*\t}:\R);\coords{aI}; \pgfmathsetmacro{\aIx}{\x} \pgfmathsetmacro{\aIy}{\y}\coords{aII}; \pgfmathsetmacro{\aIIx}{\x} \pgfmathsetmacro{\aIIy}{\y}\coords{aIII}; \pgfmathsetmacro{\aIIIx}{\x} \pgfmathsetmacro{\aIIIy}{\y}\coords{aVII}; \pgfmathsetmacro{\aVIIx}{\x} \pgfmathsetmacro{\aVIIy}{\y}\foreach \w in {0,...,0}{
Code: Select all
\documentclass{article}\usepackage{tikz}\usepackage{etoolbox}\usetikzlibrary{intersections}\begin{document}\newcommand\coords[1]{\path[transform canvas] (#1);\pgfgetlastxy{\xcoord}{\ycoord}\pgfmathsetmacro{\Xcoord}{scalar{\xcoord}/28.452756}\pgfmathsetmacro{\Ycoord}{scalar{\ycoord}/28.452756}\xdef\x{\Xcoord}\xdef\y{\Ycoord}}\def\n{7}\def\r{1}\def\R{6}\pgfmathsetmacro{\t}{360/\n}\pgfmathsetmacro{\A}{90-\t/2}\pgfmathsetmacro{\f}{cot(\t)/2}\pgfmathsetmacro{\p}{\R*sqrt(2-2*cos(\t))-\r}\pgfmathsetmacro{\d}{\R*sqrt(2-2*cos(\t)}\pgfmathsetmacro{\step}{(\p-\r)/(\n-1)}\begin{tikzpicture}\coordinate[label={O}] (O) at (0,0); \fill (O) circle(2pt);\coordinate (aI) at (90:\R);;\coordinate (aII) at ({90+\t}:\R);\coordinate (aIII) at ({90+2*\t}:\R);\coordinate (aVII) at ({90+6*\t}:\R);\coords{aI}; \pgfmathsetmacro{\aIx}{\x} \pgfmathsetmacro{\aIy}{\y}\coords{aII}; \pgfmathsetmacro{\aIIx}{\x} \pgfmathsetmacro{\aIIy}{\y}\coords{aIII}; \pgfmathsetmacro{\aIIIx}{\x} \pgfmathsetmacro{\aIIIy}{\y}\coords{aVII}; \pgfmathsetmacro{\aVIIx}{\x} \pgfmathsetmacro{\aVIIy}{\y}\foreach \w in {0,...,2}{