I wanted to try this library for quite some time, having the archive, but it was not installed yet.
So you motivated me to install it (v.0004 with core v.0014) and try the demo.
First, I am surprised because unlike what you describe, the links of the ThreadDemo are rigid: if I reduce them to 20 and set their length to 50, I don't see their length to change.
Second, I am slightly annoyed as I tried to customize look of particles, but found out that isLocked field is protected and has no getter... Another annoyance, in the doc, is that 2D stuff (Vec2D, Xxx2D) is made out of the 3D stuff. The parameter list (for example) has changed, but not the JavaDoc!
I tried, like you, to play with the strength parameter. It worked fine up to a value of 2.0, after that I have a ball of thread. Looks like at low values the thread is more flexible, at higher values it is more rigid.
Forces: you can set the gravity, for example. Looking at the source of VerletPhysics2D, I see it is applied on each particle on each iteration.
You can use a similar method, inspired by code seen at
FidGen.pde:
Code:Iterator ip = physics.particles.iterator();
while (ip.hasNext()) {
VerletParticle2D p = (VerletParticle2D) ip.next();
p.addSelf(force.scale(p.weight));
}
where force is a Vec2D. Well, in the gravity code, there is a test on
!p.isLocked but Processing sketches doesn't have access to this field...
You can also define constraints yourself.
Set tick(). The tick of this physics system seems to be entirely driven by calls to
physics.update();. So if you want a slow motion effect, just call it every n draw() calls.
friction and timeStep: from what I see, the force applied to particles depends on friction multiplied by the squared timeStep:
float force = 1.0f - friction * timeStep * timeStep;So I think both parameters are designed to be below 1.
numIterations, if I understood correctly, acts on the quality of the simulation: the higher the number, the better the simulation, at the cost of CPU power!
I think traer's and toxic's physics engines have slightly different aims.
toxics seems to use it mostly for blob simulation (like in the fiducial or Nokia demos), filling a shape with a number of particles and lot of springs between them.
They use different integration systems (Verlet vs. Runge-Kutta (or Euler)), with
different stability issues.
So these libraries seem more complementary than being a replacement for each other.
Now, I am not a specialist of the field, so if I wrote anything wrong or inaccurate above, please correct me.