mako5.math
Class Angle

java.lang.Object
  extended by mako5.math.Angle
All Implemented Interfaces:
Cloneable

public final class Angle
extends Object
implements Cloneable

An angle in radians. Useful when dealing with polar coordinates, or determining the direction of vectors.

Version:
31-Jan 2006, 19-Jul 2006
Author:
Paul Jarrett

Field Summary
static float HALF_PI
           
static float PI
           
static float TWO_PI
           
 
Constructor Summary
Angle(float fRadians_)
          Makes a new angle.
 
Method Summary
 void add(Angle other_)
          Adds another angle to this.
 void add(float value)
          Adds to this angle.
 void addDegrees(float fAmount_)
          Adds degrees to this.
 void addRadians(float fAmount_)
          Adds radians to this.
static Angle atan(float x, float y)
          Determines an angle by using atan
 Object clone()
          Clones this angle
 float cos()
          Returns the cosine of this in radians
 void flip()
          Makes this angle equal -angle.
static void glNegRotate(Angle rAngle_, float x, float y, float z)
          Performs an openGL rotation that is -angle.
static void glRotate(Angle rAngle_, float x, float y, float z)
          Performs an openGL rotation based upon this angle.
 void setRadians(float f)
          Sets the value of this angle in radians.
 float sin()
          Returns the sine of this in radians.
 void sub(Angle other_)
          Subtracts another angle from this.
 float tan()
          Returns the tangent of this in radians
 float toDegrees()
          Returns the measurement of this in radians.
 float toRadians()
          Returns the measurement of this.
 String toString()
          Returns "Angle: " + ..value..
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PI

public static final float PI
See Also:
Constant Field Values

TWO_PI

public static final float TWO_PI
See Also:
Constant Field Values

HALF_PI

public static final float HALF_PI
See Also:
Constant Field Values
Constructor Detail

Angle

public Angle(float fRadians_)
Makes a new angle.

Method Detail

clone

public Object clone()
Clones this angle

Overrides:
clone in class Object

toRadians

public float toRadians()
Returns the measurement of this.

Returns:
the measurement of this in radians

toDegrees

public float toDegrees()
Returns the measurement of this in radians.

Returns:
the measurement of this in degrees

setRadians

public void setRadians(float f)
Sets the value of this angle in radians.

Since:
05-Jul 2006

add

public void add(Angle other_)
Adds another angle to this.

Parameters:
other_ - another angle

add

public void add(float value)
Adds to this angle.

Parameters:
value - the amount to add
Since:
1-Jul 2006

addDegrees

public void addDegrees(float fAmount_)
Adds degrees to this.


addRadians

public void addRadians(float fAmount_)
Adds radians to this.


sub

public void sub(Angle other_)
Subtracts another angle from this.


flip

public void flip()
Makes this angle equal -angle.


sin

public float sin()
Returns the sine of this in radians.


cos

public float cos()
Returns the cosine of this in radians


tan

public float tan()
Returns the tangent of this in radians


toString

public String toString()
Returns "Angle: " + ..value.. + " radians".

Overrides:
toString in class Object

atan

public static Angle atan(float x,
                         float y)
Determines an angle by using atan


glRotate

public static void glRotate(Angle rAngle_,
                            float x,
                            float y,
                            float z)
Performs an openGL rotation based upon this angle.


glNegRotate

public static void glNegRotate(Angle rAngle_,
                               float x,
                               float y,
                               float z)
Performs an openGL rotation that is -angle.