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 & HelpPrograms › performance issues
Page Index Toggle Pages: 1
performance issues (Read 438 times)
performance issues
Feb 19th, 2006, 6:48pm
 
Hello All,
We have been playing with particle systems at my school and I have come up with this example below:

http://klaweht.com/blog/noc/particles/applet/
this is the source code zipped: http://klaweht.com/blog/noc/particles/Archive.zip

as you can see, it is so slow right now and the the reason for this is I am creating this circular shape in the run() method of ParticleSystem class which is below:

Code:

void run() {
for(int i = 0; i < 36; i++) {
origin = new Vector3D(cos(i)*40.0, sin(i)*40.0);
particles.add(new Particle(origin, new Vector3D(random(-2,2),random(-2,2)), new Vector3D(0,0),1));
}
for ( int i = particles.size()-1; i >= 0; i--) {

Particle p = (Particle) particles.get(i);
p.run();
if(p.dead()) {

particles.remove(i);

}
}
}


my guess would be taking it off from there and adding a class that would draw the circular shape. But I want to ask to you guys at first.  what would be the good way of optimizing such a code? Lookup tables? I am clueless about them.

thanks in advance.
Page Index Toggle Pages: 1