|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fi.utu.cs.physics.Particle | +--fi.utu.cs.physics.Body | +--fi.utu.cs.physics.MomentaryBody
A moving physical body with mass, dimensionality and a finite lifetime.
The lifetime is decreased each time the advance
method
is called. When lifetime becomes less than zero, the die
method is executed.
Constructor Summary | |
protected |
MomentaryBody(double m,
double r,
double lt)
Constructs a body with the mass m ,
the radius r and the lifetime lt .
|
protected |
MomentaryBody(double m,
double r,
double lt,
Point2 p)
Constructs a body with the mass m ,
the radius r , the lifetime lt
and the position p .
|
protected |
MomentaryBody(double m,
double r,
double lt,
Point2 p,
Vector2 v)
Constructs a body with the mass m ,
the radius r , the lifetime lt ,
the position p
and the velocity v . |
protected |
MomentaryBody(double m,
double r,
double lt,
Point2 p,
Vector2 v,
Vector2 a)
Constructs a body with the mass m ,
the radius r , the lifetime lt ,
the position p ,
the velocity v and the acceleration a .
|
Method Summary | |
void |
advance(double dt)
Advances the time dt seconds and
updates the position, velocity and lifetime of the body accordingly. |
abstract void |
die()
Realizes the death of this body. |
double |
getLifetime()
Returns the remaining lifetime of this body. |
void |
setLifetime(double lt)
Sets the lifetime to lt seconds. |
java.lang.String |
toString()
Returns a string that contains the values of the attributes. |
Methods inherited from class fi.utu.cs.physics.Body |
elasticCollision, futurePosition, futureVelocity, getAcceleration, getMass, getPosition, getRadius, getVelocity, inelasticCollision, isColliding, isOverlapping, setAcceleration, setAcceleration, setMass, setPosition, setPosition, setRadius, setVelocity, setVelocity |
Methods inherited from class fi.utu.cs.physics.Particle |
addCollisionNotification, clearCollisionNotifications, getOwner, isCollisionNotified, isCollisionNotified, isCorporeal, removeCollisionNotification, setCorporeal, setEthereal, setOwner |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected MomentaryBody(double m, double r, double lt)
m
,
the radius r
and the lifetime lt
.
The body resides in the origin and has a zero velocity and
a zero acceleration. The body is corporeal and has no owner.
protected MomentaryBody(double m, double r, double lt, Point2 p)
m
,
the radius r
, the lifetime lt
and the position p
.
The body has a zero velocity and a zero acceleration.
The body is corporeal and has no owner.
protected MomentaryBody(double m, double r, double lt, Point2 p, Vector2 v)
m
,
the radius r
, the lifetime lt
,
the position p
and the velocity v
. The body has a
zero acceleration. The body is corporeal and has no owner.
protected MomentaryBody(double m, double r, double lt, Point2 p, Vector2 v, Vector2 a)
m
,
the radius r
, the lifetime lt
,
the position p
,
the velocity v
and the acceleration a
.
The body is corporeal and has no owner.
Method Detail |
public double getLifetime()
public void setLifetime(double lt)
lt
seconds.
public void advance(double dt)
dt
seconds and
updates the position, velocity and lifetime of the body accordingly.
advance
in class Body
Body.advance(double)
public abstract void die()
public java.lang.String toString()
toString
in class Body
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |