|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprefuse.util.force.ForceSimulatorImpl
public class ForceSimulatorImpl
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 | |
|---|---|
ForceSimulatorImpl()
Create a new, empty ForceSimulator. |
|
ForceSimulatorImpl(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()
|
java.util.List<ForceItem> |
getItems()
Get an iterator over all registered ForceItems. |
float |
getSpeedLimit()
Get the speed limit, or maximum velocity value allowed by this simulator. |
java.util.List<Spring> |
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)
|
void |
setSpeedLimit(float limit)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ForceSimulatorImpl()
public ForceSimulatorImpl(Integrator integr)
integr - the Integrator to use| Method Detail |
|---|
public float getSpeedLimit()
ForceSimulator
getSpeedLimit in interface ForceSimulatorpublic void setSpeedLimit(float limit)
public Integrator getIntegrator()
public void setIntegrator(Integrator intgr)
public void clear()
ForceSimulator
clear in interface ForceSimulatorpublic void addForce(Force f)
ForceSimulator
addForce in interface ForceSimulatorf - the Force function to addpublic Force[] getForces()
ForceSimulator
getForces in interface ForceSimulatorpublic void addItem(ForceItem item)
ForceSimulator
addItem in interface ForceSimulatoritem - the ForceItem to addpublic boolean removeItem(ForceItem item)
ForceSimulator
removeItem in interface ForceSimulatoritem - the ForceItem to removepublic java.util.List<ForceItem> getItems()
ForceSimulator
getItems in interface ForceSimulator
public Spring addSpring(ForceItem item1,
ForceItem item2)
ForceSimulator
addSpring in interface ForceSimulatoritem1 - the first endpoint of the springitem2 - the second endpoint of the spring
public Spring addSpring(ForceItem item1,
ForceItem item2,
float length)
ForceSimulator
addSpring in interface ForceSimulatoritem1 - 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)
ForceSimulator
addSpring in interface ForceSimulatoritem1 - the first endpoint of the springitem2 - the second endpoint of the springcoeff - the spring coefficientlength - the spring length
public java.util.List<Spring> getSprings()
ForceSimulator
getSprings in interface ForceSimulatorpublic void runSimulator(long timestep)
ForceSimulator
runSimulator in interface ForceSimulatortimestep - the span of the timestep for which to run the simulatorpublic void accumulate()
ForceSimulator
accumulate in interface ForceSimulator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||