fi.utu.cs.physics
Class FrictionalBody

java.lang.Object
  |
  +--fi.utu.cs.physics.Particle
        |
        +--fi.utu.cs.physics.Body
              |
              +--fi.utu.cs.physics.FrictionalBody
Direct Known Subclasses:
Puck

public abstract class FrictionalBody
extends Body

A moving physical body with mass and dimensionality. The outline of the body is approximated with a bounding circle of a given radius, which is used in detecting overlaps. The body can be owned by an instance of the class Universe, which may impose limits to the position.

Since:
1.1

Constructor Summary
protected FrictionalBody(double m, double r, Friction f)
          Constructs a body with the mass m, the radius r and friction f.
protected FrictionalBody(double m, double r, Point2 p, Friction f)
          Constructs a body with the mass m, the radius r, the position p and friction f.
protected FrictionalBody(double m, double r, Point2 p, Vector2 v, Friction f)
          Constructs a body with the mass m, the radius r, the position p, the velocity v and friction f.
protected FrictionalBody(double m, double r, Point2 p, Vector2 v, Vector2 a, Friction f)
          Constructs a body with the mass m, the radius r, the position p, the velocity v, the acceleration a and friction f.
 
Method Summary
 Vector2 futureVelocity(double dt)
          Returns the velocity of the body after seconds.
 Friction getFriction()
          Returns the friction of the body.
 void setFriction(Friction f)
          Sets the friction of the body to f.
 java.lang.String toString()
          Returns a string that contains the values of the attributes.
 
Methods inherited from class fi.utu.cs.physics.Body
advance, elasticCollision, futurePosition, 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

FrictionalBody

protected FrictionalBody(double m,
                         double r,
                         Friction f)
Constructs a body with the mass m, the radius r and friction f. The body resides in the origin and has a zero velocity and a zero acceleration. The body is corporeal and has no owner.


FrictionalBody

protected FrictionalBody(double m,
                         double r,
                         Point2 p,
                         Friction f)
Constructs a body with the mass m, the radius r, the position p and friction f. The body has a zero velocity and a zero acceleration. The body is corporeal and has no owner.


FrictionalBody

protected FrictionalBody(double m,
                         double r,
                         Point2 p,
                         Vector2 v,
                         Friction f)
Constructs a body with the mass m, the radius r, the position p, the velocity v and friction f. The body has a zero acceleration. The body is corporeal and has no owner.


FrictionalBody

protected FrictionalBody(double m,
                         double r,
                         Point2 p,
                         Vector2 v,
                         Vector2 a,
                         Friction f)
Constructs a body with the mass m, the radius r, the position p, the velocity v, the acceleration a and friction f. The body is corporeal and has no owner.

Method Detail

getFriction

public Friction getFriction()
Returns the friction of the body.


setFriction

public void setFriction(Friction f)
Sets the friction of the body to f.


futureVelocity

public Vector2 futureVelocity(double dt)
Returns the velocity of the body after seconds. If the body is not frictionless, friction slows down the velocity.

Overrides:
futureVelocity in class Body
See Also:
Body.advance(double), Body.futurePosition(double)

toString

public java.lang.String toString()
Returns a string that contains the values of the attributes.

Overrides:
toString in class Body