ArrayList points;
int counter;
double step, theta;
PVector dummy;
void setup(){
frameRate(10);//instruccion para acelerar la ejecucion
size(500,500);
background(600);
stroke(98);
fill(168);
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 = 300;
float k = 150;
float r = counter;
background(255, 300, 100);//color cambia
actx=h;
acty=h;
//for(float theta=0; theta < 2* Math.PI; theta+=step)
if(theta<9*Math.PI)//controlador de vueltas
{ 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,5,10);
counter++;
theta+=step;
trace();
}
}
void trace(){
for(int i=0; i<points.size()-2;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;
}
}
int counter;
double step, theta;
PVector dummy;
void setup(){
frameRate(10);//instruccion para acelerar la ejecucion
size(500,500);
background(600);
stroke(98);
fill(168);
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 = 300;
float k = 150;
float r = counter;
background(255, 300, 100);//color cambia
actx=h;
acty=h;
//for(float theta=0; theta < 2* Math.PI; theta+=step)
if(theta<9*Math.PI)//controlador de vueltas
{ 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,5,10);
counter++;
theta+=step;
trace();
}
}
void trace(){
for(int i=0; i<points.size()-2;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;
}
}

Comentarios
Publicar un comentario