jsci.physics
Class RigidBody2D
- java.lang.Object
-
- jsci.physics.Particle
-
- jsci.physics.AbstractClassicalParticle
-
- jsci.physics.ClassicalParticle2D
-
- 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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RigidBody2D()Constructs a rigid body.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RigidBody2DangularAccelerate(double a, double dt)Accelerates this particle.RigidBody2DangularCollide(RigidBody2D p, double e)Collides this particle with another.RigidBody2DapplyForce(double fx, double fy, double x, double y, double dt)Applies a force acting at a point away from the centre of mass.RigidBody2DapplyTorque(double T, double dt)Applies a torque to this particle.RigidBody2Dcollide(RigidBody2D p, double theta, double e)Collides this particle with another.doubleenergy()Returns the kinetic and rotational energy.doublegetAngle()Returns the angle (orientation) of this body.doublegetAngularMomentum()doublegetAngularVelocity()Returns the angular velocity.doublegetMomentOfInertia()Returns the moment of inertia.ClassicalParticle2Dmove(double dt)Evolves this particle forward according to its kinematics.RigidBody2Drotate(double dt)Evolves this particle forward according to its rotational kinematics.voidsetAngle(double angle)Sets the angle (orientation) of this body.voidsetAngularMomentum(double angleMom)voidsetAngularVelocity(double angleVel)Sets the angular velocity.voidsetMomentOfInertia(double MoI)Sets the moment of inertia.-
Methods inherited from class jsci.physics.ClassicalParticle2D
accelerate, applyForce, collide, getMass, getMomentum, getPosition, getVelocity, getXMomentum, getXPosition, getXVelocity, getYMomentum, getYPosition, getYVelocity, gravitate, setMass, setMomentum, setPosition, setVelocity, setXPosition, setYPosition, speed, translate
-
-
-
-
Method Detail
-
setMomentOfInertia
public void setMomentOfInertia(double MoI)
Sets the moment of inertia.
-
getMomentOfInertia
public double getMomentOfInertia()
Returns the moment of inertia.
-
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.
-
getAngularVelocity
public double getAngularVelocity()
Returns the angular velocity.
-
setAngularMomentum
public void setAngularMomentum(double angleMom)
-
getAngularMomentum
public double getAngularMomentum()
-
energy
public double energy()
Returns the kinetic and rotational energy.- Overrides:
energyin classClassicalParticle2D
-
move
public ClassicalParticle2D move(double dt)
Evolves this particle forward according to its kinematics. This method changes the particle's position and orientation.- Overrides:
movein classClassicalParticle2D- Returns:
- this.
-
rotate
public RigidBody2D rotate(double dt)
Evolves this particle forward according to its rotational kinematics. This method changes the particle's orientation.- 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 isangularAccelerate(a1, dt).angularAccelerate(a2, dt)is equivalent toangularAccelerate(a1+a2, dt).- 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 isapplyTorque(T1, dt).applyTorque(T2, dt)is equivalent toapplyTorque(T1+T2, dt).- Returns:
- this.
-
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:
x- x-coordinate from centre of mass.y- y-coordinate from centre of mass.- Returns:
- this.
-
collide
public RigidBody2D collide(RigidBody2D p, double theta, double e)
Collides this particle with another. This method calculates the resultant velocities.- Parameters:
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:
e- coefficient of restitution.- Returns:
- this.
-
-
DMelt 3.0 © DataMelt by jWork.ORG