Example: Escher Brick and Penrose Triangle

Published 2013-02-24 | Author: Julien Cretel

The first picture draws an impossible brick, which induces an optical illusion similar to that triggered by Escher’s impossible cube.

The second picture draws a Penrose triangle, another similar optical illusion.

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

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

% Author: Julien Cretel
% Date:   24/02/2013
    \begin{tikzpicture}[scale=4.5, line join=bevel]
      % \a and \b are two macros defining characteristic
      % dimensions of the impossible brick.

        apply style/.code={\tikzset{#1}},

      \foreach \theta/\v/\facestyleone/\facestyletwo in {%
        \draw[apply style/.expand once=\facestyleone]  		
          ({-.5*\b},{1.5*\a}) --
          ++(\b,0)            --
          ++(-\a,-\a)         --
          ++({-\b+2*\a},0)    --
          ++(0,-{2*\a})       --
          ++(\b,0)            --
          ++(-\a,-\a)         --
          ++(-\b,0)           --
        \draw[apply style/.expand once=\facestyletwo] 
          ({.5*\b},{1.5*\a})  --
          ++(0,{-2*\a})       --
          ++(-\a,0)           --
          ++(0,\a)            --


    \begin{tikzpicture}[scale=1, line join=bevel]
    % \a and \b are two macros defining characteristic
    % dimensions of the Penrose triangle.		

      apply style/.code     = {\tikzset{#1}},
      triangle_edges/.style = {thick,draw=black}

    \foreach \theta/\facestyle in {%
        0/{triangle_edges, fill = gray!50},
      120/{triangle_edges, fill = gray!25},
      240/{triangle_edges, fill = gray!90}%
        \draw[apply style/.expand once=\facestyle]
          ({-sqrt(3)/2*\a},{-0.5*\a})                     --
          ++(-\b,0)                                       --
            ({0.5*\b},{\a+3*sqrt(3)/2*\b})                -- % higher point	
            ({sqrt(3)/2*\a+2.5*\b},{-.5*\a-sqrt(3)/2*\b}) -- % rightmost point
          ++({-.5*\b},-{sqrt(3)/2*\b})                    -- % lower point
            ({0.5*\b},{\a+sqrt(3)/2*\b})                  --


  • #1 John Hammersley, March 1, 2013 at 2:46 p.m.

    These look great! Especially the triangle, which is created using such a small amount of code.

    They open up nicely in writeLaTeX for editing, too:


    Provides inspiration to others to create their own "Works of Escher" :-)

  • #2 Julien, March 1, 2013 at 11:21 p.m.

    Thanks. When I get the chance, I'll produce a shorter, more efficient code for the brick, too.

  • #3 Julien, March 4, 2013 at 2:15 p.m.

    The code was updated.

Adding comments is currently not enabled.