org.jscience.physics.kinematics
Class RigidBody2D

java.lang.Object
  extended by org.jscience.physics.Particle
      extended by org.jscience.physics.kinematics.AbstractClassicalParticle
          extended by org.jscience.physics.kinematics.ClassicalParticle2D
              extended by org.jscience.physics.kinematics.RigidBody2D
All Implemented Interfaces:
java.io.Serializable, Positioned

public class RigidBody2D
extends ClassicalParticle2D

The RigidBody2D class provides an object for encapsulating rigid bodies that live in 2D.

See Also:
Serialized Form

Constructor Summary
RigidBody2D()
          Constructs a rigid body.
 
Method Summary
 RigidBody2D angularAccelerate(double a, double dt)
          Accelerates this particle.
 RigidBody2D angularCollide(RigidBody2D p, double e)
          Collides this particle with another.
 RigidBody2D applyForce(double fx, double fy, double x, double y, double dt)
          Applies a force acting at a point away from the centre of mass.
 RigidBody2D applyForce(Force2D F, double x, double y, double t, double dt)
          DOCUMENT ME!
 RigidBody2D applyTorque(double T, double dt)
          Applies a torque to this particle.
 RigidBody2D applyTorque(Torque2D T, double t, double dt)
          DOCUMENT ME!
 RigidBody2D collide(RigidBody2D p, double theta, double e)
          Collides this particle with another.
 double energy()
          Returns the kinetic and rotational energy.
 double getAngle()
          Returns the angle (orientation) of this body.
 double getAngularMomentum()
          DOCUMENT ME!
 double getAngularVelocity()
          Returns the angular velocity.
 double getMomentOfInertia()
          Returns the moment of inertia.
 AbstractClassicalParticle move(double dt)
          Evolves this particle forward according to its kinematics.
 RigidBody2D rotate(double dt)
          Evolves this particle forward according to its rotational kinematics.
 void setAngle(double angle)
          Sets the angle (orientation) of this body.
 void setAngularMomentum(double angleMom)
          DOCUMENT ME!
 void setAngularVelocity(double angleVel)
          Sets the angular velocity.
 void setMomentOfInertia(double MoI)
          Sets the moment of inertia.
 
Methods inherited from class org.jscience.physics.kinematics.ClassicalParticle2D
accelerate, applyForce, applyForce, collide, getCharge, getDimension, getMass, getMomentum, getPosition, getVelocity, getXMomentum, getXPosition, getXVelocity, getYMomentum, getYPosition, getYVelocity, setCharge, setMass, setMomentum, setPosition, setVelocity, setXPosition, setXVelocity, setYPosition, setYVelocity, speed, translate
 
Methods inherited from class org.jscience.physics.kinematics.AbstractClassicalParticle
addForce, getForces, removeAllForces, removeForce, setForces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RigidBody2D

public RigidBody2D()
Constructs a rigid body.

Method Detail

setMomentOfInertia

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

Parameters:
MoI - DOCUMENT ME!

getMomentOfInertia

public double getMomentOfInertia()
Returns the moment of inertia.

Returns:
DOCUMENT ME!

setAngle

public void setAngle(double angle)
Sets the angle (orientation) of this body.

Parameters:
angle - an angle in radians.

getAngle

public double getAngle()
Returns the angle (orientation) of this body.

Returns:
an angle in radians.

setAngularVelocity

public void setAngularVelocity(double angleVel)
Sets the angular velocity.

Parameters:
angleVel - DOCUMENT ME!

getAngularVelocity

public double getAngularVelocity()
Returns the angular velocity.

Returns:
DOCUMENT ME!

setAngularMomentum

public void setAngularMomentum(double angleMom)
DOCUMENT ME!

Parameters:
angleMom - DOCUMENT ME!

getAngularMomentum

public double getAngularMomentum()
DOCUMENT ME!

Returns:
DOCUMENT ME!

energy

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

Overrides:
energy in class ClassicalParticle2D
Returns:
DOCUMENT ME!

move

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

Overrides:
move in class ClassicalParticle2D
Parameters:
dt - DOCUMENT ME!
Returns:
this.

rotate

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

Parameters:
dt - DOCUMENT ME!
Returns:
this.

angularAccelerate

public RigidBody2D angularAccelerate(double a,
                                     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).

Parameters:
a - DOCUMENT ME!
dt - DOCUMENT ME!
Returns:
this.

applyTorque

public RigidBody2D applyTorque(double T,
                               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).

Parameters:
T - DOCUMENT ME!
dt - DOCUMENT ME!
Returns:
this.

applyTorque

public RigidBody2D applyTorque(Torque2D T,
                               double t,
                               double dt)
DOCUMENT ME!

Parameters:
T - DOCUMENT ME!
t - DOCUMENT ME!
dt - DOCUMENT ME!
Returns:
DOCUMENT ME!

applyForce

public RigidBody2D applyForce(double fx,
                              double fy,
                              double x,
                              double y,
                              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:
fx - DOCUMENT ME!
fy - DOCUMENT ME!
x - x-coordinate from centre of mass.
y - y-coordinate from centre of mass.
dt - DOCUMENT ME!
Returns:
this.

applyForce

public RigidBody2D applyForce(Force2D F,
                              double x,
                              double y,
                              double t,
                              double dt)
DOCUMENT ME!

Parameters:
F - DOCUMENT ME!
x - DOCUMENT ME!
y - DOCUMENT ME!
t - DOCUMENT ME!
dt - DOCUMENT ME!
Returns:
DOCUMENT ME!

collide

public RigidBody2D collide(RigidBody2D p,
                           double theta,
                           double e)
Collides this particle with another. This method calculates the resultant velocities.

Parameters:
p - DOCUMENT ME!
theta - centre of mass deflection angle.
e - coefficient of restitution.
Returns:
this.

angularCollide

public RigidBody2D angularCollide(RigidBody2D p,
                                  double e)
Collides this particle with another. This method calculates the resultant angular velocities.

Parameters:
p - DOCUMENT ME!
e - coefficient of restitution.
Returns:
this.