I draw shapes on background via pgfonlayer
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{tikzpicture}
\begin{pgfonlayer}{background}
\draw[rounded corners,fill=red] (1,1) rectangle (2,2);
\draw[fill=blue] (0,0) circle (.8cm);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
I know the values (coordinates) needed to draw rectangle
or circle
, but I have no idea what are the parameters needed to draw a star
.
We define the starting coordinate; for rectangle
we give the second coordinate two draw rectangle
between two points, for circle
, we give the radius to draw circle around the starting point. What we need to give to draw star around the starting point?
\draw[fill=green] (0,0) star ????;
PS. Sorry, I know this is a basic typical question, but I had a long struggle with it.
Best Answer
Here you have a macro for drawing stars as well as "n-grams". meaning stars that result when you connect the diagonals of a regular polygon: