3

You'd figure that I failed trig class as for the life of me I cannot figure how to originate all scaled triangles from the same point. If polygon had an option to move base point from center to bottom left, it would be a piece of cake to draw below, but there does not seem to be an option for that. So I tried using what seemed to be right trigonometric formulas for vertix offset from center, but they did not work.

documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.misc}

\begin{document}

\begin{figure}[!htb]
\resizebox{\linewidth}{!}{
    \begin{tikzpicture}
        \tikzstyle{every node}=[draw,thin]
        \draw[help lines] (0,0) grid (4,4);

        \foreach \a in {0,...,3}{
            \node[scale={\a/sin(30)},regular polygon, regular polygon sides=3]
                at ({(\a)*cos(30)}, {(\a)*sin(30)}) {}; 
        }

    \end{tikzpicture}
}

\caption{Triangular grid}
\end{figure}

\end{document}
ajeh
  • 2,572

2 Answers2

5

Use transformations and ordinary triangles (rather than a node).

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \foreach \i in {1,...,6} {
        \draw[scale=1/\i, rotate={60*(\i-1)}] (0,0) -- (1,0) -- ({cos(60)},{sin(60)}) -- cycle;
    }
\end{tikzpicture}
\end{document}

enter image description here

1

It's possible to use regular polygons (from shapes.geometric library) and their corner ... anchor to draw this figure.

enter image description here

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}

\foreach \i in {1,...,6}
    \node[draw, regular polygon, regular polygon sides=3, minimum size=1cm/\i, 
          anchor=corner 2, shape border rotate={60*(\i-1)}, 
          inner sep=0pt, outer sep=0pt] {};

\begin{scope}[xshift=2cm]
    \foreach \i  [evaluate=\i as \x using 100-7*\i] in {1,...,12}
        \node[fill=blue!\x, regular polygon, regular polygon sides=4, 
              minimum size=1cm/\i, anchor=corner 3, 
              shape border rotate={90*(\i-1)}, inner sep=0pt,outer sep=0pt] {};
\end{scope}

\begin{scope}[xshift=4cm]
    \foreach \i [evaluate=\i as \x using 10*\i]in {1,...,8}
        \node[fill=red!\x, regular polygon, regular polygon sides=5, 
              minimum size=1cm/\i, anchor=corner 3, 
              shape border rotate={108*(\i-1)}, inner sep=0pt,outer sep=0pt] {};
\end{scope}
\end{tikzpicture}

\end{document}
Ignasi
  • 136,588