ArrayList points;
int counter;
double step, theta;
PVector dummy;
void setup(){
frameRate(90);
size(500,500);
background(150,3,200);
stroke(50,100,45); fill(10,3,255);
points = new ArrayList();
dummy = new PVector(0,0);
counter=0;
theta=0;
step = Math.PI/40;
}
void draw() {
float actx = 0;
float acty = 0;
float h = 150;
float k = 150;
float r = 50;
background(200,60,200);
actx=h;
acty=h;
//for(float theta=0; theta < 2*Math.PI; theta+=step)
if(theta<2*Math.PI)
{ float x = (float)(h + r*Math.cos(theta));
float y = (float)(k - r*Math.sin(theta));
//point(x,y);
pint p = new pint(x,y,counter); points.add(p);
ellipse(x,y,90,90);
counter++;
theta+=step;
trace();
}
}
void trace(){
for(int i=0; i<points.size()-7;i++){
pint p1 = (pint) points.get(i);
pint p2 = (pint) points.get(i+1);
if(p1.index==p2.index-1)
line(p1.x,p1.y,p2.x,p2.y);
}
}
class pint extends PVector{
float x,y;
float index;
pint(float x_, float y_, float i){
x = x_;
y = y_;
index = i;
}
}
Ejemplos:
No hay comentarios:
Publicar un comentario