POV-Ray : Newsgroups : povray.binaries.images : Penrose Tile Macros : Re: Penrose Tile Macros Server Time
3 May 2024 17:00:38 EDT (-0400)
  Re: Penrose Tile Macros  
From: Jon Buller
Date: 27 Jun 2006 03:05:01
Message: <web.44a0d3916376349e2ff3aa640@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> "Jon Buller" <jon### [at] bullersnet> wrote:
>
> > The disadvantage is that I am not sure if it is
> > easy/possible to tell which triangles belong to which Kite, Dart, or Rhomb
> > without looking at the triangle's neighbors.  I'll play with it some more
> > and see if I can figure it out.
>
> Good luck! I think you will need to examine neighbours.

OK, I now see that doing Rhomb tiling is simple without any duplicate
detection. (That is, the inflation doesn't overlap it's neighbors, and it
works without using that init_inflate macro and friends.)

Consider this:

#macro tri (pos, ang, typ, level)
  #if (level < 1)
    PENROSE_triangle (pos, ang, typ)
  #else
    #if (abs(typ) = 18)
      tri (phi * (pos + vrotate (x, (ang - typ) * y)),
           ang + typ * 6, typ,     level - 1)
      tri (phi *  pos + vrotate (x, (ang + typ) * y),
           ang - typ * 6, typ * 3, level - 1)
    #else
      #local new = phi * pos + (phi - 1) * vrotate (x, (ang + typ) * y);
      tri (new, ang,             -typ,     level - 1)
      #local new = new + vrotate (x, (ang - typ) * y);
      tri (new, ang - typ * 8/3,  typ,     level - 1)
      tri (new, ang + typ * 8/3, -typ / 3, level - 1)
    #end
  #end
#end

Call this as the others, pos and ang are the location and orientation of the
triangle, level is how many inflate operations to do.  That typ parameter is
the size and orientation of the triangle.  It takes values of -54, -18, 18,
and 54.  To draw a triangle, draw unit length edges from pos in the
direction of ang + typ and ang - typ (and connect those two points for the
final edge).

It is simple to draw the triangles themselves.  But notice that if you draw
each edge (I'll call them +, -, and o) in a different color, all the
triangles have the same edge type for a shared edge.  Since a Rhomb is just
two 54 triangles that share an "o" edge, and any triangle with an "o" edge
has the neighbor of that edge that is also an "o" edge.  The other
interesting thing is that the other triangle is the negative type of its
neighbor.  So to draw rhombs instead of triangles, just ignore the negative
type triangles(-54 & -18), and treat the +54 triangles as rhombs that have
points of pos, pos+, pos-, and pos+-  (add the + and - direction vectors
together for pos+-)

Starting with a +54 triangle and a -54 triangle sharing "o" edges, and using
the rhomb generation macros from before with all the decorations on, you get
the attached image.  Note that the tri macro does not need that huge array
of true/false values to tell if it has already generated a tile at a
specific location or not, but can still generate a rhomb tiling without any
duplicate objects.

I still haven't figured out how to do Kites & Darts yet, but I think it
might be possible.  In fact, I think it's more possible now than I did when
I wrote that last message.


Post a reply to this message


Attachments:
Download 'penrose.png' (183 KB)

Preview of image 'penrose.png'
penrose.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.