|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object prefuse.util.force.ForceSimulator
public class ForceSimulator
Manages a simulation of physical forces acting on bodies. To create a
custom ForceSimulator, add the desired Force
functions and choose an
appropriate Integrator
.
Constructor Summary | |
---|---|
ForceSimulator()
Create a new, empty ForceSimulator. |
|
ForceSimulator(Integrator integr)
Create a new, empty ForceSimulator. |
Method Summary | |
---|---|
void |
accumulate()
Accumulate all forces acting on the items in this simulation |
void |
addForce(Force f)
Add a new Force function to the simulator. |
void |
addItem(ForceItem item)
Add a ForceItem to the simulation. |
Spring |
addSpring(ForceItem item1,
ForceItem item2)
Add a Spring to the simulation. |
Spring |
addSpring(ForceItem item1,
ForceItem item2,
float length)
Add a Spring to the simulation. |
Spring |
addSpring(ForceItem item1,
ForceItem item2,
float coeff,
float length)
Add a Spring to the simulation. |
void |
clear()
Clear this simulator, removing all ForceItem and Spring instances for the simulator. |
Force[] |
getForces()
Get an array of all the Force functions used in this simulator. |
Integrator |
getIntegrator()
Get the Integrator used by this simulator. |
java.util.Iterator |
getItems()
Get an iterator over all registered ForceItems. |
float |
getSpeedLimit()
Get the speed limit, or maximum velocity value allowed by this simulator. |
java.util.Iterator |
getSprings()
Get an iterator over all registered Springs. |
boolean |
removeItem(ForceItem item)
Remove a ForceItem to the simulation. |
void |
runSimulator(long timestep)
Run the simulator for one timestep. |
void |
setIntegrator(Integrator intgr)
Set the Integrator used by this simulator. |
void |
setSpeedLimit(float limit)
Set the speed limit, or maximum velocity value allowed by this simulator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ForceSimulator()
public ForceSimulator(Integrator integr)
integr
- the Integrator to useMethod Detail |
---|
public float getSpeedLimit()
public void setSpeedLimit(float limit)
limit
- the "speed limit" maximum velocity value to usepublic Integrator getIntegrator()
public void setIntegrator(Integrator intgr)
intgr
- the Integrator to usepublic void clear()
public void addForce(Force f)
f
- the Force function to addpublic Force[] getForces()
public void addItem(ForceItem item)
item
- the ForceItem to addpublic boolean removeItem(ForceItem item)
item
- the ForceItem to removepublic java.util.Iterator getItems()
public Spring addSpring(ForceItem item1, ForceItem item2)
item1
- the first endpoint of the springitem2
- the second endpoint of the spring
public Spring addSpring(ForceItem item1, ForceItem item2, float length)
item1
- the first endpoint of the springitem2
- the second endpoint of the springlength
- the spring length
public Spring addSpring(ForceItem item1, ForceItem item2, float coeff, float length)
item1
- the first endpoint of the springitem2
- the second endpoint of the springcoeff
- the spring coefficientlength
- the spring length
public java.util.Iterator getSprings()
public void runSimulator(long timestep)
timestep
- the span of the timestep for which to run the simulatorpublic void accumulate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |