# penrose tiling

December 2, 2008 at 11:41 am
filed under ICM, main
Tagged , ,

Penrose tiling is a very special pattern. I love it for its infinitely interlocking and freeform pattern. “Among the infinitely many possible tilings there are two that possess both mirror symmetry and fivefold rotational symmetry, as in the diagram at the right, and the term Penrose tiling usually refers to them.” How romantic.

The tiling is also interesting because it allows one to create distorted spaces and perspectives that are cubist in nature.

viel spass!

//Penrose Tiles by Gloria Suzie Kim 2008

Rhombus[] rhombi = new Rhombus[1]; // We start with an array with just one element.
//float gravity = 0.1;
Boolean fatMode = true;
Boolean stampMode = true;
int currRotation;

void setup() {
size(600,600);
smooth();

// Initialize rhombus index 0
rhombi[0] = new Rhombus(50,0,fatMode,currRotation);
}

void draw() {
background(255);

// Update and display all balls
for (int i = 0; i < rhombi.length; i ++ ) { // Whatever the length of that array, update and display all of the objects.
// balls[i].gravity();
// rhombi[i].move();
rhombi[i].display();

if (stampMode==true) {

if (fatMode==true) {

pushMatrix();
translate(mouseX,mouseY);

stroke(0);
strokeWeight(2);
fill(0,0,255,90);
int border=70;
rotate((TWO_PI/5)*currRotation);
beginShape();
vertex(0,0);
vertex(border,0);
endShape(CLOSE);
popMatrix();
}
else {

pushMatrix();
translate(mouseX,mouseY);
stroke(0);
strokeWeight(2);
fill(0,0,255);
int border=70;
rotate((TWO_PI/5)*currRotation);
beginShape();
vertex(0,0);
vertex(border,0);
endShape(CLOSE);
popMatrix();
}
}
}
}
void keyPressed() {
if(key==’q') {
stampMode = !stampMode;
}
if(key==’t') {
fatMode = !fatMode;
}
if(key == ‘1′){
currRotation = 1;
}
if(key == ‘2′){
currRotation = 2;
}
if(key == ‘3′){
currRotation = 3;
}
if(key == ‘4′){
currRotation = 4;
}
if(key == ‘5′){
currRotation = 5;
}
}
void mousePressed() {
// A new rhombus object

if (stampMode==true) {
Rhombus b = new Rhombus(mouseX,mouseY,fatMode,currRotation); // Make a new object at the mouse location.
rhombi = (Rhombus[]) append(rhombi,b);
}

// Here, the function, append() adds an element to the end of the array.
// append() takes two arguments. The first is the array you want to append to, and the second is the thing you want to append.
// You have to reassign the result of the append() function to the original array.
// In addition, the append() function requires that you explicitly state the type of data in the array again by putting the
// array data type in parentheses: (Rhombus[]) This is known as casting.
}
//BEGIN CLASS

// Example 9-11: Resizing an array using append()

class Rhombus {
boolean iAmFat=true;
float x;
float y;
// float speed;
int rotation;

Rhombus (float tempX, float tempY,boolean tempFat, int r) {
x = tempX;
y = tempY;
// speed = 0;
iAmFat=tempFat;
rotation = r;
}

// void gravity() {
// speed = speed + gravity;
// }
//void move() {
// Add speed to y location
// y = y ;
// If square reaches the bottom
// Reverse speed
//if (y > height) {
//speed = speed * -0.95;
//y = height;

// }
// }

void setRotation(int r){
rotation = r;
}

void display() {
if (iAmFat) {

pushMatrix();
translate(x,y);

stroke(0);
strokeWeight(2);
fill(0,0,255,90);
int border=70;
rotate((TWO_PI/5) * rotation);
beginShape();
vertex(0,0);
vertex(border,0);
endShape(CLOSE);
popMatrix();
}
else {

pushMatrix();
translate(x,y);
stroke(0);
strokeWeight(2);
fill(0,0,255);
int border=70;
rotate((TWO_PI/5) * rotation);
beginShape();
vertex(0,0);
vertex(border,0);