fi.utu.cs.physics
Class OrientedBody

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

public abstract class OrientedBody
extends Body

A moving physical body with mass, dimensionality and orientation. The body can have static and kinetic friction.

Since:
1.1
See Also:
Friction

Constructor Summary
protected OrientedBody(double m, double r, Vector2 o)
          Constructs a body with the mass m, the radius r and the orientation o.
protected OrientedBody(double m, double r, Vector2 o, Point2 p)
          Constructs a body with the mass m, the radius r, the orientation o and the position p.
protected OrientedBody(double m, double r, Vector2 o, Point2 p, Vector2 v)
          Constructs a body with the mass m, the radius r, the orientation o, the position p and the velocity v.
protected OrientedBody(double m, double r, Vector2 o, Point2 p, Vector2 v, Vector2 a)
          Constructs a body with the mass m, the radius r, the orientation o, the position p, the velocity v and the acceleration a.
 
Method Summary
 Vector2 futureVelocity(double dt)
          Returns the velocity of the body after seconds.
 Friction getNormalFriction()
          Returns the normal friction.
 Vector2 getOrientation()
          Returns the orientation of this body.
 Friction getTangentFriction()
          Returns the tangent friction.
 void setNormalFriction(Friction f)
          Sets the normal friction to f
 void setOrientation(Vector2 o)
          Sets the orientation to o.
 void setTangentFriction(Friction f)
          Sets the tangent friction 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

OrientedBody

protected OrientedBody(double m,
                       double r,
                       Vector2 o)
Constructs a body with the mass m, the radius r and the orientation o. The body resides in the origin and has a zero velocity and a zero acceleration. The body is corporeal and frictionless and has no owner.


OrientedBody

protected OrientedBody(double m,
                       double r,
                       Vector2 o,
                       Point2 p)
Constructs a body with the mass m, the radius r, the orientation o and the position p. The body has a zero velocity and a zero acceleration. The body is corporeal and frictionless and has no owner.


OrientedBody

protected OrientedBody(double m,
                       double r,
                       Vector2 o,
                       Point2 p,
                       Vector2 v)
Constructs a body with the mass m, the radius r, the orientation o, the position p and the velocity v. The body has a zero acceleration. The body is corporeal and frictionless and has no owner.


OrientedBody

protected OrientedBody(double m,
                       double r,
                       Vector2 o,
                       Point2 p,
                       Vector2 v,
                       Vector2 a)
Constructs a body with the mass m, the radius r, the orientation o, the position p, the velocity v and the acceleration a. The body is corporeal and frictionless and has no owner.

Method Detail

getOrientation

public Vector2 getOrientation()
Returns the orientation of this body. The orientation is a unit vector (i.e., getOrientation().length() == 1.0).


setOrientation

public void setOrientation(Vector2 o)
Sets the orientation to o. The vector o needs not to be a unit vector. However, the resulting orientation vector is a unit vector that has the same direction as o.


getTangentFriction

public Friction getTangentFriction()
Returns the tangent friction.


setTangentFriction

public void setTangentFriction(Friction f)
Sets the tangent friction to f


getNormalFriction

public Friction getNormalFriction()
Returns the normal friction.


setNormalFriction

public void setNormalFriction(Friction f)
Sets the normal friction to f


futureVelocity

public Vector2 futureVelocity(double dt)
Returns the velocity of the body after seconds. If the body is not frictionless, tangent and normal frictions slow 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