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 doubleDegrees to radians conversion factor.static final doubleπ/2.private static final doubleRadians to degrees conversion factor.private static final doubleTurns to degrees conversion factor.static final double2π.private final doubleValue (unit depends on concrete instance). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest for equality with another object.doubleinthashCode()abstract Angle.DegtoDeg()Convert to aAngle.Deg.abstract Angle.RadtoRad()Convert to aAngle.Rad.abstract Angle.TurntoTurn()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:
getAsDoublein 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.
-