2

I'm trying to draw a special parametric curve, but my results are not good enough, because I'd like to decorate it. So, I've tried this:

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.3cm,y=0.3cm]`
`\clip(-20.,-20.) rectangle (20.,20.);
\draw[fill=blue!50!black,fill opacity=0.10, smooth,samples=1000,domain=0.0:31.29] 
plot[parametric] 
function{(8.0+5.0)*cos((t))-5.0*cos((t*(8.0+5.0)/5.0)),(8.0+5.0)*sin((t))-5.0*sin((t*(8.0+5.0)/5.0))};
\end{tikzpicture}
\end{document}

But I'd like to have another result. Something like this:

Maths

How could I get that kind of result shading with blue color? And are there other kind of techniques easier than this?

Thank you very much for your help.

3

This is not exactly the same picture but I think it's a good way. With the next update of tkz-base and euclide. I added

    \def\tkzClipOutPolygon(#1,#2){\clip[tkzreserveclip] (#1)
               \foreach \pt in {#2}{--(\pt)}--cycle;
            }

and

   \tikzset{tkzreverseclip/.style={insert path={%
     (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb)}}}

   `\tkz@xa`etc. are defined by `tkzInit`

The code

\documentclass[border=5mm]{standalone}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}
        \tkzInit[xmin=-10,xmax=10,ymin=-10,ymax=10]
        \tkzDefPoints{0/0/P1,1.5/0/P2}
        \foreach \i [count=\j from 3] in {2,...,7}{%
            \tkzDefShiftPoint[P\i]({45*(\i-1)}:1.5 cm){P\j} 
        }
         \tkzClipOutPolygon(P1,P2,P3,P4,P5,P6,P7,P8)
         \tkzCalcLength[cm](P1,P5)\tkzGetLength{r}
        \begin{scope}[blend group=screen]
            \foreach \i in {1,...,8}{%
                \pgfmathparse{100-5*\i}
                \tkzFillCircle[R,color=MidnightBlue!\pgfmathresult](P\i,\r)
            }
        \end{scope}
    \end{tikzpicture}   
    \end{document}

enter image description here

It's a little more complex

\documentclass[border=5mm]{standalone}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}
        \tkzInit[xmin=-10,xmax=10,ymin=-10,ymax=10]
        \tkzDefPoints{0/0/P1,1.5/0/P2}
        \foreach \i [count=\j from 3] in {2,...,7}{%
            \tkzDefShiftPoint[P\i]({45*(\i-1)}:1.5 cm){P\j} 
        }
         \tkzClipOutPolygon(P1,P2,P3,P4,P5,P6,P7,P8)
        \tkzDefMidPoint(P1,P2) \tkzGetPoint{Q1}
        \tkzCalcLength[cm](Q1,P5)\tkzGetLength{r}
        \begin{scope}[blend group=screen]
            \foreach \i [count=\j from 2] in {1,...,8}{%
                 \pgfmathparse{mod(\i,8)+1} 
                 \let\k\pgfmathresult
                 \tkzDefMidPoint(P\i,P\k)
                 \tkzGetPoint{Q\i}
                    \pgfmathparse{100-5*\i}
                    \tkzFillCircle[R,color=MidnightBlue!\pgfmathresult](Q\i,\r)
            }
        \end{scope}
    \end{tikzpicture}   
    \end{document}

enter image description here

  • The centers of the circles are the middle of the sides and the circles go through opposite vertex – Alain Matthes Mar 17 '16 at 21:28
1

Here is one possible starting point.

\documentclass[border=7mm]{standalone}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
    \clip (-3,-3) rectangle (3,3) (0:1) foreach~in{1,...,7}{--(~*360/8:1)};
    \foreach~in{0,...,7}\fill[blue] (~*360/8:1) circle(2);
    \foreach~in{0,...,7}\fill[white, opacity=.28] (~*360/8:1) circle(2);
  \end{tikzpicture}
\end{document}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.