# Help a newbie with Penrose tilling

**URL:** <https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392>\
**Category:** Coding Questions\
**Created:** [August 5, 2018, 8:28pm UTC](https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392 "2018-08-05T20:28:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tonchii](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@Tonchii](https://discourse.processing.org/u/Tonchii)\
**Post date:** [August 5, 2018, 8:28pm UTC](https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392/1 "2018-08-05T20:28:32Z")

</div>

**Hello guys, i have been trying to draw this Penrose tile, I already got the pentagon but now i’m stuck with the other figure. Any help? I’m new to this.**

![Capture](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/6c09f38bf2ec61a4bbcf94606f645e43ec1b7288.PNG)

By the way here’s the code:

> void setup(){  
> size(400,400);  
> }  
> void draw(){  
> beginShape();  
> vertex(100,100);  
> vertex(140,100);  
> vertex(140+40_sin(0.314159),100-40_cos(0.314159));  
> vertex(120,100-40_cos(0.314159)-40_cos(0.942478));  
> vertex(100-40_sin(0.314159),100-40_cos(0.314159));  
> vertex(100,100);;  
> endShape();  
> }

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [August 5, 2018, 9:32pm UTC](https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392/2 "2018-08-05T21:32:49Z")

</div>

I just love that you have the diagram there that details the math for these shapes.

Here’s a couple of them drawn.

Notice the use of `translate()` to position them.

```auto
float a;
float phi = 50 + 50 * sqrt(5.0);
float one = 100;

void setup() {
  size(400, 400);
  noFill();
}

void draw() {
  background(0);

  translate(30, height-30);

  stroke(0,200,0);
  beginShape();
    vertex(0,0);
    vertex(phi,0);
    vertex(phi*cos(-radians(36)),phi*sin(-radians(36)));
    vertex(phi*cos(-radians(72)),phi*sin(-radians(72)));
  endShape(CLOSE);

  translate(5,-5);

  stroke(0,0,200);
  beginShape();
    vertex(phi,0);
    vertex(phi*cos(-radians(36)),phi*sin(-radians(36)));
    vertex(phi*cos(-radians(72)),phi*sin(-radians(72)));
    vertex((phi+one)*cos(-radians(36)),(phi+one)*sin(-radians(36)));
  endShape(CLOSE);

}

```

---

<div class="post-metadata">

**Author:** ![Tonchii](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@Tonchii](https://discourse.processing.org/u/Tonchii)\
**Post date:** [August 5, 2018, 9:35pm UTC](https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392/3 "2018-08-05T21:35:12Z")

</div>

I see, thanks, i would have to put them inside the pentagon, which is what is bugging me out

---

<div class="post-metadata">

**Author:** ![Takashi](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@Takashi](https://discourse.processing.org/u/Takashi)\
**Post date:** [August 5, 2018, 10:16pm UTC](https://discourse.processing.org/t/help-a-newbie-with-penrose-tilling/2392/4 "2018-08-05T22:16:34Z")

</div>

Man, i was doing that test with him, i rlly love you, you will go to heaven

 ![21149919_1788286171463946_3570818885307251042_n](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f14889dac78d7b9d247cf604342f95d0f9965cbd.jpg)
