JSci.physics
Class RigidBody3D

java.lang.Object
  extended by JSci.physics.Particle
      extended by JSci.physics.AbstractClassicalParticle
          extended by JSci.physics.ClassicalParticle3D
              extended by JSci.physics.RigidBody3D
All Implemented Interfaces:
java.io.Serializable

public class RigidBody3D
extends ClassicalParticle3D

The RigidBody3D class provides an object for encapsulating rigid bodies that live in 3D.

See Also:
Serialized Form

Field Summary
protected  double angMass
          Moment of inertia.
protected  double angx
          Angles (orientation).
protected  double angxVel
          Angular velocity.
protected  double angy
          Angles (orientation).
protected  double angyVel
          Angular velocity.
protected  double angz
          Angles (orientation).
protected  double angzVel
          Angular velocity.
 
Fields inherited from class JSci.physics.ClassicalParticle3D
mass, vx, vy, vz, x, y, z
 
Constructor Summary
RigidBody3D()
          Constructs a rigid body.
 
Method Summary
 RigidBody3D angularAccelerate(double ax, double ay, double az, double dt)
          Accelerates this particle.
 RigidBody3D applyForce(double fx, double fy, double fz, double x, double y, double z, double dt)
          Applies a force acting at a point away from the centre of mass.
 RigidBody3D applyTorque(double tx, double ty, double tz, double dt)
          Applies a torque to this particle.
 double energy()
          Returns the kinetic and rotational energy.
 double getMomentOfInertia()
          Returns the moment of inertia.
 double getXAngle()
          Returns the x-axis angle of this body.
 double getXAngularMomentum()
           
 double getXAngularVelocity()
           
 double getYAngle()
          Returns the y-axis angle of this body.
 double getYAngularMomentum()
           
 double getYAngularVelocity()
           
 double getZAngle()
          Returns the z-axis angle of this body.
 double getZAngularMomentum()
           
 double getZAngularVelocity()
           
 ClassicalParticle3D move(double dt)
          Evolves this particle forward according to its kinematics.
 RigidBody3D rotate(double dt)
          Evolves this particle forward according to its rotational kinematics.
 void setAngles(double angleX, double angleY, double angleZ)
          Sets the angles (orientation) of this body.
 void setAngularMomentum(double angleXMom, double angleYMom, double angleZMom)
           
 void setAngularVelocity(double angleXVel, double angleYVel, double angleZVel)
           
 void setMomentOfInertia(double MoI)
          Sets the moment of inertia.
 
Methods inherited from class JSci.physics.ClassicalParticle3D
accelerate, applyForce, getMass, getMomentum, getPosition, getVelocity, getXMomentum, getXPosition, getXVelocity, getYMomentum, getYPosition, getYVelocity, getZMomentum, getZPosition, getZVelocity, gravitate, setMass, setMomentum, setPosition, setVelocity, setXPosition, setYPosition, setZPosition, speed, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

angMass

protected double angMass
Moment of inertia.


angx

protected double angx
Angles (orientation).


angy

protected double angy
Angles (orientation).


angz

protected double angz
Angles (orientation).


angxVel

protected double angxVel
Angular velocity.


angyVel

protected double angyVel
Angular velocity.


angzVel

protected double angzVel
Angular velocity.

Constructor Detail

RigidBody3D

public RigidBody3D()
Constructs a rigid body.

Method Detail

setMomentOfInertia

public void setMomentOfInertia(double MoI)
Sets the moment of inertia.


getMomentOfInertia

public double getMomentOfInertia()
Returns the moment of inertia.


setAngles

public void setAngles(double angleX,
                      double angleY,
                      double angleZ)
Sets the angles (orientation) of this body.

Parameters:
angleX - an angle in radians.
angleY - an angle in radians.
angleZ - an angle in radians.

getXAngle

public double getXAngle()
Returns the x-axis angle of this body.

Returns:
an angle in radians.

getYAngle

public double getYAngle()
Returns the y-axis angle of this body.

Returns:
an angle in radians.

getZAngle

public double getZAngle()
Returns the z-axis angle of this body.

Returns:
an angle in radians.

setAngularVelocity

public void setAngularVelocity(double angleXVel,
                               double angleYVel,
                               double angleZVel)

getXAngularVelocity

public double getXAngularVelocity()

getYAngularVelocity

public double getYAngularVelocity()

getZAngularVelocity

public double getZAngularVelocity()

setAngularMomentum

public void setAngularMomentum(double angleXMom,
                               double angleYMom,
                               double angleZMom)

getXAngularMomentum

public double getXAngularMomentum()

getYAngularMomentum

public double getYAngularMomentum()

getZAngularMomentum

public double getZAngularMomentum()

energy

public double energy()
Returns the kinetic and rotational energy.

Overrides:
energy in class ClassicalParticle3D

move

public ClassicalParticle3D move(double dt)
Evolves this particle forward according to its kinematics. This method changes the particle's position and orientation.

Overrides:
move in class ClassicalParticle3D
Returns:
this.

rotate

public RigidBody3D rotate(double dt)
Evolves this particle forward according to its rotational kinematics. This method changes the particle's orientation.

Returns:
this.

angularAccelerate

public RigidBody3D angularAccelerate(double ax,
                                     double ay,
                                     double az,
                                     double dt)
Accelerates this particle. This method changes the particle's angular velocity. It is additive, that is angularAccelerate(a1, dt).angularAccelerate(a2, dt) is equivalent to angularAccelerate(a1+a2, dt).

Returns:
this.

applyTorque

public RigidBody3D applyTorque(double tx,
                               double ty,
                               double tz,
                               double dt)
Applies a torque to this particle. This method changes the particle's angular velocity. It is additive, that is applyTorque(T1, dt).applyTorque(T2, dt) is equivalent to applyTorque(T1+T2, dt).

Returns:
this.

applyForce

public RigidBody3D applyForce(double fx,
                              double fy,
                              double fz,
                              double x,
                              double y,
                              double z,
                              double dt)
Applies a force acting at a point away from the centre of mass. Any resultant torques are also applied. This method changes the particle's angular velocity.

Parameters:
x - x-coordinate from centre of mass.
y - y-coordinate from centre of mass.
z - z-coordinate from centre of mass.
Returns:
this.