animator3D
Class Animator3D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--animator3D.Animator3D

public class Animator3D
extends java.applet.Applet

See Also:
Serialized Form

Field Summary
 XyzFrame frame
           
 java.awt.Rectangle frameRectangle
           
 animator3D.RotatedCanvas rotatedCanvas
           
 animator3D.XyzWorld world
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Animator3D()
           
 
Method Summary
 animator3D.Shape addArrow(double x, double y, double z, double dx, double dy, double dz)
          Add a new arrow to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size
 animator3D.Shape addBox(double x, double y, double z, double dx, double dy, double dz)
          Add a new cube to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size
 animator3D.Bounds addContainer(double x, double y, double z, double dx, double dy, double dz)
          Add a new container to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size
 animator3D.Shape addLine(double x, double y, double z, double dx, double dy, double dz)
          Add a new line to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size
 animator3D.Particle addParticle(double x, double y, double z, double mass, double charge, int fixed)
          Add particle with given position, mass and charge fixed = 1..
 animator3D.Shape addSphere(double x, double y, double z, double radius)
          Add a new cube to the world
values x, y, z,define its relative postion
value radius defines its size
 animator3D.Spring addSpring(animator3D.Particle p1, animator3D.Particle p2)
          connect particles p1 and p2 with spring.
 void clearExperiment()
          Clear the experiment.
 void forward()
          Resume the simulation run.
 int getNumParticles()
          Return the number of the particles in the world.
 int getNumShapes()
          Return number of the shapes in the world.
 int getNumSprings()
          Return number of the springs in the world.
 animator3D.Particle getParticle(int i)
          Get reference to the ith particle
 double getParticleCharge(animator3D.Particle p)
          Get charge of referenced particle
 animator3D.Particle getParticleCollided(animator3D.Particle p)
          Get collision status of referenced particle.
 double getParticleMass(animator3D.Particle p)
          Get mass of referenced particle
 double getParticlePositionX(animator3D.Particle p)
          Get position x of referenced particle
 double getParticlePositionY(animator3D.Particle p)
          Get position y of referenced particle
 double getParticlePositionZ(animator3D.Particle p)
          Get position z of referenced particle
 int getParticleStatus(animator3D.Particle p)
          Get user defined status of referenced particle.
 double getParticleVelocityX(animator3D.Particle p)
          Get velocity x of referenced particle
 double getParticleVelocityY(animator3D.Particle p)
          Get velocity y of referenced particle
 double getParticleVelocityZ(animator3D.Particle p)
          Get velocity z of referenced particle
 double getSpringLength(animator3D.Spring s)
          Get spring length of referenced spring
 void init()
           
 void pause()
          Temporarily stop (pause) the simulation run.
 void removeParticle(animator3D.Particle p)
          Remove the referenced particle
 void setArrowBounds(animator3D.Shape sh, double x, double y, double z, double dx, double dy, double dz)
          Set the bounds of the referenced arow
values x, y, z,define its relative postion
values dx, dy, dz define its size
 void setArrowColor(animator3D.Shape sh, int r, int g, int b)
          Set the color of the referenced arrow.
 void setAxesVisible(boolean visible)
          Show or hide the axes of coordinate system.
 void setBoxBounds(animator3D.Shape sh, double x, double y, double z, double dx, double dy, double dz)
          Set the position and size of referenced box.
 void setBoxColor(animator3D.Shape sh, int r, int g, int b)
          Set the color of the referenced box.
 void setCollisions(boolean c)
          Set collision of between particles.
 void setContainerBounds(animator3D.Bounds b, double x, double y, double z, double dx, double dy, double dz)
          Change the bounds of the referenced container
values x, y, z,define its relative postion
values dx, dy, dz define its size
 void setContainerColor(animator3D.Bounds bd, int r, int g, int b)
          Set the color of the referenced container.
 void setCoulombConst(double c)
          /** Set Coulomb constant force between particles to c
 void setDt(double dt)
          Set the time increment (time step) simulation
 void setEfieldVisible(boolean visible)
          Show or hide the electrical field lines.
 void setExternalField(double ex, double ey, double ez)
          Set external electric field to ex,ey, ez values.
 void setExternalGravity(double g)
          Set external gravity to g.
 void setFatLines(boolean fat)
          Use fat lines for a better visualisation of the experiment.
 void setForcesEnabled(boolean enabled)
          Enable or disable computation of forces.
 void setFPS(double fps)
          Set the "Frames per second" (inverse of sleep time)
Example: fps = 10 means sleep time 1/10 = 100 msec)
 void setFrameVisible(boolean visible)
          Show or hide the frame with the simulated world
 void setLineBounds(animator3D.Shape sh, double x, double y, double z, double dx, double dy, double dz)
          Set the bounds of the referenced line
values x, y, z,define its relative postion
values dx, dy, dz define its size
 void setLineColor(animator3D.Shape sh, int r, int g, int b)
          Set the color of the referenced line.
 void setParticleCharge(animator3D.Particle p, double charge)
          Set charge to referenced particle
 void setParticleColor(animator3D.Particle p, int r, int g, int b)
          Set particle color to referenced particle
 void setParticleContainer(animator3D.Particle p, animator3D.Bounds b)
          Set container to referenced particle.
 void setParticleFixed(animator3D.Particle p, boolean f)
          Release or fix (set to true) the referenced particle.
 void setParticleMass(animator3D.Particle p, double mass)
          Set mass to referenced particle
 void setParticlePosition(animator3D.Particle p, double x, double y, double z)
          Set position of referenced particle
 void setParticleSize(animator3D.Particle p, double s)
          Set particle size to referenced particle
 void setParticleStatus(animator3D.Particle p, int s)
          /** Set user defined status to referenced particle.
 void setParticleTraced(animator3D.Particle p, boolean t)
          /** set traceMode for referenced particle.
 void setParticleVelocity(animator3D.Particle p, double vx, double vy, double vz)
          Set velocity of referenced particle.
 void setPotential(double pot)
          Set potential for observed equipotential surface.
 void setPotSurfaceVisible(boolean visible)
          Show or hide the equipotential surface.
 void setScaleAVector(double s)
          Set scalling factor for visualised accelerations (default 1.0).
 void setScaleFVector(double s)
          Set scalling factor for visualised forces (default 1.0).
 void setScaleVVector(double s)
          Set scalling factor for visualised velocities (default 1.0).
 void setShowAVector(animator3D.Particle p, boolean visible)
          Show or hide the acceleration vector of referenced particle.
 void setShowFVector(animator3D.Particle p, boolean visible)
          Show or hide the force vector of referenced particle.
 void setShowVVector(animator3D.Particle p, boolean visible)
          Show or hide the velocity vector of referenced particle.
 void setSphereBounds(animator3D.Shape sh, double x, double y, double z, double radius)
          Set the position and size of referenced sphere.
 void setSphereColor(animator3D.Shape sh, int r, int g, int b)
          Set the color of the referenced sphere.
 void setSpringConstant(animator3D.Spring s, double c)
          Set spring constant to referenced spring
 void setSpringLength(animator3D.Spring s, double c)
          Set spring length to referenced spring
 void setSpringsEnabled(boolean enabled)
          Enable or disable springs.
 void setSpringsVisible(boolean visible)
          Show or hide springs.
 void setTraceSize(int n)
          Set number of traced points to n.
Warning: too big n will slow down the simulation.
 void setViewPlane(int i)
          set ViewPlane to i:
i = 1..
 void setViewpoint(double x_angle, double y_angle, double z_angle, double factor)
          Define viewpoint angles and distance.
 void setViscosityFactor(double v)
          Set viscosity factor for the world with particles.
 void stepForward()
          Do a single simulation step
 void stop()
           
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

world

public animator3D.XyzWorld world

frame

public XyzFrame frame

rotatedCanvas

public animator3D.RotatedCanvas rotatedCanvas

frameRectangle

public java.awt.Rectangle frameRectangle
Constructor Detail

Animator3D

public Animator3D()
Method Detail

init

public void init()
Overrides:
init in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

addParticle

public animator3D.Particle addParticle(double x,
                                       double y,
                                       double z,
                                       double mass,
                                       double charge,
                                       int fixed)
Add particle with given position, mass and charge

fixed = 1.. particle fixed, 0.. particle free


getParticle

public animator3D.Particle getParticle(int i)
Get reference to the ith particle

removeParticle

public void removeParticle(animator3D.Particle p)
Remove the referenced particle

getParticlePositionX

public double getParticlePositionX(animator3D.Particle p)
Get position x of referenced particle

getParticlePositionY

public double getParticlePositionY(animator3D.Particle p)
Get position y of referenced particle

getParticlePositionZ

public double getParticlePositionZ(animator3D.Particle p)
Get position z of referenced particle

getParticleVelocityX

public double getParticleVelocityX(animator3D.Particle p)
Get velocity x of referenced particle

getParticleVelocityY

public double getParticleVelocityY(animator3D.Particle p)
Get velocity y of referenced particle

getParticleVelocityZ

public double getParticleVelocityZ(animator3D.Particle p)
Get velocity z of referenced particle

setParticlePosition

public void setParticlePosition(animator3D.Particle p,
                                double x,
                                double y,
                                double z)
Set position of referenced particle

setParticleVelocity

public void setParticleVelocity(animator3D.Particle p,
                                double vx,
                                double vy,
                                double vz)
Set velocity of referenced particle.
The velocity is determined by its components vx, vy and vz.

setParticleFixed

public void setParticleFixed(animator3D.Particle p,
                             boolean f)
Release or fix (set to true) the referenced particle.

getParticleCollided

public animator3D.Particle getParticleCollided(animator3D.Particle p)
Get collision status of referenced particle. Returns reference to the particle that collided with the ith particle

getParticleStatus

public int getParticleStatus(animator3D.Particle p)
Get user defined status of referenced particle.

setParticleStatus

public void setParticleStatus(animator3D.Particle p,
                              int s)
/** Set user defined status to referenced particle.

getParticleMass

public double getParticleMass(animator3D.Particle p)
Get mass of referenced particle

setParticleMass

public void setParticleMass(animator3D.Particle p,
                            double mass)
Set mass to referenced particle

getParticleCharge

public double getParticleCharge(animator3D.Particle p)
Get charge of referenced particle

setParticleCharge

public void setParticleCharge(animator3D.Particle p,
                              double charge)
Set charge to referenced particle

setParticleSize

public void setParticleSize(animator3D.Particle p,
                            double s)
Set particle size to referenced particle

setParticleTraced

public void setParticleTraced(animator3D.Particle p,
                              boolean t)
/** set traceMode for referenced particle.
If true, the history of its movement will be traced.

setParticleColor

public void setParticleColor(animator3D.Particle p,
                             int r,
                             int g,
                             int b)
Set particle color to referenced particle

setShowFVector

public void setShowFVector(animator3D.Particle p,
                           boolean visible)
Show or hide the force vector of referenced particle.

setShowVVector

public void setShowVVector(animator3D.Particle p,
                           boolean visible)
Show or hide the velocity vector of referenced particle.

setShowAVector

public void setShowAVector(animator3D.Particle p,
                           boolean visible)
Show or hide the acceleration vector of referenced particle.

setParticleContainer

public void setParticleContainer(animator3D.Particle p,
                                 animator3D.Bounds b)
Set container to referenced particle.

getNumParticles

public int getNumParticles()
Return the number of the particles in the world.

getNumSprings

public int getNumSprings()
Return number of the springs in the world.

getNumShapes

public int getNumShapes()
Return number of the shapes in the world.

addSpring

public animator3D.Spring addSpring(animator3D.Particle p1,
                                   animator3D.Particle p2)
connect particles p1 and p2 with spring.

setSpringConstant

public void setSpringConstant(animator3D.Spring s,
                              double c)
Set spring constant to referenced spring

getSpringLength

public double getSpringLength(animator3D.Spring s)
Get spring length of referenced spring

setSpringLength

public void setSpringLength(animator3D.Spring s,
                            double c)
Set spring length to referenced spring

addBox

public animator3D.Shape addBox(double x,
                               double y,
                               double z,
                               double dx,
                               double dy,
                               double dz)
Add a new cube to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size

setBoxBounds

public void setBoxBounds(animator3D.Shape sh,
                         double x,
                         double y,
                         double z,
                         double dx,
                         double dy,
                         double dz)
Set the position and size of referenced box.
values x, y, z,define its relative postion
values dx, dy, dz define its size

setBoxColor

public void setBoxColor(animator3D.Shape sh,
                        int r,
                        int g,
                        int b)
Set the color of the referenced box.

addSphere

public animator3D.Shape addSphere(double x,
                                  double y,
                                  double z,
                                  double radius)
Add a new cube to the world
values x, y, z,define its relative postion
value radius defines its size

setSphereBounds

public void setSphereBounds(animator3D.Shape sh,
                            double x,
                            double y,
                            double z,
                            double radius)
Set the position and size of referenced sphere.
values x, y, z,define its relative postion
value radius defines its size

setSphereColor

public void setSphereColor(animator3D.Shape sh,
                           int r,
                           int g,
                           int b)
Set the color of the referenced sphere.

addLine

public animator3D.Shape addLine(double x,
                                double y,
                                double z,
                                double dx,
                                double dy,
                                double dz)
Add a new line to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size

setLineBounds

public void setLineBounds(animator3D.Shape sh,
                          double x,
                          double y,
                          double z,
                          double dx,
                          double dy,
                          double dz)
Set the bounds of the referenced line
values x, y, z,define its relative postion
values dx, dy, dz define its size

setLineColor

public void setLineColor(animator3D.Shape sh,
                         int r,
                         int g,
                         int b)
Set the color of the referenced line.

addArrow

public animator3D.Shape addArrow(double x,
                                 double y,
                                 double z,
                                 double dx,
                                 double dy,
                                 double dz)
Add a new arrow to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size

setArrowBounds

public void setArrowBounds(animator3D.Shape sh,
                           double x,
                           double y,
                           double z,
                           double dx,
                           double dy,
                           double dz)
Set the bounds of the referenced arow
values x, y, z,define its relative postion
values dx, dy, dz define its size

setArrowColor

public void setArrowColor(animator3D.Shape sh,
                          int r,
                          int g,
                          int b)
Set the color of the referenced arrow.

addContainer

public animator3D.Bounds addContainer(double x,
                                      double y,
                                      double z,
                                      double dx,
                                      double dy,
                                      double dz)
Add a new container to the world
values x, y, z,define its relative postion
values dx, dy, dz define its size

setContainerColor

public void setContainerColor(animator3D.Bounds bd,
                              int r,
                              int g,
                              int b)
Set the color of the referenced container.

setContainerBounds

public void setContainerBounds(animator3D.Bounds b,
                               double x,
                               double y,
                               double z,
                               double dx,
                               double dy,
                               double dz)
Change the bounds of the referenced container
values x, y, z,define its relative postion
values dx, dy, dz define its size

clearExperiment

public void clearExperiment()
Clear the experiment.

setCollisions

public void setCollisions(boolean c)
Set collision of between particles.

setAxesVisible

public void setAxesVisible(boolean visible)
Show or hide the axes of coordinate system.

setFatLines

public void setFatLines(boolean fat)
Use fat lines for a better visualisation of the experiment.

setViewpoint

public void setViewpoint(double x_angle,
                         double y_angle,
                         double z_angle,
                         double factor)
Define viewpoint angles and distance.
the angles are angles around the axes
the factor is inverse to the distance, default 300

setViewPlane

public void setViewPlane(int i)
set ViewPlane to i:
i = 1.. xy plane
i = 2.. xz plane
i = 3.. yz plane

setExternalGravity

public void setExternalGravity(double g)
Set external gravity to g.

setCoulombConst

public void setCoulombConst(double c)
/** Set Coulomb constant force between particles to c

setScaleVVector

public void setScaleVVector(double s)
Set scalling factor for visualised velocities (default 1.0).

setScaleAVector

public void setScaleAVector(double s)
Set scalling factor for visualised accelerations (default 1.0).

setScaleFVector

public void setScaleFVector(double s)
Set scalling factor for visualised forces (default 1.0).

setTraceSize

public void setTraceSize(int n)
Set number of traced points to n.
Warning: too big n will slow down the simulation.

setExternalField

public void setExternalField(double ex,
                             double ey,
                             double ez)
Set external electric field to ex,ey, ez values.

setFrameVisible

public void setFrameVisible(boolean visible)
Show or hide the frame with the simulated world

setEfieldVisible

public void setEfieldVisible(boolean visible)
Show or hide the electrical field lines.

setPotSurfaceVisible

public void setPotSurfaceVisible(boolean visible)
Show or hide the equipotential surface.

setPotential

public void setPotential(double pot)
Set potential for observed equipotential surface.

setViscosityFactor

public void setViscosityFactor(double v)
Set viscosity factor for the world with particles.
value 1.0 means no viscosity.
Value "0< v <1" decreases the velocities of the particles.

setSpringsVisible

public void setSpringsVisible(boolean visible)
Show or hide springs.

setSpringsEnabled

public void setSpringsEnabled(boolean enabled)
Enable or disable springs.

setForcesEnabled

public void setForcesEnabled(boolean enabled)
Enable or disable computation of forces.
(In some experiments this computation is not needed and can be avoided).

setDt

public void setDt(double dt)
Set the time increment (time step) simulation

setFPS

public void setFPS(double fps)
Set the "Frames per second" (inverse of sleep time)
Example: fps = 10 means sleep time 1/10 = 100 msec)

pause

public void pause()
Temporarily stop (pause) the simulation run.
See also forward()

forward

public void forward()
Resume the simulation run.
See also pause()

stepForward

public void stepForward()
Do a single simulation step