toxi.physics.constraints
Class SphereConstraint
java.lang.Object
toxi.physics.constraints.SphereConstraint
- All Implemented Interfaces:
- ParticleConstraint
public class SphereConstraint
- extends java.lang.Object
- implements ParticleConstraint
This class implements a spherical constraint for 3D
VerletParticles. The constraint can be configured in two ways: A
bounding sphere not allowing particles to escape or alternatively does not
allow particles to enter the space occupied by the sphere.
Constructor Summary |
SphereConstraint(toxi.geom.Sphere sphere,
boolean isBoundary)
Creates a new instance using the sphere definition and constraint mode
given. |
SphereConstraint(toxi.geom.Vec3D origin,
float radius,
boolean isBoundary)
Creates a new instance using the sphere definition and constraint mode
given. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sphere
public toxi.geom.Sphere sphere
isBoundingSphere
public boolean isBoundingSphere
INSIDE
public static final boolean INSIDE
- See Also:
- Constant Field Values
OUTSIDE
public static final boolean OUTSIDE
- See Also:
- Constant Field Values
SphereConstraint
public SphereConstraint(toxi.geom.Sphere sphere,
boolean isBoundary)
- Creates a new instance using the sphere definition and constraint mode
given.
- Parameters:
sphere
- sphere instanceisBoundary
- constraint mode. Use INSIDE or
OUTSIDE to specify constraint behaviour.
SphereConstraint
public SphereConstraint(toxi.geom.Vec3D origin,
float radius,
boolean isBoundary)
- Creates a new instance using the sphere definition and constraint mode
given.
- Parameters:
origin
- sphere originradius
- sphere radiusisBoundary
- constraint mode. Use INSIDE or
OUTSIDE to specify constraint behaviour.
apply
public void apply(VerletParticle p)
- Description copied from interface:
ParticleConstraint
- Applies the constraint to the passed in particle. The method is assumed
to manipulate the given instance directly.
- Specified by:
apply
in interface ParticleConstraint
- Parameters:
p
- particle