Package toxi.physics2d.behaviors
Class AttractionBehavior2D
java.lang.Object
toxi.physics2d.behaviors.AttractionBehavior2D
- All Implemented Interfaces:
ParticleBehavior2D
-
Constructor Summary
ConstructorsConstructorDescriptionAttractionBehavior2D(Vec2D attractor, float radius, float strength) AttractionBehavior2D(Vec2D attractor, float radius, float strength, float jitter) -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the constraint to the passed in particle.voidapplyWithIndex(SpatialIndex<Vec2D> spaceHash) voidconfigure(float timeStep) floatfloatfloatvoidsetAttractor(Vec2D attractor) voidsetJitter(float jitter) voidsetRadius(float r) voidsetStrength(float strength) boolean
-
Constructor Details
-
AttractionBehavior2D
-
AttractionBehavior2D
-
-
Method Details
-
apply
Description copied from interface:ParticleBehavior2DApplies the constraint to the passed in particle. The method is assumed to manipulate the given instance directly.- Specified by:
applyin interfaceParticleBehavior2D- Parameters:
p- particle
-
applyWithIndex
- Specified by:
applyWithIndexin interfaceParticleBehavior2D
-
configure
public void configure(float timeStep) - Specified by:
configurein interfaceParticleBehavior2D
-
getAttractor
- Returns:
- the attractor
-
getJitter
public float getJitter()- Returns:
- the jitter
-
getRadius
public float getRadius()- Returns:
- the radius
-
getStrength
public float getStrength()- Returns:
- the strength
-
setAttractor
- Parameters:
attractor- the attractor to set
-
setJitter
public void setJitter(float jitter) - Parameters:
jitter- the jitter to set
-
setRadius
public void setRadius(float r) -
setStrength
public void setStrength(float strength) - Parameters:
strength- the strength to set
-
supportsSpatialIndex
public boolean supportsSpatialIndex()- Specified by:
supportsSpatialIndexin interfaceParticleBehavior2D
-