We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › points on curve in stead of ellipses ...
Page Index Toggle Pages: 1
points on curve in stead of ellipses ... (Read 464 times)
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); } }
Re: points on curve in stead of ellipses ...
Reply #1 - May 8th, 2006, 7:11am
 
don't call noStroke()
point(x, y) is implemented (in source) as: line(x, y, x, y);


Re: points on curve in stead of ellipses ...
Reply #2 - May 8th, 2006, 10:17am
 
or you might as well just try
rect( .. same values as with ellipse here .. );

can you pls post the complete code (or a simplified subset), so it's easier to find the problem with stroke/line which you mentioned in the duplicate post?

best,
F
Page Index Toggle Pages: 1