Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Field Summary
`static boolean` | `INSIDE`
`boolean` | `isBoundingSphere`
`static boolean` | `OUTSIDE`
`toxi.geom.Sphere` | `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.

Method Summary
`void` | `apply(VerletParticle p)` Applies the constraint to the passed in particle.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### 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

Constructor Detail

### SphereConstraint

    public SphereConstraint(toxi.geom.Sphere sphere,
                            boolean isBoundary)

  Creates a new instance using the sphere definition and constraint mode given.

  Parameters:
    `sphere` - sphere instance
    `isBoundary` - 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 origin
    `radius` - sphere radius
    `isBoundary` - constraint mode. Use INSIDE or OUTSIDE to specify constraint behaviour.

Method Detail

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD