ds = n*1.2ds = n*1.2

 

 

 

ds = n*1.6ds = n*1.6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

box drieh01   box drieh02                                                                 

 

Boxen die een onmogelijke driehoek vormen.                   terug naar de inleiding

De twee ruiten (line 30 en 31) maken het bedrog compleet.

de schets maakt gebruik van de classes  "Box"  , "Ruit"  en de superclass "Vormen"

 

 

Vormen[] vorm = new Vormen[11];  
 
void setup() {  
  size(960, 640);  
//  fullScreen(); 
  float x = width/2;  
  float y = height/1.4;  
  float n = height/10; 
  float ds = n*1.5; 
  float hoek = 60;  
  float xc1 = ds*1*cos(radians(hoek)); 
  float yc1 = ds*1*sin(radians(hoek)); 
  float xc2 = ds*2*cos(radians(hoek)); 
  float yc2 = ds*2*sin(radians(hoek)); 
  float xc3 = ds*3*cos(radians(hoek)); 
  float yc3 = ds*3*sin(radians(hoek)); 
  int kl1 = #275F8B; int kl2 =#3A8BCB; int kl3 = #85C7FC;  
 // int kl1 = #D12026; int kl2 =#FF2930; int kl3 = #FF868A;  
 // int kl1 = #309820; int kl2 =#48F52F; int kl3 = #85F574;  
  vorm[0] = new Box(n,n,7, x-xc1, y-yc1, -30, color(kl1),color(kl2),color(kl3));  
  vorm[1] = new Box(n,n,7, x-xc2, y-yc2, -30, color(kl1),color(kl2),color(kl3));  
  vorm[2] = new Box(n,n,7, x-xc3, y-yc3, -30, color(kl1),color(kl2),color(kl3));  
  vorm[3] = new Box(n,n,7, x-xc1, y-yc3, -30, color(kl1),color(kl2),color(kl3));  
  vorm[4] = new Box(n,n,7, x+xc1, y-yc3, -30, color(kl1),color(kl2),color(kl3));  
  vorm[5] = new Box(n,n,7, x+3*xc1,y-yc3,-30, color(kl1),color(kl2),color(kl3)); 
  vorm[6] = new Box(n,n,7, x+2*xc1,y-yc2,-30, color(kl1),color(kl2),color(kl3)); 
  vorm[7] = new Box(n,n,7, x+xc1,  y-yc1,-30, color(kl1),color(kl2),color(kl3));  
  vorm[8] = new Box(n,n,7, x, y, -30,         color(kl1),color(kl2),color(kl3)); 
  vorm[9] =  new Ruit(n,3, x-xc1,  y-yc1,  0, color(kl3));  
  vorm[10] = new Ruit(n,7, x-xc1,  y-yc1,-60, color(kl2));   
}  
void draw() {  
  background(#E6FBFF);  
   for (int i = 0; i < 11; i++)   
{   
 vorm[i].display();   
}   
}
 
penrose driehoek samengesteld met boxen
 
 

Vormen[] vorm = new Vormen[19]; 
void setup() {   
 // fullScreen(); 
  size(960, 540);   
  float x = width/2;   
  float y = height/2;   
  float n = height/10;         
  float hn = sqrt(3*n*n/4);   
  int dpb = 7;  
  float xp = x-2*n; 
 // int kl1 = #275F8B; int kl2 =#3A8BCB; int kl3 = #85C7FC; 
 // int kl1 = #D12026; int kl2 =#FF2930; int kl3 = #FF868A;   
  int kl1 = #309820; int kl2 =#48F52F; int kl3 = #85F574;   
  vorm[0] = new Box(n,n, dpb, xp, y+3*n,  0, color(kl1),color(kl2),color(kl3));   
  vorm[1] = new Box(n,n, dpb, xp, y+2*n,  0, color(kl1),color(kl2),color(kl3));   
  vorm[2] = new Box(n,n, dpb, xp, y+n,    0, color(kl1),color(kl2),color(kl3));   
  vorm[3] = new Box(n,n, dpb, xp, y,      0, color(kl1),color(kl2),color(kl3));  
  vorm[4] = new Box(n,n, dpb, xp, y-n,    0, color(kl1),color(kl2),color(kl3));   
  vorm[5] = new Box(n,n, dpb, xp, y-2*n,  0, color(kl1),color(kl2),color(kl3));      
  vorm[6] = new Box(n,n, dpb, xp, y-3*n,  0, color(kl1),color(kl2),color(kl3));     
  vorm[7] = new Box(n,n, dpb, xp+hn,   y-2.5*n, 0,color(kl1),color(kl2),color(kl3));      
  vorm[8] = new Box(n,n, dpb, xp+2*hn, y-2*n,   0, color(kl1),color(kl2),color(kl3));     
  vorm[9] = new Box(n,n, dpb, xp+3*hn, y-1.5*n, 0, color(kl1),color(kl2),color(kl3));  
  vorm[10] = new Box(n,n,dpb, xp+4*hn, y-n,     0, color(kl1),color(kl2),color(kl3)); 
  vorm[11] = new Box(n,n,dpb, xp+5*hn, y-n/2,   0, color(kl1),color(kl2),color(kl3)); 
  vorm[12] = new Box(n,n,dpb, xp+6*hn, y,       0, color(kl1),color(kl2),color(kl3));    
  vorm[13] = new Box(n,n,dpb, xp+5*hn, y+n/2,   0, color(kl1),color(kl2),color(kl3));   
  vorm[14] = new Box(n,n,dpb, xp+4*hn, y+n,     0, color(kl1),color(kl2),color(kl3)); 
  vorm[15] = new Box(n,n,dpb, xp+3*hn, y+1.5*n, 0, color(kl1),color(kl2),color(kl3)); 
  vorm[16] = new Box(n,n,dpb, xp+2*hn, y+2*n,   0, color(kl1),color(kl2),color(kl3));  
  vorm[17] = new Ruit(n, 5,   xp+2*hn, y+2*n,  30, color(kl3)); 
  vorm[18] = new Drieh_nh(n,hn,3,xp+2*hn,y+2*n,90, color(kl1)); 
   
} 
void draw() {   
  background(#E6FBFF); 
   //assenstelsel    
  stroke(255, 0, 0);    
  line (width/2,0, width/2, height);    
  line(0, height/2, width, height/2);    
  stroke(0);     
  for (int i = 0; i < 19; i++)   
  {   
  vorm[i].display();   
  }   
}