JSci.physics
Class RigidBody2D

java.lang.Object
  extended by JSci.physics.Particle
      extended by JSci.physics.ClassicalParticle2D
          extended by JSci.physics.RigidBody2D
All Implemented Interfaces:
java.io.Serializable

public class RigidBody2D
extends ClassicalParticle2D

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

Version:
1.0
Author:
Mark Hale
See Also:
Serialized Form

Field Summary
protected  double ang
          Angle (orientation).
protected  double angMass
          Moment of inertia.
protected  double angVel
          Angular velocity.
 
Fields inherited from class JSci.physics.ClassicalParticle2D
mass, vx, vy, x, y
 
Constructor Summary
RigidBody2D()
          Constructs a rigid body.
 
Method Summary
 RigidBody2D angularAccelerate(double a, double dt)
           
 RigidBody2D angularCollide(RigidBody2D p, double e)
          Collides this particle with another.
 ClassicalParticle2D applyForce(Force2D F, double dt)
           
 RigidBody2D applyTorque(double T, double dt)
           
 RigidBody2D collide(RigidBody2D p, 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()
           
 double getAngularVelocity()
           
 double getMomentOfInertia()
           
 ClassicalParticle2D move(double dt)
          Evolves the particle forward according to its kinematics.
 RigidBody2D rotate(double dt)
           
 void setAngle(double angle)
          Sets the angle (orientation) of this body.
 void setAngularMomentum(double angleMom)
           
 void setAngularVelocity(double angleVel)
           
 void setMomentOfInertia(double MoI)
           
 
Methods inherited from class JSci.physics.ClassicalParticle2D
accelerate, applyForce, collide, getMass, getXMomentum, getXPosition, getXVelocity, getYMomentum, getYPosition, getYVelocity, gravitate, setMass, setMomentum, setPosition, setVelocity, setXPosition, setYPosition, 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.


ang

protected double ang
Angle (orientation).


angVel

protected double angVel
Angular velocity.

Constructor Detail

RigidBody2D

public RigidBody2D()
Constructs a rigid body.

Method Detail

setMomentOfInertia

public void setMomentOfInertia(double MoI)

getMomentOfInertia

public double getMomentOfInertia()

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)

getAngularVelocity

public double getAngularVelocity()

setAngularMomentum

public void setAngularMomentum(double angleMom)

getAngularMomentum

public double getAngularMomentum()

energy

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

Overrides:
energy in class ClassicalParticle2D

move

public ClassicalParticle2D move(double dt)
Evolves the particle forward according to its kinematics.

Overrides:
move in class ClassicalParticle2D

rotate

public RigidBody2D rotate(double dt)

angularAccelerate

public RigidBody2D angularAccelerate(double a,
                                     double dt)

applyTorque

public RigidBody2D applyTorque(double T,
                               double dt)

applyForce

public ClassicalParticle2D applyForce(Force2D F,
                                      double dt)
Overrides:
applyForce in class ClassicalParticle2D

collide

public RigidBody2D collide(RigidBody2D p,
                           double e)
Collides this particle with another.

Parameters:
e - coefficient of restitution

angularCollide

public RigidBody2D angularCollide(RigidBody2D p,
                                  double e)
Collides this particle with another.

Parameters:
e - coefficient of restitution