|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.j3d.threeD.raytracer.engine.Scene
net.sf.j3d.physics.Simulation
public class Simulation
| Nested Class Summary | |
|---|---|
static interface |
Simulation.Force
|
| Field Summary | |
|---|---|
static double |
G
|
| Constructor Summary | |
|---|---|
Simulation()
|
|
Simulation(int width,
int height)
|
|
Simulation(int width,
int height,
double ox,
double oy,
double scale,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l,
String outputDir)
Constructs a new Simulation object using the specified parameters. |
|
Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr)
|
|
Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l)
|
|
Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l,
String outputDir)
|
|
| Method Summary | |
|---|---|
void |
addForce(Simulation.Force f)
Adds a Force object to the set of forces that will be evaluated each iteration. |
void |
addGravity()
Adds the force of (newtonian) gravity to the simulation. |
void |
addSurface(Surface s)
Adds the specified Surface object to the surfaces stored by this Simulation object. |
Properties |
generateProperties()
|
double |
getAverageLinearVelocity()
|
Image |
getImage()
|
boolean |
getLogEachFrame()
|
boolean |
getRenderEachFrame()
|
Scene |
getScene()
|
double |
getTime()
|
void |
jitter(double t)
Moves all of the rigid bodies stored by this Simulation object by a random amount in the range [-t, t]. |
List |
loadProperties(Properties p)
|
static void |
main(String[] args)
|
void |
removeSurface(int index)
Removes the Surface object stored at the specified index from this Simulation object. |
void |
run()
Runs the simulation. |
void |
setEditPanel(RigidBodyEditPanel editPanel)
Sets edit RigidBodyEditPanel object stored by this Simulation. |
void |
setFPS(double fps)
Sets the number of frames to render per second. |
void |
setLogEachFrame(boolean log)
|
void |
setRenderEachFrame(boolean render)
|
void |
setSleepEachFrame(boolean sleep)
Sets the sleep each frame flag. |
void |
setSurfaces(Surface[] s)
Sets the surfaces stored by this Simulation object. |
void |
setVDT(double vdt)
If the value of vdt is set to anything greater than 0.0, the time interval for each iteration will be set so that it is the value of vdt divided by the average velocity of the objects in the screen. |
void |
start()
Calls the run method on this Simulation object. |
void |
writeEncodeScript(String instance)
Write a sript to be used to compose the output image to form an animation. |
void |
writeImage(int i,
String instance)
Writes the current image to a file that is labeled using the specified values. |
| Methods inherited from class net.sf.j3d.threeD.raytracer.engine.Scene |
|---|
addLight, clone, getCamera, getLight, getLights, getSurface, getSurfaces, removeLight, setCamera, setLights |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double G
| Constructor Detail |
|---|
public Simulation()
public Simulation(int width,
int height)
public Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr)
public Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l)
public Simulation(int width,
int height,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l,
String outputDir)
public Simulation(int width,
int height,
double ox,
double oy,
double scale,
RigidBody[] bodies,
double dt,
int itr,
UpdateListener l,
String outputDir)
width - Width of image produced.height - Height of image produced.ox - X coordinate of origin.oy - Y coordinate of origin.scale - Scale factor.bodies - Array containing RigidBody objects to use in simulation.dt - Time interval to use for each iteration of simulation.itr - Number of iterations to run.l - UpdateListener instance to update after each iteration (null accepted).outputDir - Path to directory to write images (null accepted).| Method Detail |
|---|
public static void main(String[] args)
public void setFPS(double fps)
fps - The number of frames per second.public void setVDT(double vdt)
public Image getImage()
public double getTime()
public Scene getScene()
public void setEditPanel(RigidBodyEditPanel editPanel)
editPanel - RigidBodyEditPanel object to use.public void setSleepEachFrame(boolean sleep)
sleep - True if the simulation thread should wait the actual time between frames,
false otherwise.public boolean getRenderEachFrame()
public void setRenderEachFrame(boolean render)
render - True if the simulation should render an image for each frame, false otherwise.public boolean getLogEachFrame()
public void setLogEachFrame(boolean log)
log - True if the simulation should output a properties file for each frame, false otherwise.public void addForce(Simulation.Force f)
f - The Force object to add.public void addGravity()
public void setSurfaces(Surface[] s)
setSurfaces in class SceneIllegalArgumentException - If any of the Surface objects in the specified array
are not instances of RigidBody.public void addSurface(Surface s)
addSurface in class SceneIllegalArgumentException - If the Surface object specified is not an instance of RigidBody.public void removeSurface(int index)
removeSurface in class Scenepublic void jitter(double t)
t - Bounds for jittering.public double getAverageLinearVelocity()
public void start()
public void run()
run in interface Runnablepublic Properties generateProperties()
public List loadProperties(Properties p)
public void writeImage(int i,
String instance)
i - The iteration number of the image.instance - The instance string for the animation.public void writeEncodeScript(String instance)
instance - The instance string for the animation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||