com.mapinfo.midev.unit

## Class Angle

- java.lang.Object
- - com.mapinfo.midev.unit.Angle

All Implemented Interfaces:
  Serializable

    public final class Angle
    extends Object
    implements Serializable

Class that represents the value and unit of an angular measure.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`Angle(double value, AngularUnit unit)` Create an angle.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Length` `convert(Angle angle)` Convert the given angle to an approximated equivalent linear distance.
`boolean` `equals(Object o)` Equals implementation.
`boolean` `equivalent(Angle angle)` Is this angle equivalent to the given angle.
`boolean` `equivalent(Angle angle, double tolerance)` Is this angle equivalent to the given angle within the given tolerance.
`double` `getNormalizedValue()` Get the value of this angle normalized to lie within the inclusive range of one circular rotation, e.g.
`double` `getNormalizedValue(AngularUnit unit)` Get the value of this angle normalized to lie within the inclusive range of one circular rotation.
`AngularUnit` `getUnit()` Get the unit of this angle.
`double` `getValue()` Get the value of the angular measure.
`double` `getValue(AngularUnit au)` Return the value of this angle in the requested unit, converting if necessary.
`int` `hashCode()` Hashcode implementation.
`String` `toString()`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Angle

    public Angle(double value,
                 AngularUnit unit)

Create an angle.

Parameters:
  `value` - a positive or negative angular measure
  `unit` - an AngularUnit
Throws:
  `IllegalArgumentException` - if the specified unit is null.

### Method Detail

#### getUnit

    public AngularUnit getUnit()

Get the unit of this angle.

Returns:
  AngularUnit of the angle

#### getValue

    public double getValue()

Get the value of the angular measure. The unit of this value is the unit returned by `Angle.getUnit()`.

Returns:
  The value of the angular measure.

#### getValue

    public double getValue(AngularUnit au)

Return the value of this angle in the requested unit, converting if necessary.

Parameters:
  `au` - the desired AngularUnit.
Returns:
  the value of this angle in the specified unit.

#### getNormalizedValue

    public double getNormalizedValue()

Get the value of this angle normalized to lie within the inclusive range of one circular rotation, e.g. if this angle had unit degrees the inclusive range would be [0,360] degrees.

This method converts any negative values to their equivalent positive value in the simple range, -90 degrees --> 270 degrees -0.5PI radians --> 1.5PI radians

It also converts angles greater than +/-360 degrees or +/-2PI radians to a simple value, 410 degrees --> 50 degrees -500 degrees --> 220 degrees 3.5PI radians --> 1.5PI radians

Returns:
  normalized value of this angle. The unit of this value is the unit returned by `Angle.getUnit()`
See Also:
  `Angle.getValue()`, `Angle.getNormalizedValue(AngularUnit)`

#### getNormalizedValue

    public double getNormalizedValue(AngularUnit unit)

Get the value of this angle normalized to lie within the inclusive range of one circular rotation. The value is converted to it's equivalent in the given AngularUnit.

Parameters:
  `unit` - angular unit of the returned value
Returns:
  normalized value of this angle in the given angular unit
Throws:
  `IllegalArgumentException` - if the specified unit is null.

#### equivalent

    public boolean equivalent(Angle angle)

Is this angle equivalent to the given angle.

Two angles are equivalent if they represent the same absolute value, e.g. Angle 1 degree is equivalent to Angle 60 minute.

This method has the same behavior as calling `Angle.equivalent(Angle,double)` with tolerance == 0;

Parameters:
  `angle` - angle to test for equivalence.
Returns:
  true if equivalent, false otherwise.

#### equivalent

    public boolean equivalent(Angle angle,
                              double tolerance)

Is this angle equivalent to the given angle within the given tolerance.

Parameters:
  `angle` - angle to test for equivalence.
  `tolerance` - the tolerance value to test with. Specified in degrees.
Returns:
  true if equivalent within tolerance, false otherwise.

#### convert

    public static Length convert(Angle angle)

Convert the given angle to an approximated equivalent linear distance.

Note: this method treats the input angle as a measure along a Great Circle of the earth and uses the conversion constant:

1 Great Circle degree = 111194.87428 meter

The meaning of the input angle determines whether this conversion produces a reasonable result.

Parameters:
  `angle` - an angle
Returns:
  input angle converted to linear measure using the described conversion assumptions.

#### equals

    public boolean equals(Object o)

Equals implementation.

Overrides:
  `equals` in class `Object`
Parameters:
  `o` - The object to test for equality.
Returns:
  TRUE if this object equals the parameter object.

#### hashCode

    public int hashCode()

Hashcode implementation.

Overrides:
  `hashCode` in class `Object`
Returns:
  The hashCode for this object.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`