Warning: This has not been touched since 2011
- internally uses PVector so no more wasteful vector conversion
- RK4 and Euler integrators
- Spring, Magnetic, ConstantGravitational, and Attractive forces
- plug in your own integrators and Forces
- uses a base Particle class for easy extenisbility
- examples provided
Download the latest binaries here:
Unzip and place the p5particles directory in your Processing libraries folder.
For more info see Daniel Shiffman's page on the subject of installing libraries.
I have a number a few examples so far. Here are the links to the live applets. I have had some issues viewing them in Chrome, they seem to work best in Firefox from what I have tested.
The library comes with the examples so you can always open them locally.
The documentation, as it stands, constists of the examples and these javadocs which are quite sparse:
http://processing.datasingularity.com/p5particles/doc/
You will want to become very familiar with the Particle class.
For instance, here is how we can create a particle that is rendered as a colored box of specified size:
If you are going to be adding and removing many particles or forces throughout the lifetime of the sketch, use ParticleSystem::setMaxForces() and ParticleSystem::setMaxParticles(). This isn't actually a maximum, it just allocates that much memory ahead of time so adding a force or particle does not result in a copy of the array. All you need to do is take a guess at the maximum. This could be really useful for starting up an application. It internally calls ArrayList::ensureCapacity so look there for more info.
The calculations themselves aren't too expensive. setting the ParticleSystem::setManagingLifecycle(true) can cause a slight performance drop, but for the most part, you are limited by rendering. Stay away from iterating over Particles or Forces when you don't have to, keep local copies of Particles or Forces that you want to manipulate often.