Class Index | File Index

Classes


Class pv.Constraint.collision

Constraints circles to avoid overlap. Each particle is treated as a circle, with the radius of the particle computed using a specified function. For example, if the particle has an r attribute storing the radius, the radius function(d) d.r specifies a collision constraint using this radius. The radius function is passed each pv.Particle as the first argument.

To accelerate collision detection, this implementation uses a quadtree and a search radius. The search radius is computed as the maximum radius of all particles in the simulation.
Defined in: CollisionConstraint.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Constructs a new collision constraint.
Method Summary
Method Attributes Method Name and Description
 
apply(particles, q)
Applies this constraint to the specified particles.
 
repeat(x)
Sets or gets the repeat count.
Class Detail
pv.Constraint.collision(radius)
Constructs a new collision constraint. The default search radius is 10, and the default repeat count is 1. A radius function must be specified to compute the radius of particles.
Parameters:
{function} radius
the radius function.
See:
pv.Constraint
Method Detail
apply(particles, q)
Applies this constraint to the specified particles.
Parameters:
{pv.Particle} particles
particles to which to apply this constraint.
{pv.Quadtree} q
a quadtree for spatial acceleration.

{pv.Constraint.collision} repeat(x)
Sets or gets the repeat count. If the repeat count is greater than 1, the constraint will be applied repeatedly; this is a form of the Gauss-Seidel method for constraints relaxation. Repeating the collision constraint makes the constraint have more of an effect when there is a potential for many co-occurring collisions.
Parameters:
{number} x
the number of times to repeat this constraint.
Returns:
{pv.Constraint.collision} this.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun May 30 2010 18:10:23 GMT-0700 (PDT)