annemarie
YaBB Newbies
Offline
Posts: 43
points on curve in stead of ellipses ...
May 8th , 2006, 2:42am
Hi, I think that this code can run faster, if I use points, but I can't get points to follow the curve in the same way as ellipses - why is that? AURA shine; class AURA { // set parameters for the particle void display() { for(int i=0; i<numParams; i++){ x[i] = x_[i]; } stroke(20, 7, 19, 200); curve(Ipol[0], Ipol[1], Ipol[2], Ipol[3], Ipol[4], Ipol[5], Ipol[6], Ipol[7]); curve(Ipol[8], Ipol[9], Ipol[4], Ipol[5], Ipol[10], Ipol[11], Ipol[12], Ipol[13]); ellipseMode(CENTER); int steps = 50; for(int i = 0; i <= steps; i++) { float t_ln1 = i / float(steps); float x_ln1 = curvePoint(Ipol[0], Ipol[2], Ipol[4], Ipol[6], t_ln1); float y_ln1 = curvePoint(Ipol[1], Ipol[3], Ipol[5], Ipol[7], t_ln1); fill(230, 230, 200, 100); noStroke(); // HOW DO I USE A POINT IN STEAD OF AN ELLIPSE THAT FOLLOWS THE CURVES ? for(int lines = 0; lines <= halo; lines++) { ellipse(x_ln1 + lines + randPosX[lines], y_ln1 + lines + randPosY[lines] , 1, 1); } } ellipseMode(CENTER); int steps_2 = 50; for(int i = 0; i <= steps_2; i++) { float t_ln2 = i / float(steps_2); float x_ln2 = curvePoint(Ipol[8], Ipol[4], Ipol[10], Ipol[12], t_ln2); float y_ln2 = curvePoint(Ipol[9], Ipol[5], Ipol[11], Ipol[13], t_ln2); fill(230, 230, 200, 100); noStroke(); // HOW DO I USE A POINT IN STEAD OF AN ELLIPSE THAT FOLLOWS THE CURVES ? for(int lines = 0; lines <= halo; lines++) { ellipse(x_ln2 + lines + randPosX[lines], y_ln2 + lines + randPosY[lines] , 1, 1); } } // random position of the halo dots count++; // Increment the counter if(count >= 10) { count = 0; } if(count >= 2 && count >= 5 && count >= 7) { for(int i=0; i <= halo; i++) { haloPosX[i] = random(0, 10); haloPosY[i] = random(0, 10); } }