NASA World Wind
gov.nasa.worldwind.geom

Class Angle

• Field Summary

Fields
Modifier and Type Field and Description
`static String` `ANGLE_FORMAT_DD`
`static String` `ANGLE_FORMAT_DM`
`static String` `ANGLE_FORMAT_DMS`
`double` `degrees`
`static Angle` `MINUTE`
Represents an angle of 1 minute
`static Angle` `NEG180`
Represents an angle of negative 180 degrees
`static Angle` `NEG360`
Represents an angle of negative 360 degrees
`static Angle` `NEG90`
Represents a right angle of negative 90 degrees
`static Angle` `POS180`
Represents an angle of positive 180 degrees
`static Angle` `POS360`
Represents an angle of positive 360 degrees
`static Angle` `POS90`
Represents a right angle of positive 90 degrees
`double` `radians`
`static Angle` `SECOND`
Represents an angle of 1 second
`static Angle` `ZERO`
Represents an angle of zero degrees
• Constructor Summary

Constructors
Constructor and Description
`Angle(Angle angle)`
• Method Summary

All Methods
Modifier and Type Method and Description
`static Angle` `acos(double cosine)`
`Angle` `add(Angle angle)`
Obtains the sum of these two angles.
`Angle` `addDegrees(double degrees)`
`Angle` `addRadians(double radians)`
`Angle` `angularDistanceTo(Angle angle)`
Computes the shortest distance between this and angle, as an angle.
`static double` `arctanh(double radians)`
`static Angle` `asin(double sine)`
`static Angle` `atan(double tan)`
`static Angle` ```average(Angle a, Angle b)```
Obtains the average of three angles.
`static Angle` ```average(Angle a, Angle b, Angle c)```
Obtains the average of three angles.
`static Angle` ```clamp(Angle value, Angle min, Angle max)```
Limits a specified angle to be within a specified minimum and maximum.
`int` `compareTo(Angle angle)`
Compares this `Angle` with another.
`double` `cos()`
Obtains the cosine of this angle.
`double` `cosHalfAngle()`
`static boolean` ```crossesLongitudeBoundary(Angle angleA, Angle angleB)```
`double` `divide(Angle angle)`
Divides this angle by another angle.
`Angle` `divide(double divisor)`
Divides this angle by `divisor`.
`boolean` `equals(Object o)`
`static Angle` `fromDegrees(double degrees)`
Obtains an angle from a specified number of degrees.
`static Angle` `fromDegreesLatitude(double degrees)`
`static Angle` `fromDegreesLongitude(double degrees)`
`static Angle` ```fromDMdS(int degrees, double minutes)```
`static Angle` ```fromDMS(int degrees, int minutes, int seconds)```
Obtain an angle from a given number of degrees, minutes and seconds.
`static Angle` `fromDMS(String dmsString)`
Obtain an angle from a degrees, minute and seconds character string.
`static Angle` `fromRadians(double radians)`
Obtains an angle from a specified number of radians.
`static Angle` `fromRadiansLatitude(double radians)`
`static Angle` `fromRadiansLongitude(double radians)`
`static Angle` ```fromXY(double x, double y)```
Obtains an angle from rectangular coordinates.
`double` `getDegrees()`
Retrieves the size of this angle in degrees.
`double` `getRadians()`
Retrieves the size of this angle in radians.
`long` `getSizeInBytes()`
Obtains the amount of memory this `Angle` consumes.
`int` `hashCode()`
`static boolean` `isValidLatitude(double value)`
`static boolean` `isValidLongitude(double value)`
`static Angle` ```max(Angle a, Angle b)```
`static Angle` ```midAngle(Angle a1, Angle a2)```
Obtains the average of two angles.
`static Angle` ```min(Angle a, Angle b)```
`static Angle` ```mix(double amount, Angle value1, Angle value2)```
Linearly interpolates between two angles.
`Angle` `multiply(double multiplier)`
Multiplies this angle by `multiplier`.
`Angle` `normalize()`
`static Angle` `normalizedAngle(Angle unnormalizedAngle)`
`static double` `normalizedDegrees(double degrees)`
`static double` `normalizedDegreesLatitude(double degrees)`
`static double` `normalizedDegreesLongitude(double degrees)`
`Angle` `normalizedLatitude()`
`static Angle` `normalizedLatitude(Angle unnormalizedAngle)`
`Angle` `normalizedLongitude()`
`static Angle` `normalizedLongitude(Angle unnormalizedAngle)`
`double` `sin()`
Obtains the sine of this angle.
`double` `sinHalfAngle()`
`Angle` `subtract(Angle angle)`
Obtains the difference of these two angles.
`Angle` `subtractDegrees(double degrees)`
`Angle` `subtractRadians(double radians)`
`double` `tanHalfAngle()`
Obtains the tangent of half of this angle.
`String` `toDecimalDegreesString(int digits)`
Forms a decimal degrees `String` representation of this `Angle`.
`double[]` `toDMS()`
`String` `toDMSString()`
Obtains a `String` representation of this `Angle` formatted as degrees, minutes and seconds integer values.
`String` `toDMString()`
Obtains a `String` representation of this `Angle` formatted as degrees and decimal minutes.
`String` `toFormattedDMSString()`
`String` `toString()`
Obtains a `String` representation of this angle.
• Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• Field Detail

• ANGLE_FORMAT_DD

`public static final String ANGLE_FORMAT_DD`
Constant Field Values
• ANGLE_FORMAT_DM

`public static final String ANGLE_FORMAT_DM`
Constant Field Values
• ANGLE_FORMAT_DMS

`public static final String ANGLE_FORMAT_DMS`
Constant Field Values
• degrees

`public final double degrees`
• MINUTE

`public static final Angle MINUTE`
Represents an angle of 1 minute
• NEG180

`public static final Angle NEG180`
Represents an angle of negative 180 degrees
• NEG360

`public static final Angle NEG360`
Represents an angle of negative 360 degrees
• NEG90

`public static final Angle NEG90`
Represents a right angle of negative 90 degrees
• POS180

`public static final Angle POS180`
Represents an angle of positive 180 degrees
• POS360

`public static final Angle POS360`
Represents an angle of positive 360 degrees
• POS90

`public static final Angle POS90`
Represents a right angle of positive 90 degrees

`public final double radians`
• SECOND

`public static final Angle SECOND`
Represents an angle of 1 second
• ZERO

`public static final Angle ZERO`
Represents an angle of zero degrees
• Constructor Detail

• Angle

`public Angle(Angle angle)`
• Method Detail

• acos

`public static Angle acos(double cosine)`

`public final Angle add(Angle angle)`
Obtains the sum of these two angles. Does not accept a null argument. This method is commutative, so `a.add(b)` and `b.add(a)` are equivalent. Neither this angle nor angle is changed, instead the result is returned as a new angle.
Parameters:
`angle` - the angle to add to this one.
Returns:
an angle whose size is the total of this angles and angles size.
Throws:
`IllegalArgumentException` - if angle is null.

`public final Angle addDegrees(double degrees)`

`public final Angle addRadians(double radians)`
• angularDistanceTo

`public Angle angularDistanceTo(Angle angle)`
Computes the shortest distance between this and angle, as an angle.
Parameters:
`angle` - the angle to measure angular distance to.
Returns:
the angular distance between this and `value`.
• arctanh

`public static double arctanh(double radians)`
• asin

`public static Angle asin(double sine)`
• atan

`public static Angle atan(double tan)`
• average

```public static Angle average(Angle a,
Angle b)```
Obtains the average of three angles. The order of parameters does not matter.
Parameters:
`a` - the first angle.
`b` - the second angle.
Returns:
the average of `a1`, `a2` and `a3`
Throws:
`IllegalArgumentException` - if `a` or `b` is null
• average

```public static Angle average(Angle a,
Angle b,
Angle c)```
Obtains the average of three angles. The order of parameters does not matter.
Parameters:
`a` - the first angle.
`b` - the second angle.
`c` - the third angle.
Returns:
the average of `a1`, `a2` and `a3`.
Throws:
`IllegalArgumentException` - if `a`, `b` or `c` is null.
• clamp

```public static Angle clamp(Angle value,
Angle min,
Angle max)```
Limits a specified angle to be within a specified minimum and maximum.

The returned angle is undefined if min > max. Otherwise, this method's return value is equivalent to the following:

• min - If value < min
• max - If value > max
• value - If min <= value <= max
Parameters:
`value` - The angle to clamp.
`min` - The minimum angle to clamp to.
`max` - The maximum angle to clamp to.
Returns:
The clamped angle.
Throws:
`IllegalArgumentException` - if any argument is null.
• compareTo

`public final int compareTo(Angle angle)`
Compares this `Angle` with another. Returns a negative integer if this is the smaller angle, a positive integer if this is the larger, and zero if both angles are equal.
Specified by:
`compareTo` in interface `Comparable<Angle>`
Parameters:
`angle` - the angle to compare against.
Returns:
-1 if this angle is smaller, 0 if both are equal and +1 if this angle is larger.
Throws:
`IllegalArgumentException` - if angle is null.
• cos

`public final double cos()`
Obtains the cosine of this angle.
Returns:
the trigonometric cosine of this angle.
• cosHalfAngle

`public final double cosHalfAngle()`
• crossesLongitudeBoundary

```public static boolean crossesLongitudeBoundary(Angle angleA,
Angle angleB)```
• divide

`public final double divide(Angle angle)`
Divides this angle by another angle. This angle remains unchanged, instead the resulting value in degrees is returned.
Parameters:
`angle` - the angle by which to divide.
Returns:
this angle's degrees divided by angle's degrees.
Throws:
`IllegalArgumentException` - if angle is null.
• divide

`public final Angle divide(double divisor)`
Divides this angle by `divisor`. This angle remains unchanged. The result is returned as a new angle. Behaviour is undefined if `divisor` equals zero.
Parameters:
`divisor` - the number to be divided by.
Returns:
a new angle equivalent to this angle divided by `divisor`.
• equals

`public boolean equals(Object o)`
Overrides:
`equals` in class `Object`
• fromDegrees

`public static Angle fromDegrees(double degrees)`
Obtains an angle from a specified number of degrees.
Parameters:
`degrees` - the size in degrees of the angle to be obtained
Returns:
a new angle, whose size in degrees is given by `degrees`
• fromDegreesLatitude

`public static Angle fromDegreesLatitude(double degrees)`
• fromDegreesLongitude

`public static Angle fromDegreesLongitude(double degrees)`
• fromDMdS

```public static Angle fromDMdS(int degrees,
double minutes)```
• fromDMS

```public static Angle fromDMS(int degrees,
int minutes,
int seconds)```
Obtain an angle from a given number of degrees, minutes and seconds.
Parameters:
`degrees` - integer number of degrees, positive.
`minutes` - integer number of minutes, positive only between 0 and 60.
`seconds` - integer number of seconds, positive only between 0 and 60.
Returns:
a new angle whose size in degrees is given by `degrees`, `minutes` and `seconds`.
Throws:
`IllegalArgumentException` - if minutes or seconds are outside the 0-60 range.
• fromDMS

`public static Angle fromDMS(String dmsString)`
Obtain an angle from a degrees, minute and seconds character string.

eg:

``` 123 34 42
-123* 34' 42" (where * stands for the degree symbol)
+45* 12' 30" (where * stands for the degree symbol)
45 12 30 S
45 12 30 N
```
Parameters:
`dmsString` - the degrees, minute and second character string.
Returns:
the corresponding angle.
Throws:
`IllegalArgumentException` - if dmsString is null or not properly formated.

`public static Angle fromRadians(double radians)`
Obtains an angle from a specified number of radians.
Parameters:
`radians` - the size in radians of the angle to be obtained.
Returns:
a new angle, whose size in radians is given by `radians`.

`public static Angle fromRadiansLatitude(double radians)`

`public static Angle fromRadiansLongitude(double radians)`
• fromXY

```public static Angle fromXY(double x,
double y)```
Obtains an angle from rectangular coordinates.
Parameters:
`x` - the abscissa coordinate.
`y` - the ordinate coordinate.
Returns:
a new angle, whose size is determined from `x` and `y`.
• getDegrees

`public final double getDegrees()`
Retrieves the size of this angle in degrees. This method may be faster than first obtaining the radians and then converting to degrees.
Returns:
the size of this angle in degrees.

`public final double getRadians()`
Retrieves the size of this angle in radians. This may be useful for `java.lang.Math` functions, which generally take radians as trigonometric arguments. This method may be faster that first obtaining the degrees and then converting to radians.
Returns:
the size of this angle in radians.
• getSizeInBytes

`public long getSizeInBytes()`
Obtains the amount of memory this `Angle` consumes.
Returns:
the memory footprint of this angle in bytes.
• hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• isValidLatitude

`public static boolean isValidLatitude(double value)`
• isValidLongitude

`public static boolean isValidLongitude(double value)`
• max

```public static Angle max(Angle a,
Angle b)```
• midAngle

```public static Angle midAngle(Angle a1,
Angle a2)```
Obtains the average of two angles. This method is commutative, so `midAngle(m, n)` and `midAngle(n, m)` are equivalent.
Parameters:
`a1` - the first angle.
`a2` - the second angle.
Returns:
the average of `a1` and `a2` throws IllegalArgumentException if either angle is null.
• min

```public static Angle min(Angle a,
Angle b)```
• mix

```public static Angle mix(double amount,
Angle value1,
Angle value2)```
Linearly interpolates between two angles.
Parameters:
`amount` - the interpolant.
`value1` - the first angle.
`value2` - the second angle.
Returns:
a new angle between `value1` and `value2`.
• multiply

`public final Angle multiply(double multiplier)`
Multiplies this angle by `multiplier`. This angle remains unchanged. The result is returned as a new angle.
Parameters:
`multiplier` - a scalar by which this angle is multiplied.
Returns:
a new angle whose size equals this angle's size multiplied by `multiplier`.
• normalize

`public Angle normalize()`
• normalizedAngle

`public static Angle normalizedAngle(Angle unnormalizedAngle)`
• normalizedDegrees

`public static double normalizedDegrees(double degrees)`
• normalizedDegreesLatitude

`public static double normalizedDegreesLatitude(double degrees)`
• normalizedDegreesLongitude

`public static double normalizedDegreesLongitude(double degrees)`
• normalizedLatitude

`public Angle normalizedLatitude()`
• normalizedLatitude

`public static Angle normalizedLatitude(Angle unnormalizedAngle)`
• normalizedLongitude

`public Angle normalizedLongitude()`
• normalizedLongitude

`public static Angle normalizedLongitude(Angle unnormalizedAngle)`
• sin

`public final double sin()`
Obtains the sine of this angle.
Returns:
the trigonometric sine of this angle.
• sinHalfAngle

`public final double sinHalfAngle()`
• subtract

`public final Angle subtract(Angle angle)`
Obtains the difference of these two angles. Does not accept a null argument. This method is not commutative. Neither this angle nor angle is changed, instead the result is returned as a new angle.
Parameters:
`angle` - the angle to subtract from this angle.
Returns:
a new angle corresponding to this angle's size minus angle's size.
Throws:
`IllegalArgumentException` - if angle is null.
• subtractDegrees

`public final Angle subtractDegrees(double degrees)`

`public final Angle subtractRadians(double radians)`
• tanHalfAngle

`public final double tanHalfAngle()`
Obtains the tangent of half of this angle.
Returns:
the trigonometric tangent of half of this angle.
• toDecimalDegreesString

`public final String toDecimalDegreesString(int digits)`
Forms a decimal degrees `String` representation of this `Angle`.
Parameters:
`digits` - the number of digits past the decimal point to include in the string.
Returns:
the value of this angle in decimal degrees as a string with the specified number of digits beyond the decimal point. The string is padded with trailing zeros to fill the number of post-decimal point positions requested.
• toDMS

`public final double[] toDMS()`
• toDMSString

`public final String toDMSString()`
Obtains a `String` representation of this `Angle` formatted as degrees, minutes and seconds integer values.
Returns:
the value of this angle in degrees, minutes, seconds as a string.
• toDMString

`public final String toDMString()`
Obtains a `String` representation of this `Angle` formatted as degrees and decimal minutes.
Returns:
the value of this angle in degrees and decimal minutes as a string.
• toFormattedDMSString

`public final String toFormattedDMSString()`
• toString

`public final String toString()`
Obtains a `String` representation of this angle.
Overrides:
`toString` in class `Object`
Returns:
the value of this angle in degrees and as a `String`.