Class pmr.euclid.Angle
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.euclid.Angle

java.lang.Object
   |
   +----pmr.euclid.Status
           |
           +----pmr.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.

Author:
(C) P. Murray-Rust, 1996

Variable Index

 o DEGREES
 o DEGREES_IN_RADIAN
 o RADIANS
set Radians or degrees for output
 o SIGNED
-PI to PI
 o UNLIMITED
Any value
 o UNSIGNED
0 to 2*PI

Constructor Index

 o Angle()
create deafult Angle (0.0)
 o Angle(Angle)
copy constructor
 o Angle(double)
create an angle IN RADIANS
 o Angle(double, AngleType)
construct using degrees or radians
 o Angle(double, double)
from X and Y components (uses atan2)

Method Index

 o clone(Angle)
 o cos()
trigonometric functions
 o equals(Angle)
are two angles equal?
 o equals(double)
are two angles equal? RADIANS
 o getAngle()
get angle in radians
 o getDegrees()
get angle in degrees
 o getRadian()
get angle in radians
 o greaterThan(Angle)
is one angle greater than another (after normalisation)
 o greaterThan(double)
is one angle greater than another (after normalisation)
 o greaterThanOrEquals(Angle)
is one angle greater than or equal to another (after normalisation)
 o greaterThanOrEquals(double)
is one angle greater than or equal to another (after normalisation)
 o lessThan(Angle)
is one angle less than another (after normalisation)
 o lessThan(double)
is one angle less than another (after normalisation)
 o lessThanOrEquals(Angle)
is one angle less than or equal to another (after normalisation)
 o lessThanOrEquals(double)
is one angle less than or equal to another (after normalisation)
 o main(String[])
 o multiplyBy(double)
multiply an angle by a scalar
 o normalise(double)
normalise angle (in radians) to range 0 -> 2*PI
 o plus(Angle)
add two angles
 o putDegrees(double)
input angle in degrees
 o setRange(AngleRange)
set type of range
 o shallowCopy(Angle)
shallowCopy
 o sin()
 o subtract(Angle)
subtract two angles
 o tan()
 o toString()

Variables

 o UNLIMITED
  public final static AngleRange UNLIMITED
Any value
 o UNSIGNED
  public final static AngleRange UNSIGNED
0 to 2*PI
 o SIGNED
  public final static AngleRange SIGNED
-PI to PI
 o RADIANS
  public final static AngleType RADIANS
set Radians or degrees for output
 o DEGREES
  public final static AngleType DEGREES
 o DEGREES_IN_RADIAN
  public final static double DEGREES_IN_RADIAN

Constructors

 o Angle
  public Angle()
create deafult Angle (0.0)
 o Angle
  public Angle(double a)
create an angle IN RADIANS
 o Angle
  public Angle(double a,
               AngleType units)
construct using degrees or radians
 o Angle
  public Angle(double x,
               double y)
from X and Y components (uses atan2)
 o Angle
  public Angle(Angle a)
copy constructor

Methods

 o shallowCopy
  public void shallowCopy(Angle a)
shallowCopy
 o clone
  public Angle clone(Angle a)
 o plus
  public Angle plus(Angle a2)
add two angles
 o subtract
  public Angle subtract(Angle a2)
subtract two angles
 o multiplyBy
  public Angle multiplyBy(double f)
multiply an angle by a scalar
 o cos
  public double cos()
trigonometric functions
 o sin
  public double sin()
 o tan
  public double tan()
 o normalise
  public static double normalise(double angle)
normalise angle (in radians) to range 0 -> 2*PI
 o equals
  public boolean equals(double a)
are two angles equal? RADIANS
 o greaterThan
  public boolean greaterThan(double a)
is one angle greater than another (after normalisation)
 o greaterThanOrEquals
  public boolean greaterThanOrEquals(double a)
is one angle greater than or equal to another (after normalisation)
 o lessThan
  public boolean lessThan(double a)
is one angle less than another (after normalisation)
 o lessThanOrEquals
  public boolean lessThanOrEquals(double a)
is one angle less than or equal to another (after normalisation)
 o equals
  public boolean equals(Angle a)
are two angles equal?
 o greaterThan
  public boolean greaterThan(Angle a)
is one angle greater than another (after normalisation)
 o greaterThanOrEquals
  public boolean greaterThanOrEquals(Angle a)
is one angle greater than or equal to another (after normalisation)
 o lessThan
  public boolean lessThan(Angle a)
is one angle less than another (after normalisation)
 o lessThanOrEquals
  public boolean lessThanOrEquals(Angle a)
is one angle less than or equal to another (after normalisation)
 o getAngle
  public double getAngle()
get angle in radians
 o getRadian
  public double getRadian()
get angle in radians
 o getDegrees
  public double getDegrees()
get angle in degrees
 o putDegrees
  public void putDegrees(double a)
input angle in degrees
 o setRange
  public void setRange(AngleRange type)
set type of range
 o toString
  public String toString()
Overrides:
toString in class Object
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index