Example: Rotated triangle

Published 2008-06-08 | Author: Alain Matthes

A beautiful pattern created by rotating and scaling a triangle multiple times. Note the use of color fading to emphasis the illusion of depth.

Author:Alain Matthes
Source:Altermundus.com

Download as: [PDF] [TEX]

Rotated triangle
\documentclass{article}
\usepackage[usenames,dvipsnames,pdftex]{xcolor}
\usepackage{tikz,ifthen}
\begin{document}
\newcounter{density}
\setcounter{density}{20}
\begin{tikzpicture}
    \def\couleur{MidnightBlue}
    \path[coordinate] (0,0)  coordinate(A)
                ++( 60:12cm) coordinate(B)
                ++(-60:12cm) coordinate(C);
    \draw[fill=\couleur!\thedensity] (A) -- (B) -- (C) -- cycle;
    \foreach \x in {1,...,15}{%
        \pgfmathsetcounter{density}{\thedensity+10}
        \setcounter{density}{\thedensity}
        \path[coordinate] coordinate(X) at (A){};
        \path[coordinate] (A) -- (B) coordinate[pos=.15](A)
                            -- (C) coordinate[pos=.15](B)
                            -- (X) coordinate[pos=.15](C);
        \draw[fill=\couleur!\thedensity] (A)--(B)--(C)--cycle;
    }
\end{tikzpicture}
\end{document}
% Name : RotateTriangle
% Encoding : utf8
% Engine : pdflatex
% Author: Alain Matthes

Comments

  • #1 umesh, February 16, 2009 at 10:53 a.m.

    beautiful!!!

  • #2 Cygne, July 6, 2009 at 1:48 p.m.

    It's just art...

  • #3 vahid damanafshan, July 10, 2009 at 10:41 p.m.

    It's really great.

  • #4 Martin Scharrer, July 26, 2009 at 11:53 a.m.

    Nice graph! However I would code it more compact like this:

    \documentclass{article}
    \usepackage[usenames,dvipsnames]{xcolor}
    \usepackage{tikz,ifthen}
    \pagestyle{empty}
    \begin{document}
    \begin{tikzpicture}
        \coordinate (A) at (0,0);
        \coordinate (B) at (-60:12cm);
        \coordinate (C) at (240:12cm);
        \foreach \density in {20,30,...,160}{%
            \draw[fill=MidnightBlue!\density] (A)--(B)--(C)--cycle;
            \path
                 (A) coordinate (X)
              -- (B) coordinate[pos=.15](A)
              -- (C) coordinate[pos=.15](B)
              -- (X) coordinate[pos=.15](C);
        }
    \end{tikzpicture}
    \end{document}
    

Comments for this entry are closed.