|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcs5643.rigidbody.RigidImageSimulation
public class RigidImageSimulation
CS5643: Assignment #3 "Rigid Body Contact" main class. RigidImageSimulation simulates rigid bodies derived from an image's connected nonwhite components.
| Field Summary | |
|---|---|
(package private) boolean |
drawBounds
Draws object bounds (Disk) if true. |
(package private) boolean |
drawWireframe
Draws wireframe if true, and pixel blocks if false. |
static double |
DT
Size of symplectic Euler time step (in seconds). |
(package private) javax.swing.JFrame |
frame
Main window frame. |
(package private) cs5643.rigidbody.RigidImageSimulation.FrameExporter |
frameExporter
Reference to current FrameExporter, or null if no frames being dumped. |
(package private) JellyBeanFactory |
jellyBeanFactory
Non-null reference when simulating the "Jelly Bean Factory" images. |
(package private) boolean |
largeStep
If true, instead of one step per frame, simulator takes N_STEPS_PER_FRAME. |
(package private) static int |
N_STEPS_PER_FRAME
Number of time steps per large step size. |
(package private) RigidBodySystem |
RBS
The single RigidBodySystem reference. |
(package private) boolean |
simulate
Toggle to advance simulation. |
| Constructor Summary | |
|---|---|
RigidImageSimulation(java.lang.String imageFilename,
boolean processCollisions)
Main constructor. |
|
| Method Summary | |
|---|---|
(package private) void |
advanceTime(double dt)
|
void |
dispatchKey(char key,
java.awt.event.KeyEvent e)
Handles keyboard events, e.g., spacebar toggles simulation/pausing, and escape resets the current Task. |
void |
display(javax.media.opengl.GLAutoDrawable drawable)
Main event loop: OpenGL display + simulation advance. |
void |
displayChanged(javax.media.opengl.GLAutoDrawable drawable,
boolean modeChanged,
boolean deviceChanged)
GLEventListener implementation |
javax.vecmath.Point2d |
getPoint2d(java.awt.event.MouseEvent e)
Maps mouse event into computational cell using OrthoMap. |
void |
init(javax.media.opengl.GLAutoDrawable drawable)
GLEventListener implementation: Initializes JOGL renderer. |
static void |
main(java.lang.String[] args)
### Runs the RigidImageSimulation. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
reshape(javax.media.opengl.GLAutoDrawable drawable,
int x,
int y,
int width,
int height)
GLEventListener implementation |
(package private) void |
simulateAndDisplayScene(javax.media.opengl.GL gl)
Simulate then display particle system and any builder adornments. |
void |
start()
Builds and shows window, and starts simulator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
cs5643.rigidbody.RigidImageSimulation.FrameExporter frameExporter
static int N_STEPS_PER_FRAME
public static double DT
javax.swing.JFrame frame
RigidBodySystem RBS
boolean simulate
boolean drawWireframe
boolean drawBounds
boolean largeStep
JellyBeanFactory jellyBeanFactory
| Constructor Detail |
|---|
RigidImageSimulation(java.lang.String imageFilename,
boolean processCollisions)
throws java.io.IOException
imageFilename - Image to simulate.processCollisions - Enables collisions if true.
java.io.IOException| Method Detail |
|---|
public void start()
public javax.vecmath.Point2d getPoint2d(java.awt.event.MouseEvent e)
public void init(javax.media.opengl.GLAutoDrawable drawable)
init in interface javax.media.opengl.GLEventListener
public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
boolean modeChanged,
boolean deviceChanged)
displayChanged in interface javax.media.opengl.GLEventListener
public void reshape(javax.media.opengl.GLAutoDrawable drawable,
int x,
int y,
int width,
int height)
reshape in interface javax.media.opengl.GLEventListenerpublic void display(javax.media.opengl.GLAutoDrawable drawable)
display in interface javax.media.opengl.GLEventListenervoid simulateAndDisplayScene(javax.media.opengl.GL gl)
void advanceTime(double dt)
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListener
public void dispatchKey(char key,
java.awt.event.KeyEvent e)
public static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||