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 a = sqrt(nx*nx+ny*ny);
//horizontale lijnen  
for (float i = 0; i < height; i = i + nx) {  
 line(0, i, width, i); 
}  
//verticale lijnen  
for (float j = 0; j < width; j = j + ny) {  
 line(j, 0, j, height); 
} 
//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);