Package toxi.physics3d.constraints
Class SphereConstraint
java.lang.Object
toxi.physics3d.constraints.SphereConstraint
- All Implemented Interfaces:
ParticleConstraint3D
This class implements a spherical constraint for 3D
VerletParticle3Ds. 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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
boolean
static final boolean
-
Constructor Summary
ConstructorDescriptionSphereConstraint
(Sphere sphere, boolean isBoundary) Creates a new instance using the sphere definition and constraint mode given.SphereConstraint
(Vec3D origin, float radius, boolean isBoundary) Creates a new instance using the sphere definition and constraint mode given. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Applies the constraint to the passed in particle.
-
Field Details
-
sphere
-
isBoundingSphere
public boolean isBoundingSphere -
INSIDE
public static final boolean INSIDE- See Also:
-
OUTSIDE
public static final boolean OUTSIDE- See Also:
-
-
Constructor Details
-
SphereConstraint
Creates a new instance using the sphere definition and constraint mode given. -
SphereConstraint
Creates a new instance using the sphere definition and constraint mode given.
-
-
Method Details
-
apply
Description copied from interface:ParticleConstraint3D
Applies the constraint to the passed in particle. The method is assumed to manipulate the given instance directly.- Specified by:
apply
in interfaceParticleConstraint3D
- Parameters:
p
- particle
-