schets uitgelijnd in vierkant canvas

 

Het uitlijnen van  vormen in een vierkant canvas.        terug naar de inleiding
Met gebruik van ruitjespapier
 

 

size(1000, 1000);   
background(#E6FBFF); 
float x = width/2;  
float y = height/2;  
float ny = height/20;   
float nx = width/20;   
float n = height/20; 
float a = sqrt(nx*nx+ny*ny); 
 
// 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   
}  
 
//assenstelsel   
strokeWeight(2);  
stroke(255, 0, 0);   
line(width/2, 0, width/2, height);   
line(0, height/2, width, height/2);   
stroke(0);   
strokeWeight(1); 
//De vormen  
fill(#FA65DA,100);  
rectMode(CENTER);  
rect(x-7*nx, y-7*ny, 2*nx, 2*ny);  
fill(#65FA7C,100);  
quad(x-8*nx,y-6*ny, x-6*nx,y-8*ny, x-3*nx, y-5*ny, x-5*nx, y-3*ny);   
fill(#FA65DA,100);  
rect(x-4*nx, y-4*ny, 2*nx, 2*ny); 
fill(#FA65DA,100);  
  
rect(x+7*nx, y-7*ny, 2*nx, 2*ny);  
fill(#65FA7C,100);  
quad(x+8*nx,y-6*ny, x+6*nx,y-8*ny, x+3*nx, y-5*ny, x+5*nx, y-3*ny);   
fill(#FA65DA,100);  
rect(x+4*nx, y-4*ny, 2*nx, 2*ny); 
fill(#FA65DA,100);  
  
rect(x+7*nx, y+7*ny, 2*nx, 2*ny);  
fill(#65FA7C,100);  
quad(x+8*nx,y+6*ny, x+6*nx,y+8*ny, x+3*nx, y+5*ny, x+5*nx, y+3*ny);   
fill(#FA65DA,100);  
rect(x+4*nx, y+4*ny, 2*nx, 2*ny); 
fill(#FA65DA,100);  
  
rect(x-7*nx, y+7*ny, 2*nx, 2*ny);  
fill(#65FA7C,100);  
quad(x-8*nx,y+6*ny, x-6*nx,y+8*ny, x-3*nx, y+5*ny, x-5*nx, y+3*ny);   
fill(#FA65DA,100);  
rect(x-4*nx, y+4*ny, 2*nx, 2*ny);  
fill(0,255,0,100);  
ellipse(x,y, 6*a, 6*a);