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]  •  [Open in writeLaTeX]

Rotated triangle

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\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}
    
  • #5 Alain Matthes, April 26, 2012 at 5:55 p.m.

    More compact is :

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

  • #6 Leon Jonas, September 4, 2012 at 5:26 a.m.

    HI,i m Jonas, and i like to create my t-shirt brand...and i really want to play with the triangle simbolic and i d like to know if it s possible to use your paint for one of my first edition??? At the moment it s just an idea for me, i m young and i just want to try to do something, to share something so let me know what are you thinking about Thanks a lot cordially Jonas

  • #7 Víctor Velásquez, November 27, 2012 at 4:16 a.m.

    Hello, my name is Victor, I'm from valdivia, Chile. I'm studying informatics civil engineering at the university and me and a group of colleagues are going as candidates for our student center. I'd like to use your image as the logo of our list, and, hopefully, the logo of the career's center. It's awesome, it's clean, and inspires recursivity. Beside the fact is made with latex, which makes it even more awesome. Is there any problem with this?, of course, you are the author and it's up to you how we attribute your work, but just to be sure, your name and link should appear in every reference of the logo's source (we loved your whole work, the color selection and the shape)

Adding comments is currently not enabled.