int polygons;
float angle;
int vertices;
float minRadius;
float maxRadius;
int n = 50;
int x;
float y = 5;
float noiseY;
color [] rainbow = {#DA00FC, #FF0DFC, #FFEB08,#D6FC00, #08F5FF};
void setup() {
size(950, 600 );
background(#FFFCFC);
frameRate(10);
smooth();
polygons = 50;
angle = 3;
vertices = 5;
minRadius = 20.0;
maxRadius = 400.0;
}
void draw() {
translate(width/2, height/2);
for (int i = 0; i < polygons; i++) {
rotate (PI*angle/180.0);
drawPolygon(vertices, (float) minRadius + i*(maxRadius-minRadius)/polygons);
}
}
void drawPolygon (int numVerts, float radius) {
float vxorig = 0.0;
float vyorig = 0.0;
float vxa = 0.0;
float vya = 0.0;
float vxb= 0.0;
float vyb = 0.0;
vxorig = cos(0.0*TWO_PI)*radius;
vyorig = sin(0.0*TWO_PI)*radius;
for (int i = 0; i <(numVerts -1); i++) {
vxa = cos((float)mouseX / numVerts*TWO_PI)*radius;
vya = sin((float)mouseY / numVerts*TWO_PI)*radius;
vxb = cos((float)(mouseX+1) / numVerts*TWO_PI)*radius;
vyb = sin((float)(mouseY+1) / numVerts*TWO_PI)*radius;
line(vxa, vya, vxb, vyb);
}
y += .02;
noiseY = noise(y)* height ;
stroke (rainbow[int(random(1,5))]);
line(vxb, vyb, vxorig,vyorig);
}
Book reference :
Parametric Design for architecture
0 comments:
Post a Comment