jsci.physics
Class ClassicalParticle2D
- java.lang.Object
-
- jsci.physics.Particle
-
- jsci.physics.AbstractClassicalParticle
-
- jsci.physics.ClassicalParticle2D
-
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- RigidBody2D
public class ClassicalParticle2D extends AbstractClassicalParticle
The ClassicalParticle2D class provides an object for encapsulating classical point particles that live in 2D.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ClassicalParticle2D()Constructs a classical particle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ClassicalParticle2Daccelerate(double ax, double ay, double dt)Accelerates this particle.ClassicalParticle2DapplyForce(double Fx, double Fy, double dt)Applies a force to this particle.ClassicalParticle2Dcollide(ClassicalParticle2D p, double theta)Collides this particle with another (elastic collision).doubleenergy()Returns the kinetic energy.doublegetMass()Returns the mass of this particle.AbstractDoubleVectorgetMomentum()AbstractDoubleVectorgetPosition()AbstractDoubleVectorgetVelocity()doublegetXMomentum()doublegetXPosition()doublegetXVelocity()doublegetYMomentum()doublegetYPosition()doublegetYVelocity()ClassicalParticle2Dgravitate(ClassicalParticle2D p, double dt)Evolves two particles under their mutual gravitational attraction.ClassicalParticle2Dmove(double dt)Evolves this particle forward according to its kinematics.voidsetMass(double m)Sets the mass of this particle.voidsetMomentum(double xMom, double yMom)Sets the momentum of this particle.voidsetPosition(double xPos, double yPos)Sets the position of this particle.voidsetVelocity(double xVel, double yVel)Sets the velocity of this particle.voidsetXPosition(double xPos)voidsetYPosition(double yPos)doublespeed()Returns the speed of this particle.ClassicalParticle2Dtranslate(double dt)Evolves this particle forward according to its linear kinematics.
-
-
-
Constructor Detail
-
ClassicalParticle2D
public ClassicalParticle2D()
Constructs a classical particle.
-
-
Method Detail
-
setMass
public void setMass(double m)
Sets the mass of this particle.
-
getMass
public double getMass()
Returns the mass of this particle.- Specified by:
getMassin classAbstractClassicalParticle
-
setPosition
public void setPosition(double xPos, double yPos)Sets the position of this particle.
-
getPosition
public AbstractDoubleVector getPosition()
- Specified by:
getPositionin classAbstractClassicalParticle
-
setXPosition
public void setXPosition(double xPos)
-
getXPosition
public double getXPosition()
-
setYPosition
public void setYPosition(double yPos)
-
getYPosition
public double getYPosition()
-
setVelocity
public void setVelocity(double xVel, double yVel)Sets the velocity of this particle.
-
getVelocity
public AbstractDoubleVector getVelocity()
- Specified by:
getVelocityin classAbstractClassicalParticle
-
getXVelocity
public double getXVelocity()
-
getYVelocity
public double getYVelocity()
-
speed
public double speed()
Returns the speed of this particle.- Overrides:
speedin classAbstractClassicalParticle
-
setMomentum
public void setMomentum(double xMom, double yMom)Sets the momentum of this particle.
-
getMomentum
public AbstractDoubleVector getMomentum()
- Overrides:
getMomentumin classAbstractClassicalParticle
-
getXMomentum
public double getXMomentum()
-
getYMomentum
public double getYMomentum()
-
energy
public double energy()
Returns the kinetic energy.- Overrides:
energyin classAbstractClassicalParticle
-
move
public ClassicalParticle2D move(double dt)
Evolves this particle forward according to its kinematics. This method changes the particle's position.- Returns:
- this.
-
translate
public ClassicalParticle2D translate(double dt)
Evolves this particle forward according to its linear kinematics. This method changes the particle's position.- Returns:
- this.
-
accelerate
public ClassicalParticle2D accelerate(double ax, double ay, double dt)
Accelerates this particle. This method changes the particle's velocity. It is additive, that isaccelerate(a1, dt).accelerate(a2, dt)is equivalent toaccelerate(a1+a2, dt).- Returns:
- this.
-
applyForce
public ClassicalParticle2D applyForce(double Fx, double Fy, double dt)
Applies a force to this particle. This method changes the particle's velocity. It is additive, that isapplyForce(F1, dt).applyForce(F2, dt)is equivalent toapplyForce(F1+F2, dt).- Returns:
- this.
-
gravitate
public ClassicalParticle2D gravitate(ClassicalParticle2D p, double dt)
Evolves two particles under their mutual gravitational attraction. This method changes the velocity of both particles.- Returns:
- this.
-
collide
public ClassicalParticle2D collide(ClassicalParticle2D p, double theta)
Collides this particle with another (elastic collision). This method calculates the resultant velocities.- Parameters:
theta- centre of mass deflection angle.- Returns:
- this.
-
-
DMelt 3.0 © DataMelt by jWork.ORG