prefuse.util.force
Interface ForceSimulator

All Known Implementing Classes:
ForceSimulatorImpl

public interface ForceSimulator

Author:
Anton Marsden

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

Method Detail

getSpeedLimit

float getSpeedLimit()
Get the speed limit, or maximum velocity value allowed by this simulator.

Returns:
the "speed limit" maximum velocity value

clear

void clear()
Clear this simulator, removing all ForceItem and Spring instances for the simulator.


addForce

void addForce(Force f)
Add a new Force function to the simulator.

Parameters:
f - the Force function to add

getForces

Force[] getForces()
Get an array of all the Force functions used in this simulator.

Returns:
an array of Force functions

addItem

void addItem(ForceItem item)
Add a ForceItem to the simulation.

Parameters:
item - the ForceItem to add

removeItem

boolean removeItem(ForceItem item)
Remove a ForceItem to the simulation.

Parameters:
item - the ForceItem to remove

getItems

java.util.List<ForceItem> getItems()
Get an iterator over all registered ForceItems.

Returns:
an iterator over the ForceItems.

addSpring

Spring addSpring(ForceItem item1,
                 ForceItem item2)
Add a Spring to the simulation.

Parameters:
item1 - the first endpoint of the spring
item2 - the second endpoint of the spring
Returns:
the Spring added to the simulation

addSpring

Spring addSpring(ForceItem item1,
                 ForceItem item2,
                 float length)
Add a Spring to the simulation.

Parameters:
item1 - the first endpoint of the spring
item2 - the second endpoint of the spring
length - the spring length
Returns:
the Spring added to the simulation

addSpring

Spring addSpring(ForceItem item1,
                 ForceItem item2,
                 float coeff,
                 float length)
Add a Spring to the simulation.

Parameters:
item1 - the first endpoint of the spring
item2 - the second endpoint of the spring
coeff - the spring coefficient
length - the spring length
Returns:
the Spring added to the simulation

getSprings

java.util.List<Spring> getSprings()
Get an iterator over all registered Springs.

Returns:
an iterator over the Springs.

runSimulator

void runSimulator(long timestep)
Run the simulator for one timestep.

Parameters:
timestep - the span of the timestep for which to run the simulator

accumulate

void accumulate()
Accumulate all forces acting on the items in this simulation



Copyright © 2008 Regents of the University of California