I am attempting to plot an Pinwheel Triangle (see pinwheel tiling) recursively onto itself, in order to have something that looks approximately like this:
This is generated using the following code:
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=5]
\coordinate [label=above: $A_{0}$] (A_0) at (0,1);
\coordinate [label=below: $B_{0}$] (B_0) at (0,0);
\coordinate [label=right: $C_{0}$] (C_0) at (2,0);
\draw (A_0) -- (B_0) -- (C_0) -- (A_0);
\coordinate [label=above: $A_{1}$]
(A_1) at ($(A_0)!(B_0)!(C_0)$);
\coordinate [label=below: $C_{1}$]
(C_1) at ($(B_0)!0.5!(C_0)$);
\coordinate [label=above: $H_{0}$]
(H_0) at ($(A_0)!(C_1)!(C_0)$);
\coordinate [label=left: $B_{1}$]
(B_1) at ($(A_1)!(C_1)!(B_0)$);
\coordinate [label=above: $A_{2}$]
(A_2) at ($(A_1)!(B_1)!(C_1)$);
\coordinate [label=below: $C_{2}$]
(C_2) at ($(B_1)!0.5!(C_1)$);
\coordinate [label=above: $H_{1}$]
(H_1) at ($(A_1)!(C_2)!(C_1)$);
\coordinate [label=left: $B_{2}$]
(B_2) at ($(A_2)!(C_2)!(B_1)$);
\coordinate (A_3) at ($(A_2)!(B_2)!(C_2)$);
\coordinate (C_3) at ($(B_2)! 0.5 !(C_2)$);
\coordinate (H_2) at ($(A_2)!(C_3)!(C_2)$);
\coordinate (B_3) at ($(A_3)!(C_3)!(B_2)$);
\coordinate (A_4) at ($(A_3)!(B_3)!(C_3)$);
\coordinate (C_4) at ($(B_3)! 0.5 !(C_3)$);
\coordinate (H_3) at ($(A_3)!(C_4)!(C_3)$);
\coordinate (B_4) at ($(A_4)!(C_4)!(B_3)$);
\coordinate (A_5) at ($(A_4)!(B_4)!(C_4)$);
\coordinate (C_5) at ($(B_4)! 0.5 !(C_4)$);
\coordinate (H_4) at ($(A_4)!(C_5)!(C_4)$);
\coordinate (B_5) at ($(A_5)!(C_5)!(B_4)$);
\coordinate (A_6) at ($(A_5)!(B_5)!(C_5)$);
\coordinate (C_6) at ($(B_5)! 0.5 !(C_5)$);
\coordinate (H_5) at ($(A_5)!(C_6)!(C_5)$);
\coordinate (B_6) at ($(A_6)!(C_6)!(B_5)$);
\coordinate (A_7) at ($(A_6)!(B_6)!(C_6)$);
\coordinate (C_7) at ($(B_6)! 0.5 !(C_6)$);
\coordinate (H_6) at ($(A_6)!(C_7)!(C_6)$);
\coordinate (B_7) at ($(A_7)!(C_7)!(B_6)$);
\coordinate (A_8) at ($(A_7)!(B_7)!(C_7)$);
\coordinate (C_8) at ($(B_7)! 0.5 !(C_7)$);
\coordinate (H_7) at ($(A_7)!(C_8)!(C_7)$);
\coordinate (B_8) at ($(A_8)!(C_8)!(B_7)$);
\coordinate (A_9) at ($(A_8)!(B_8)!(C_8)$);
\coordinate (C_9) at ($(B_8)! 0.5 !(C_8)$);
\coordinate (H_8) at ($(A_8)!(C_9)!(C_8)$);
\coordinate (B_9) at ($(A_9)!(C_9)!(B_8)$);
\draw (A_1) -- (B_0);
\draw (C_1) -- (H_0);
\draw (B_1) -- (C_1);
\draw (A_1) -- (C_1);
\draw (A_2) -- (B_1);
\draw (C_2) -- (H_1);
\draw (B_2) -- (C_2);
\draw (A_2) -- (C_2);
\draw (A_3) -- (B_2);
\draw (C_3) -- (H_2);
\draw (B_3) -- (C_3);
\draw (A_3) -- (C_3);
\draw (A_4) -- (B_3);
\draw (C_4) -- (H_3);
\draw (B_4) -- (C_4);
\draw (A_4) -- (C_4);
\draw (A_5) -- (B_4);
\draw (C_5) -- (H_4);
\draw (B_5) -- (C_5);
\draw (A_5) -- (C_5);
\draw (A_6) -- (B_5);
\draw (C_6) -- (H_5);
\draw (B_6) -- (C_6);
\draw (A_6) -- (C_6);
\draw (A_7) -- (B_6);
\draw (C_7) -- (H_6);
\draw (B_7) -- (C_7);
\draw (A_7) -- (C_7);
\draw (A_8) -- (B_7);
\draw (C_8) -- (H_7);
\draw (B_8) -- (C_8);
\draw (A_8) -- (C_8);
\draw (A_9) -- (B_8);
\draw (C_9) -- (H_8);
\draw (B_9) -- (C_9);
\draw (A_9) -- (C_9);
\end{tikzpicture}
\label{pinwheel-triangle-infinite}
\end{figure}
I would like to zoom in on the details, and appreciate the structure of the pinwheel tiling at greater magnification. So I used the standalone format, in order to generate a copy of the triangle at an larger scale. I used the following code:
\documentclass[11pt]{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
% The coordinate math engine in tikz has an error that makes it inaccurate at
% calculating extremely fine coordinates. This redefinition fixes the problem:
% https://tex.stackexchange.com/questions/256333/256377
% use the Mark Wibrow's correction
\makeatletter
\def\pgfpointnormalised#1{%
\pgf@process{#1}%
\pgfmathatantwo{\the\pgf@y}{\the\pgf@x}%
\let\pgf@tmp=\pgfmathresult%
\pgfmathcos@{\pgf@tmp}\pgf@x=\pgfmathresult pt\relax%
\pgfmathsin@{\pgf@tmp}\pgf@y=\pgfmathresult pt\relax%
}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[rotate=90, scale=30]
\coordinate [label=above: $A_{0}$] (A_0) at (0,1);
\coordinate [label=below: $B_{0}$] (B_0) at (0,0);
\coordinate [label=right: $C_{0}$] (C_0) at (2,0);
\draw (A_0) -- (B_0) -- (C_0) -- (A_0);
\coordinate [label=above: $A_{1}$]
(A_1) at ($(A_0)!(B_0)!(C_0)$);
\coordinate [label=below: $C_{1}$]
(C_1) at ($(B_0)!0.5!(C_0)$);
\coordinate [label=above: $H_{0}$]
(H_0) at ($(A_0)!(C_1)!(C_0)$);
\coordinate [label=left: $B_{1}$]
(B_1) at ($(A_1)!(C_1)!(B_0)$);
\coordinate [label=above: $A_{2}$]
(A_2) at ($(A_1)!(B_1)!(C_1)$);
\coordinate [label=below: $C_{2}$]
(C_2) at ($(B_1)!0.5!(C_1)$);
\coordinate [label=above: $H_{1}$]
(H_1) at ($(A_1)!(C_2)!(C_1)$);
\coordinate [label=left: $B_{2}$]
(B_2) at ($(A_2)!(C_2)!(B_1)$);
\coordinate (A_3) at ($(A_2)!(B_2)!(C_2)$);
\coordinate (C_3) at ($(B_2)! 0.5 !(C_2)$);
\coordinate (H_2) at ($(A_2)!(C_3)!(C_2)$);
\coordinate (B_3) at ($(A_3)!(C_3)!(B_2)$);
\coordinate (A_4) at ($(A_3)!(B_3)!(C_3)$);
\coordinate (C_4) at ($(B_3)! 0.5 !(C_3)$);
\coordinate (H_3) at ($(A_3)!(C_4)!(C_3)$);
\coordinate (B_4) at ($(A_4)!(C_4)!(B_3)$);
\coordinate (A_5) at ($(A_4)!(B_4)!(C_4)$);
\coordinate (C_5) at ($(B_4)! 0.5 !(C_4)$);
\coordinate (H_4) at ($(A_4)!(C_5)!(C_4)$);
\coordinate (B_5) at ($(A_5)!(C_5)!(B_4)$);
\coordinate (A_6) at ($(A_5)!(B_5)!(C_5)$);
\coordinate (C_6) at ($(B_5)! 0.5 !(C_5)$);
\coordinate (H_5) at ($(A_5)!(C_6)!(C_5)$);
\coordinate (B_6) at ($(A_6)!(C_6)!(B_5)$);
\coordinate (A_7) at ($(A_6)!(B_6)!(C_6)$);
\coordinate (C_7) at ($(B_6)! 0.5 !(C_6)$);
\coordinate (H_6) at ($(A_6)!(C_7)!(C_6)$);
\coordinate (B_7) at ($(A_7)!(C_7)!(B_6)$);
\coordinate (A_8) at ($(A_7)!(B_7)!(C_7)$);
\coordinate (C_8) at ($(B_7)! 0.5 !(C_7)$);
\coordinate (H_7) at ($(A_7)!(C_8)!(C_7)$);
\coordinate (B_8) at ($(A_8)!(C_8)!(B_7)$);
\coordinate (A_9) at ($(A_8)!(B_8)!(C_8)$);
\coordinate (C_9) at ($(B_8)! 0.5 !(C_8)$);
\coordinate (H_8) at ($(A_8)!(C_9)!(C_8)$);
\coordinate (B_9) at ($(A_9)!(C_9)!(B_8)$);
\draw[thin] (A_1) -- (B_0);
\draw[thin] (C_1) -- (H_0);
\draw[thin] (B_1) -- (C_1);
\draw[thin] (A_1) -- (C_1);
\draw[thin] (A_2) -- (B_1);
\draw[thin] (C_2) -- (H_1);
\draw[thin] (B_2) -- (C_2);
\draw[thin] (A_2) -- (C_2);
\draw[thin] (A_3) -- (B_2);
\draw[thin] (C_3) -- (H_2);
\draw[thin] (B_3) -- (C_3);
\draw[thin] (A_3) -- (C_3);
\draw[thin] (A_4) -- (B_3);
\draw[thin] (C_4) -- (H_3);
\draw[thin] (B_4) -- (C_4);
\draw[thin] (A_4) -- (C_4);
\draw[thin] (A_5) -- (B_4);
\draw[thin] (C_5) -- (H_4);
\draw[thin] (B_5) -- (C_5);
\draw[thin] (A_5) -- (C_5);
\draw[thin] (A_6) -- (B_5);
\draw[thin] (C_6) -- (H_5);
\draw[thin] (B_6) -- (C_6);
\draw[thin] (A_6) -- (C_6);
\draw[thin] (A_7) -- (B_6);
\draw[thin] (C_7) -- (H_6);
\draw[thin] (B_7) -- (C_7);
\draw[thin] (A_7) -- (C_7);
\draw[thin] (A_8) -- (B_7);
\draw[thin] (C_8) -- (H_7);
\draw[thin] (B_8) -- (C_8);
\draw[thin] (A_8) -- (C_8);
\draw[thin] (A_9) -- (B_8);
\draw[thin] (C_9) -- (H_8);
\draw[thin] (B_9) -- (C_9);
\draw[thin] (A_9) -- (C_9);
\end{tikzpicture}
\end{figure}
\end{document}
However, due to some sort of floating-point calculation issue with TiKZ's coordinate math engine, it appears that errors are building up and ruining the diagram. rather than having a beautiful pinwheel diagram, I end up with some sort of an half-hearted squiggle.
Please note that even when I apply Mark Wibrow's fix, the problem is not resolved. It appears this issue is influenced by the scaling factor. The image above is plotted with a scale of 30. If I increase to 50, it's even worse.
Thank you for your time and consideration. I would love to find a solution to this problem.
P.S: I understand that my code utilizes multiple coordinate calculations. If there's some way to optimize it (perhaps a loop?) to use less coordinate calculations, that would also be fine.





Cto(1.3,0)(for example), you have to change the interpolation factor... – Paul Gaborit Feb 01 '18 at 14:31