header

De ruitjespapier class                                             terug naar de inleiding
 
 

class Ruitjes {  
 float y; 
 float x; 
 float n;  
  
 Ruitjes(float x_, float y_, float n_) {  
 x = x_; 
 y = y_; 
 n = n_;  
 }  
  
 void display() {  
 strokeWeight(1);  
 stroke(0); 
 // horizontale lijntjes  
 for (float i = 0; i < height/2; i = i + n) {  
 line(0,height/2+i,width, height/2+i); //naar beneden 
 line(0,height/2-i,width, height/2-i); //naar boven 
 }  
  
 //verticale lijntjes  
 for (float i = 0; i < width/2; i = i + n) {  
 line(width/2+i,0, width/2+i,height); //naar rechts 
 line(width/2-i,0, width/2-i,height); //naar links 
 } 
  
 strokeWeight(2);  
 stroke(255, 0, 0);  
 //rode assenstelsel  
 line(0, height/2, width, height/2);  
 line(width/2, 0, width/2, height);  
 stroke(0); 
 strokeWeight(10); 
 //om de 5 vakjes een controle puntje plaatsen  
 for (int k = 0; k < height; k = k+5) {  
 point(x-k*n, y);  
 point(x+k*n, y);  
 point(x, y-k*n);  
 point(x, y+k*n);  
 }  
 strokeWeight(1);  
 stroke(0);  
 }  
}