Package com.luciad.cartesian
Class Angle
java.lang.Object
com.luciad.cartesian.Angle
An angle on a mathematical circle: degrees, counter-clockwise from right/X-axis.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the different angular directions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic AnglefromRadians(double radians) Creates an Angle from an angle value in radians.doubleReturns the value in degrees constrained between[0, 360].doubleReturns the value in radians constrained between[0, 2*PI]inthashCode()Subtracts another angle from the angle and normalizes the result between 0 and 360 degrees.static doublenormalize(double degrees) Normalizes the degree value to the range]-180, +180].Adds the angle to another angle and normalizes the result between 0 and 360 degrees.Converts the angle to an Azimuth.
-
Constructor Details
-
Angle
Creates an angle based on the given angular value in degrees.- Parameters:
degrees- an angle in degree- Throws:
IllegalArgumentException- when degrees is NaN or infinite.
-
Angle
Creates an angle based on another angle.- Parameters:
angle- an angle.
-
-
Method Details
-
normalize
public static double normalize(double degrees) Normalizes the degree value to the range]-180, +180].- Parameters:
degrees- a value in degrees- Returns:
- a degrees value, normalized to
]-180, +180].
-
fromRadians
Creates an Angle from an angle value in radians.- Parameters:
radians- an angle in radians- Returns:
- a new angle based on the given angle in radians
- Throws:
IllegalArgumentException- when radians is NaN or infinite.
-
getDegrees
public double getDegrees()Returns the value in degrees constrained between[0, 360].- Returns:
- the value in degrees constrained between
[0, 360].
-
getRadians
public double getRadians()Returns the value in radians constrained between[0, 2*PI]- Returns:
- the value in radians constrained between
[0, 2*PI].
-
toAzimuth
Converts the angle to an Azimuth.- Returns:
- the result of the convertion.
-
plus
Adds the angle to another angle and normalizes the result between 0 and 360 degrees.- Parameters:
other- the other angle.- Returns:
- the sum of the two angles.
-
minus
Subtracts another angle from the angle and normalizes the result between 0 and 360 degrees.- Parameters:
other- the other angle.- Returns:
- the result of the subtraction.
-
equals
-
hashCode
public int hashCode()
-