jumbo.euclid
Class Angle

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.Angle

public class Angle
extends Status

Angle - angle object

Angle represents an angle. The reason for the class is to help remember about radian/degree problems, to keep the angle in the right range (0, 2*PI) or (-PI, PI) as required, and to format output.

To construct an angle the user must consciously use RADIANS

The angle returned is always in RADIANS (except if getDegrees() is used).


If SIGNED is used, the angle is in the range -180 to 180 (-pi to pi)
If UNSIGNED is used, the angle is in the range 0 to 360 (0 to 2*pi)
Default is SIGNED

Default value of Angle is 0.0; Constructions of invalid angles should throw exceptions rather than try to make invalid angles.


Field Summary
static AngleType DEGREES
           
static double DEGREES_IN_RADIAN
           
static AngleType RADIANS
          set Radians or degrees for output
static jumbo.euclid.AngleRange SIGNED
          -PI to PI
static jumbo.euclid.AngleRange UNLIMITED
          Any value
static jumbo.euclid.AngleRange UNSIGNED
          0 to 2*PI
 
Constructor Summary
Angle()
          create deafult Angle (0.0)
Angle(Angle a)
          copy constructor
Angle(double a)
          create an angle IN RADIANS
Angle(double a, AngleType units)
          construct using degrees or radians
Angle(double x, double y)
          from X and Y components (uses atan2)
 
Method Summary
 Angle clone(Angle a)
           
 double cos()
          trigonometric functions
 boolean equals(Angle a)
          are two angles equal?
 boolean equals(double a)
          are two angles equal? RADIANS
 double getAngle()
          get angle in radians
 double getDegrees()
          get angle in degrees
 double getRadian()
          get angle in radians
 boolean greaterThan(Angle a)
          is one angle greater than another (after normalisation)
 boolean greaterThan(double a)
          is one angle greater than another (after normalisation)
 boolean greaterThanOrEquals(Angle a)
          is one angle greater than or equal to another (after normalisation)
 boolean greaterThanOrEquals(double a)
          is one angle greater than or equal to another (after normalisation)
 boolean lessThan(Angle a)
          is one angle less than another (after normalisation)
 boolean lessThan(double a)
          is one angle less than another (after normalisation)
 boolean lessThanOrEquals(Angle a)
          is one angle less than or equal to another (after normalisation)
 boolean lessThanOrEquals(double a)
          is one angle less than or equal to another (after normalisation)
static void main(java.lang.String[] args)
           
 Angle multiplyBy(double f)
          multiply an angle by a scalar
static double normalise(double angle)
          normalise angle (in radians) to range 0 -> 2*PI
 Angle plus(Angle a2)
          add two angles
 void putDegrees(double a)
          input angle in degrees
 void setRange(jumbo.euclid.AngleRange type)
          set type of range
 void shallowCopy(Angle a)
          shallowCopy
 double sin()
           
 Angle subtract(Angle a2)
          subtract two angles
 double tan()
           
 java.lang.String toString()
           
 
Methods inherited from class jumbo.euclid.Status
NYI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNLIMITED

public static final jumbo.euclid.AngleRange UNLIMITED
Any value

UNSIGNED

public static final jumbo.euclid.AngleRange UNSIGNED
0 to 2*PI

SIGNED

public static final jumbo.euclid.AngleRange SIGNED
-PI to PI

RADIANS

public static final AngleType RADIANS
set Radians or degrees for output

DEGREES

public static final AngleType DEGREES

DEGREES_IN_RADIAN

public static final double DEGREES_IN_RADIAN
Constructor Detail

Angle

public Angle()
create deafult Angle (0.0)

Angle

public Angle(double a)
create an angle IN RADIANS

Angle

public Angle(double a,
             AngleType units)
construct using degrees or radians

Angle

public Angle(double x,
             double y)
from X and Y components (uses atan2)

Angle

public Angle(Angle a)
copy constructor
Method Detail

shallowCopy

public void shallowCopy(Angle a)
shallowCopy

clone

public Angle clone(Angle a)

plus

public Angle plus(Angle a2)
add two angles

subtract

public Angle subtract(Angle a2)
subtract two angles

multiplyBy

public Angle multiplyBy(double f)
multiply an angle by a scalar

cos

public double cos()
trigonometric functions

sin

public double sin()

tan

public double tan()

normalise

public static double normalise(double angle)
normalise angle (in radians) to range 0 -> 2*PI

equals

public boolean equals(double a)
are two angles equal? RADIANS

greaterThan

public boolean greaterThan(double a)
is one angle greater than another (after normalisation)

greaterThanOrEquals

public boolean greaterThanOrEquals(double a)
is one angle greater than or equal to another (after normalisation)

lessThan

public boolean lessThan(double a)
is one angle less than another (after normalisation)

lessThanOrEquals

public boolean lessThanOrEquals(double a)
is one angle less than or equal to another (after normalisation)

equals

public boolean equals(Angle a)
are two angles equal?

greaterThan

public boolean greaterThan(Angle a)
is one angle greater than another (after normalisation)

greaterThanOrEquals

public boolean greaterThanOrEquals(Angle a)
is one angle greater than or equal to another (after normalisation)

lessThan

public boolean lessThan(Angle a)
is one angle less than another (after normalisation)

lessThanOrEquals

public boolean lessThanOrEquals(Angle a)
is one angle less than or equal to another (after normalisation)

getAngle

public double getAngle()
get angle in radians

getRadian

public double getRadian()
get angle in radians

getDegrees

public double getDegrees()
get angle in degrees

putDegrees

public void putDegrees(double a)
input angle in degrees

setRange

public void setRange(jumbo.euclid.AngleRange type)
set type of range

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)