Added pentagon example
This commit is contained in:
parent
1714d50b9a
commit
f5ce479566
40
pentagon.tex
Normal file
40
pentagon.tex
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
\documentclass[]{article}
|
||||||
|
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{calc}
|
||||||
|
|
||||||
|
% From https://tex.stackexchange.com/questions/308849/draw-regular-pentagon-in-tikz
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\newcommand{\downpent}[2][blue!50!gray,draw=white,thick]% [options], list of direction steps e.g {10/2/1/1}
|
||||||
|
{
|
||||||
|
\coordinate (temp) at (0,0);
|
||||||
|
\foreach \p in {#2}
|
||||||
|
{ \foreach \s in \p
|
||||||
|
{ \coordinate (temp) at ($(temp)+(\s*36-18:1)$);
|
||||||
|
}
|
||||||
|
\fill[#1] ($(temp)+(54:0.618)$) -- ($(temp)+(126:0.618)$) -- ($(temp)+(198:0.618)$) -- ($(temp)+(270:0.618)$) -- ($(temp)+(342:0.618)$) -- cycle;
|
||||||
|
\coordinate (temp) at (0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\newcommand{\uppent}[2][blue!50!gray,draw=white,thick]% [options], list of coordinates e.g {1,2},{1,3},{4,2}
|
||||||
|
{
|
||||||
|
\coordinate (temp) at (0,0);
|
||||||
|
\foreach \p in {#2}
|
||||||
|
{ \foreach \s in \p
|
||||||
|
{ \coordinate (temp) at ($(temp)+(\s*36-18:1)$);
|
||||||
|
}
|
||||||
|
\fill[#1] ($(temp)+(-54:0.618)$) -- ($(temp)+(-126:0.618)$) -- ($(temp)+(-198:0.618)$) -- ($(temp)+(-270:0.618)$) -- ($(temp)+(-342:0.618)$) -- cycle;
|
||||||
|
\coordinate (temp) at (0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\downpent[orange,draw=white,thick]{{2},{4},{6},{8},{10},{10,1,10}}
|
||||||
|
\uppent[cyan!50!blue,draw=white,thick]{{},{10,1},{10,1,10,3},{10,1,10,1},{10,1,10,9},{10,1,10,7}}
|
||||||
|
\foreach \a [count=\c] in {18,54,...,342} \draw[->,thick] (0,0) -- (\a:1cm) node[label=\a:\c] {};
|
||||||
|
\end{tikzpicture}
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
Loading…
Reference in New Issue
Block a user