Package org.apache.commons.numbers.angle
Class Angle
java.lang.Object
org.apache.commons.numbers.angle.Angle
- All Implemented Interfaces:
DoubleSupplier
- Direct Known Subclasses:
Angle.Deg
,Angle.Rad
,Angle.Turn
Represents the angle concept.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
Degrees to radians conversion factor.static final double
π/2.private static final double
Radians to degrees conversion factor.private static final double
Turns to degrees conversion factor.static final double
2π.private final double
Value (unit depends on concrete instance). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Test for equality with another object.double
int
hashCode()
abstract Angle.Deg
toDeg()
Convert to aAngle.Deg
.abstract Angle.Rad
toRad()
Convert to aAngle.Rad
.abstract Angle.Turn
toTurn()
Convert to aAngle.Turn
.
-
Field Details
-
TWO_PI
public static final double TWO_PI2π.- See Also:
-
PI_OVER_TWO
public static final double PI_OVER_TWOπ/2.- See Also:
-
TURN_TO_DEG
private static final double TURN_TO_DEGTurns to degrees conversion factor.- See Also:
-
RAD_TO_DEG
private static final double RAD_TO_DEGRadians to degrees conversion factor.- See Also:
-
DEG_TO_RAD
private static final double DEG_TO_RADDegrees to radians conversion factor.- See Also:
-
value
private final double valueValue (unit depends on concrete instance).
-
-
Constructor Details
-
Angle
Angle(double value) - Parameters:
value
- Value in turns.
-
-
Method Details
-
getAsDouble
public double getAsDouble()- Specified by:
getAsDouble
in interfaceDoubleSupplier
- Returns:
- the value.
-
hashCode
public int hashCode() -
equals
Test for equality with another object. Objects are considered to be equal if their concrete types are equal and their values are exactly the same (or both areDouble.NaN
). -
toTurn
Convert to aAngle.Turn
.- Returns:
- the angle in turns.
-
toRad
Convert to aAngle.Rad
.- Returns:
- the angle in radians.
-
toDeg
Convert to aAngle.Deg
.- Returns:
- the angle in degrees.
-