Advertisement
Pi-Nerd

Sierpinski TikZ

Nov 1st, 2021
1,915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 0.52 KB | None | 0 0
  1. \documentclass[multi=tikzpicture]{standalone}
  2. \usepackage{tikz}
  3.  
  4. \newcommand{\sierpinski}[1]{
  5.  \fill[white,draw=black,line join=bevel] (30:1) -- (150:1) -- (270:1) -- cycle;
  6.  \foreach \leveldown in #1
  7.  {
  8.    \foreach \theta in {90,210,330} {
  9.      \begin{scope}[shift={(\theta:1)},scale=0.5]
  10.        \sierpinski#1
  11.      \end{scope}
  12.    }
  13.  }
  14. }
  15.  
  16. \begin{document}
  17.  
  18. \begin{tikzpicture}
  19.  \fill[green,draw=black] (90:2) -- (210:2) -- (330:2) -- cycle;
  20.  \sierpinski{{{{{{{}}}}}}}
  21. \end{tikzpicture}
  22.  
  23. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement