Example: Replicating triangles

Published 2016-12-30 | Author: Hugues Vermeiren

Replicating triangles, using the ‘calc’ tikz library.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Replicating triangles

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. En français: TeXnique.fr.

% Author : Hugues Vermeiren
% Replicating triangles

  \foreach \n in {1,...,\nmax} {
    \coordinate (#3) at ($(#2)!0.5!(#3)$);
    \coordinate (D)  at (#2);
    \coordinate (#2) at ($(#2)!1.0!{-60}:(#3)$);
    \coordinate (#1) at (D);
    \fill [blue!10] (#1) -- (#2) -- (#3) -- cycle;
    \draw (#3) -- (#2) -- (#1);

\newcommand{\basetriangle}{% equilateral triangle with side 1
  \def\h{0.866025}% sqrt(3)/2
  \coordinate (X) at (-1/2,{-1/3*\h});
  \coordinate (Y) at (1/2,{-1/3*\h});
  \coordinate (Z) at (0,{2/3*\h});
  \fill[blue!10, draw=black] (X) -- (Y) -- (Z) -- cycle;

\def\nmax{8}% nb. of triangles on each branch

  \foreach \coord/\point in {#1} {
    \coordinate (\coord) at (\point);}



Adding comments is currently not enabled.

Scientific and technical areas
Other areas


LaTeX Beginners Guide

Limited discount 50%
coupon code tDRet6Y

Creative Commons License