org.vizzini.math
Class DynamicState

java.lang.Object
  extended by org.vizzini.math.DynamicState
All Implemented Interfaces:
Serializable, Cloneable, IDynamicState, IState

public final class DynamicState
extends Object
implements IDynamicState

Provides dynamic state of an object. The orientation and position relate object coordinates to world coordinates. Units should be consistent: mass, length, time. Typically acelerations are the only inputs, both for position and orientation, using the addXAcceleration() methods.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
DynamicState()
           
 
Method Summary
 void addAcceleration(Vector acceleration)
          Add a positional acceleration.
 void addAngularAcceleration(Quaternion acceleration)
          Add an angular acceleration.
 void addMassAcceleration(double massAcceleration)
          Add a mass velocity rate of change.
 void applyForce(Vector force)
          Apply the given force through the center of mass to this object.
 void applyForce(Vector force, Vector position)
          Apply the given force at the given position to this object.
 void applyForceLocal(Vector force, Vector position)
          Apply the given force at the given position to this object where these vectors are expressed in local coordinates.
protected  void applyTorque(Vector force, Vector position)
          Apply the given torque to this object where these vectors are expressed in local coordinates.
 Object clone()
          Return a clone of this instance.
 Vector convertLocalToWorld(Vector v)
          Convert the given vector from local coordinates to world coordinates.
 Vector convertWorldToLocal(Vector v)
          Convert the given vector from world coordinates to local coordinates.
 Vector getAcceleration()
          Return the acceleration in length time^-2 units.
 Quaternion getAngularAcceleration()
          Return the angular acceleration in radians time^-2 units.
 Quaternion getAngularVelocity()
          Return the angular velocity in radians time^-1 units.
 double getMass()
          Return the mass in mass units.
 double getMassAcceleration()
          Return the mass velocity rate of change in mass time^-2 units.
 double getMassVelocity()
          Return the mass rate of change in mass time^-1 units.
 double[] getMomentOfInertia()
          Return the moment of inertia in mass length^2 units.
 Quaternion getOrientation()
          Return the orientation quaternion.
 Vector getPosition()
          Return the position vector.
 Vector getPreviousPosition()
          Return the previous position vector.
 Vector getVelocity()
          Return the velocity in length time^-1 units.
 void move(Vector movement)
          Move using the given vector.
 Vector orientLocalToWorld(Vector v)
          Orient the given vector from local coordinates to world coordinates.
 Vector orientWorldToLocal(Vector v)
          Orient the given vector from world coordinates to local coordinates.
 void rotate(Quaternion rotation)
          Rotate using the given quaternion.
 void setAcceleration(Vector acceleration)
          Set the acceleration.
 void setAngularAcceleration(Quaternion angularAcceleration)
          Set the angular acceleration.
 void setAngularVelocity(Quaternion angularVelocity)
          Set the angular velocity.
 void setMass(double mass)
          Set the mass.
 void setMassAcceleration(double massAcceleration)
          Set the mass velocity rate of change.
 void setMassVelocity(double massVelocity)
          Set the mass rate of change.
 void setMomentOfInertia(double[] momentOfInertia)
          Set the moment of inertia.
 void setOrientation(Quaternion orientation)
          Set the orientation.
 void setPosition(Vector position)
          Set the position.
 void setVelocity(Vector velocity)
          Set the velocity.
 String toString()
          Return a string representation of this object.
 void zeroAcceleration()
          Zero the acceleration.
 void zeroAngularAcceleration()
          Zero the angular acceleration.
 void zeroAngularMotion()
          Zero all angular motion.
 void zeroMassAcceleration()
          Zero the mass acceleration.
 void zeroMotion()
          Zero all motion.
 void zeroTranslationalMotion()
          Zero all translational motion.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicState

public DynamicState()
Method Detail

addAcceleration

public void addAcceleration(Vector acceleration)
Add a positional acceleration.

Specified by:
addAcceleration in interface IDynamicState
Parameters:
acceleration - Acceleration vector in length time^-2 units.
Since:
v0.2

addAngularAcceleration

public void addAngularAcceleration(Quaternion acceleration)
Add an angular acceleration.

Specified by:
addAngularAcceleration in interface IDynamicState
Parameters:
acceleration - Angular acceleration in radians time^-2 units.
Since:
v0.2

addMassAcceleration

public void addMassAcceleration(double massAcceleration)
Add a mass velocity rate of change.

Specified by:
addMassAcceleration in interface IDynamicState
Parameters:
massAcceleration - in mass time^-2 units.
Since:
v0.3

applyForce

public void applyForce(Vector force)
Apply the given force through the center of mass to this object.

Specified by:
applyForce in interface IDynamicState
Parameters:
force - Force vector in world coordinates in mass length time^-2 units.
Since:
v0.2

applyForce

public void applyForce(Vector force,
                       Vector position)
Apply the given force at the given position to this object.

Specified by:
applyForce in interface IDynamicState
Parameters:
force - Force vector in world coordinates in mass length time^-2 units.
position - Position of applied force relative to the center of mass in world coordinates in length units.
Since:
v0.2

applyForceLocal

public void applyForceLocal(Vector force,
                            Vector position)
Apply the given force at the given position to this object where these vectors are expressed in local coordinates.

Specified by:
applyForceLocal in interface IDynamicState
Parameters:
force - Force vector in local coordinates in mass length time^-2 units.
position - Position of applied force relative to the center of mass in local coordinates in length units.
Since:
v0.2

clone

public Object clone()
Return a clone of this instance.

Specified by:
clone in interface IState
Overrides:
clone in class Object
Since:
v0.2

convertLocalToWorld

public Vector convertLocalToWorld(Vector v)
Convert the given vector from local coordinates to world coordinates.

Specified by:
convertLocalToWorld in interface IState
Parameters:
v - Vector in local coordinates.
Since:
v0.2

convertWorldToLocal

public Vector convertWorldToLocal(Vector v)
Convert the given vector from world coordinates to local coordinates.

Specified by:
convertWorldToLocal in interface IState
Parameters:
v - Vector in local coordinates.
Since:
v0.2

getAcceleration

public Vector getAcceleration()
Return the acceleration in length time^-2 units.

Specified by:
getAcceleration in interface IDynamicState
Since:
v0.2

getAngularAcceleration

public Quaternion getAngularAcceleration()
Return the angular acceleration in radians time^-2 units.

Specified by:
getAngularAcceleration in interface IDynamicState
Since:
v0.2

getAngularVelocity

public Quaternion getAngularVelocity()
Return the angular velocity in radians time^-1 units.

Specified by:
getAngularVelocity in interface IDynamicState
Since:
v0.2

getMass

public double getMass()
Return the mass in mass units.

Specified by:
getMass in interface IDynamicState
Since:
v0.2

getMassAcceleration

public double getMassAcceleration()
Return the mass velocity rate of change in mass time^-2 units.

Specified by:
getMassAcceleration in interface IDynamicState
Since:
v0.3

getMassVelocity

public double getMassVelocity()
Return the mass rate of change in mass time^-1 units.

Specified by:
getMassVelocity in interface IDynamicState
Since:
v0.2

getMomentOfInertia

public double[] getMomentOfInertia()
Return the moment of inertia in mass length^2 units. The array contains values for width, height, and depth.

Specified by:
getMomentOfInertia in interface IDynamicState
Since:
v0.2

getOrientation

public Quaternion getOrientation()
Return the orientation quaternion.

Specified by:
getOrientation in interface IState
Since:
v0.2

getPosition

public Vector getPosition()
Return the position vector.

Specified by:
getPosition in interface IState
Since:
v0.2

getPreviousPosition

public Vector getPreviousPosition()
Return the previous position vector.

Specified by:
getPreviousPosition in interface IState
Since:
v0.2

getVelocity

public Vector getVelocity()
Return the velocity in length time^-1 units.

Specified by:
getVelocity in interface IDynamicState
Since:
v0.2

move

public void move(Vector movement)
Move using the given vector.

Specified by:
move in interface IState
Since:
v0.2

orientLocalToWorld

public Vector orientLocalToWorld(Vector v)
Orient the given vector from local coordinates to world coordinates.

Specified by:
orientLocalToWorld in interface IState
Parameters:
v - Vector in local coordinates.
Since:
v0.2

orientWorldToLocal

public Vector orientWorldToLocal(Vector v)
Orient the given vector from world coordinates to local coordinates.

Specified by:
orientWorldToLocal in interface IState
Parameters:
v - Vector in world coordinates.
Since:
v0.2

rotate

public void rotate(Quaternion rotation)
Rotate using the given quaternion.

Specified by:
rotate in interface IState
Since:
v0.2

setAcceleration

public void setAcceleration(Vector acceleration)
Set the acceleration.

Specified by:
setAcceleration in interface IDynamicState
Parameters:
acceleration - Acceleration vector in length time^-2 units.
Since:
v0.2

setAngularAcceleration

public void setAngularAcceleration(Quaternion angularAcceleration)
Set the angular acceleration.

Specified by:
setAngularAcceleration in interface IDynamicState
Parameters:
angularAcceleration - Angular acceleration in radians time^-2 units.
Since:
v0.2

setAngularVelocity

public void setAngularVelocity(Quaternion angularVelocity)
Set the angular velocity.

Specified by:
setAngularVelocity in interface IDynamicState
Parameters:
angularVelocity - Angular velocity in radians time^-1 units.
Since:
v0.2

setMass

public void setMass(double mass)
Set the mass.

Specified by:
setMass in interface IDynamicState
Parameters:
mass - Mass in mass units.
Since:
v0.2

setMassAcceleration

public void setMassAcceleration(double massAcceleration)
Set the mass velocity rate of change.

Specified by:
setMassAcceleration in interface IDynamicState
Parameters:
massAcceleration - Mass velocity rate of change in mass time^-2 units.
Since:
v0.3

setMassVelocity

public void setMassVelocity(double massVelocity)
Set the mass rate of change.

Specified by:
setMassVelocity in interface IDynamicState
Parameters:
massVelocity - Mass rate of change in mass time^-1 units.
Since:
v0.2

setMomentOfInertia

public void setMomentOfInertia(double[] momentOfInertia)
Set the moment of inertia. The array should contain values for width, height, and depth.

Specified by:
setMomentOfInertia in interface IDynamicState
Parameters:
momentOfInertia - Moment of intertia in mass length^2 units.
Since:
v0.2

setOrientation

public void setOrientation(Quaternion orientation)
Set the orientation.

Specified by:
setOrientation in interface IState
Since:
v0.2

setPosition

public void setPosition(Vector position)
Set the position.

Specified by:
setPosition in interface IState
Since:
v0.2

setVelocity

public void setVelocity(Vector velocity)
Set the velocity.

Specified by:
setVelocity in interface IDynamicState
Parameters:
velocity - Velocity vector in length time^-1 units.
Since:
v0.2

toString

public String toString()
Return a string representation of this object.

Specified by:
toString in interface IDynamicState
Overrides:
toString in class Object
Since:
v0.2

zeroAcceleration

public void zeroAcceleration()
Zero the acceleration.

Specified by:
zeroAcceleration in interface IDynamicState
Since:
v0.3

zeroAngularAcceleration

public void zeroAngularAcceleration()
Zero the angular acceleration.

Specified by:
zeroAngularAcceleration in interface IDynamicState
Since:
v0.3

zeroAngularMotion

public void zeroAngularMotion()
Zero all angular motion.

Specified by:
zeroAngularMotion in interface IDynamicState
Since:
v0.2

zeroMassAcceleration

public void zeroMassAcceleration()
Zero the mass acceleration.

Specified by:
zeroMassAcceleration in interface IDynamicState
Since:
v0.3

zeroMotion

public void zeroMotion()
Zero all motion.

Specified by:
zeroMotion in interface IDynamicState
Since:
v0.2

zeroTranslationalMotion

public void zeroTranslationalMotion()
Zero all translational motion.

Specified by:
zeroTranslationalMotion in interface IDynamicState
Since:
v0.2

applyTorque

protected void applyTorque(Vector force,
                           Vector position)
Apply the given torque to this object where these vectors are expressed in local coordinates.

Parameters:
force - Force vector in local coordinates in mass length time^-2 units.
position - Position of applied force relative to the center of mass in local coordinates in length units.
Since:
v0.2


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02