com.azalient.apo.basics
Class Angle

java.lang.Object
  extended by com.azalient.apo.basics.Angle
All Implemented Interfaces:
IAngle
Direct Known Subclasses:
AngleDegrees, AngleRadians

public class Angle
extends Object
implements IAngle

An angle object, with methods for angle arithmetic, conversion from degrees to radians, sine, cosine, etc.

The range of the angle can be set as (-180, 180] or [0, 360).

To instantiate this object from an angle value, use AngleDegrees.AngleDegrees(double) or AngleRadians.AngleRadians(double)


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.azalient.api.a.position.IAngle
IAngle.AngleRange
 
Field Summary
static Angle A0
           
static Angle A180
           
static Angle A270
           
static Angle A45
           
static Angle A90
           
static Angle ANEG90
           
static double DEG_180
           
static double DEG_360
           
static double DEG_45
           
static double DEG_90
           
static double DEG_COLINEAR
           
static double DEG_UTURN
           
static Angle EAST
           
static double HALFPI
           
static Angle NORTH
           
static double PI
           
static Angle SOUTH
           
static double TWOPI
           
static Angle WEST
           
static Angle ZERO
           
 
Fields inherited from interface com.azalient.api.a.position.IAngle
DEG135, DEG180, DEG270, DEG360, DEG45, DEG90
 
Constructor Summary
Angle(IAngle that)
          Create an angle as a duplicate of the given angle.
 
Method Summary
 double cos()
          Returns the cosine of the angle
 double degrees()
          Returns the angle in degrees
 IAngle minus(IAngle that)
          Subtract that angle from this one Returns the sum of the two angles, in a range according to the current range setting
 IAngle negative()
          Returns a new angle, whose value is the negative of this one
 IAngle plus(IAngle that)
          Add that angle to this one Returns the sum of the two angles, in a range according to the current range setting
 double radians()
          Returns the angle value in radians, where PI radians = 180
 IAngle range(IAngle.AngleRange angleRnge)
          Returns this angle's value in the given range
 IAngle rangeN180_P180()
          Returns this angle's value in the range (-180,180]
 IAngle rangeP0_P360()
          Returns this angle's value in the range [0, 360)
 double sin()
          Returns the sine of the angle
 double tan()
          Returns the tangent of the angle
 String toString()
           
 IXyz unitVectorXY()
          The unit vector { sine(A), cosine(A), 0 }
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEG_45

public static final double DEG_45
See Also:
Constant Field Values

DEG_90

public static final double DEG_90
See Also:
Constant Field Values

DEG_180

public static final double DEG_180
See Also:
Constant Field Values

DEG_360

public static final double DEG_360
See Also:
Constant Field Values

DEG_COLINEAR

public static final double DEG_COLINEAR
See Also:
Constant Field Values

DEG_UTURN

public static final double DEG_UTURN
See Also:
Constant Field Values

PI

public static final double PI
See Also:
Constant Field Values

TWOPI

public static final double TWOPI
See Also:
Constant Field Values

HALFPI

public static final double HALFPI
See Also:
Constant Field Values

ZERO

public static final Angle ZERO

A0

public static final Angle A0

A45

public static final Angle A45

A90

public static final Angle A90

ANEG90

public static final Angle ANEG90

A270

public static final Angle A270

A180

public static final Angle A180

NORTH

public static final Angle NORTH

SOUTH

public static final Angle SOUTH

EAST

public static final Angle EAST

WEST

public static final Angle WEST
Constructor Detail

Angle

public Angle(IAngle that)
Create an angle as a duplicate of the given angle. Even though the value of the angle is immutable, its range is not, so a copy is sometimes required.

Parameters:
that -
Method Detail

degrees

public double degrees()
Description copied from interface: IAngle
Returns the angle in degrees

Specified by:
degrees in interface IAngle

radians

public double radians()
Description copied from interface: IAngle
Returns the angle value in radians, where PI radians = 180

Specified by:
radians in interface IAngle

sin

public double sin()
Description copied from interface: IAngle
Returns the sine of the angle

Specified by:
sin in interface IAngle

cos

public double cos()
Description copied from interface: IAngle
Returns the cosine of the angle

Specified by:
cos in interface IAngle

tan

public double tan()
Description copied from interface: IAngle
Returns the tangent of the angle

Specified by:
tan in interface IAngle

negative

public IAngle negative()
Description copied from interface: IAngle
Returns a new angle, whose value is the negative of this one

Specified by:
negative in interface IAngle

toString

public String toString()
Overrides:
toString in class Object

range

public IAngle range(IAngle.AngleRange angleRnge)
Description copied from interface: IAngle
Returns this angle's value in the given range

Specified by:
range in interface IAngle

rangeN180_P180

public IAngle rangeN180_P180()
Description copied from interface: IAngle
Returns this angle's value in the range (-180,180]

Specified by:
rangeN180_P180 in interface IAngle

rangeP0_P360

public IAngle rangeP0_P360()
Description copied from interface: IAngle
Returns this angle's value in the range [0, 360)

Specified by:
rangeP0_P360 in interface IAngle

plus

public IAngle plus(IAngle that)
Description copied from interface: IAngle
Add that angle to this one Returns the sum of the two angles, in a range according to the current range setting

Specified by:
plus in interface IAngle

minus

public IAngle minus(IAngle that)
Description copied from interface: IAngle
Subtract that angle from this one Returns the sum of the two angles, in a range according to the current range setting

Specified by:
minus in interface IAngle

unitVectorXY

public IXyz unitVectorXY()
Description copied from interface: IAngle
The unit vector { sine(A), cosine(A), 0 }

Specified by:
unitVectorXY in interface IAngle