I’m using the new rotation
option for cycles to define a macro that draws a flower snark. The macro has as optional arguments the radius RA
, RB
, and RC
of the three types of vertices, and a mandatory argument which must be an odd natural number.
\newcommand{\grFlowerSnark}[2][]{% \begingroup \setkeys[GR]{cl}{#1}% \edef\tkzb@rtemp{\cmdGR@cl@RA} \edef\tkzb@rtempx{\cmdGR@cl@RB} \edef\tkzb@ptemp{\cmdGR@cl@RC} \pgfmathsetcounter{tkz@gr@a}{(#2-1)/2} \pgfmathsetcounter{tkz@gr@b}{(#2+1)/2} \grCycle[RA=\tkzb@ptemp,prefix=b,rotation=90]{#2} \grEmptyCycle[RA=\tkzb@rtempx,prefix=a,rotation=90]{#2} \pgfmathsetmacro{\smallshift}{360/(5*#2)} \grEmptyCycle[RA=\tkzb@rtemp,prefix=c,rotation=90+\smallshift]{#2} \grEmptyCycle[RA=\tkzb@rtemp,prefix=d,rotation=90-\smallshift]{#2} \EdgeIdentity{a}{b}{#2} \EdgeIdentity{a}{c}{#2} \EdgeIdentity{a}{d}{#2} \Edge(c\thetkz@gr@a)(d\thetkz@gr@b) \pgfmathsetcounter{tkz@gr@c}{\thetkz@gr@a-1} \pgfmathsetcounter{tkz@gr@d}{\thetkz@gr@b+1} {\tikzset{EdgeStyle/.append style = {bend right=90}} \EdgeDoubleMod{c}{#2}{0}{1}{c}{#2}{1}{1}{\thetkz@gr@c} \EdgeDoubleMod{c}{#2}{\thetkz@gr@b}{1}{c}{#2}{\thetkz@gr@d}{1}{\thetkz@gr@c} \EdgeDoubleMod{d}{#2}{0}{1}{d}{#2}{1}{1}{\thetkz@gr@c} \EdgeDoubleMod{d}{#2}{\thetkz@gr@b}{1}{d}{#2}{\thetkz@gr@d}{1}{\thetkz@gr@c} } \Edge[style={bend right=90}](d\thetkz@gr@a)(c\thetkz@gr@b) \endgroup }
So that, for example:
\begin{tikzpicture} \SetVertexNormal[MinSize=10pt] \grFlowerSnark[RA=4,RB=2.5,RC=1]{5} \end{tikzpicture}
gives:
See also: Original Source by Rafael
Note: The copyright belongs to the blog author and the blog. For the license, please see the linked original source blog.
Leave a Reply
You must be logged in to post a comment.