vooga.gameEngine.core
Class Rotation2D

java.lang.Object
  extended by vooga.gameEngine.core.Rotation2D
All Implemented Interfaces:
java.lang.Cloneable

public class Rotation2D
extends java.lang.Object
implements java.lang.Cloneable

Class Rotation2D represents the rotation of an object in space. This class is used for controlling the rotation of GameItem's when they are rendered on screen.

Author:
Justin C. Klaassen

Constructor Summary
Rotation2D()
          Default constructor; creates a Rotation2D object with a angle of 0 and relative position of (0,0).
Rotation2D(double theta, Position p)
          Constructor for creating a new Rotation2D object given an angle of rotation and a relative position about which to rotate.
 
Method Summary
 java.lang.Object clone()
           
 Position getPosition()
          Method for getting the position from which the rotation will occur.
 double getTheta()
          Method for getting the angle of rotation.
 void rotate(double dtheta)
          Changes the angle of rotation by dtheta.
 void setPosition(Position p)
          Method for setting the position from which the rotation will occur.
 void setTheta(double theta)
          Method for setting the angle of rotation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rotation2D

public Rotation2D()
Default constructor; creates a Rotation2D object with a angle of 0 and relative position of (0,0).


Rotation2D

public Rotation2D(double theta,
                  Position p)
Constructor for creating a new Rotation2D object given an angle of rotation and a relative position about which to rotate.

Parameters:
theta - is the angle of rotation in degrees
p - is the relative Position about which the rotation will occur
See Also:
Position
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getTheta

public double getTheta()
Method for getting the angle of rotation.

Returns:
the angle of rotation in radians

setTheta

public void setTheta(double theta)
Method for setting the angle of rotation.

Parameters:
theta - is the angle of rotation in radians

rotate

public final void rotate(double dtheta)
Changes the angle of rotation by dtheta.

Parameters:
dtheta - is the amount to rotate in radians

getPosition

public Position getPosition()
Method for getting the position from which the rotation will occur. This position is relative to the position object being rotated.

Returns:
the relative Position about which the object will be rotated
See Also:
Position

setPosition

public void setPosition(Position p)
Method for setting the position from which the rotation will occur. This position is relative to the position object being rotated.

Parameters:
p - is the relative Position about which the rotation will occur
See Also:
Position