Angle
public static class Angle
A utility for working with a signed angle. A positive value represents rotation from the positive x-axis to the positive y-axis. Angle functions manage the conversion of angle values in degrees and radians. Most of Strokes API requires angle values in radians.
Summary
Public fields |
|
|---|---|
static final @AngleDegreesFloat float |
Angle of 360 degrees (2*PI radians). |
static final @AngleRadiansFloat float |
Angle of 2*PI radians (360 degrees) |
static final @AngleDegreesFloat float |
Angle 180 degrees (PI radians). |
static final @AngleRadiansFloat float |
Angle of PI radians (180 degrees). |
static @NonNull Angle |
|
static final @AngleDegreesFloat float |
Angle of 90 degrees (PI/2 radians). |
static final @AngleRadiansFloat float |
Angle of PI/2 radians (90 degrees). |
static final @AngleDegreesFloat float |
Angle of zero (also 0 radians, but this is annotated as degrees). |
static final @AngleRadiansFloat float |
Angle of zero (also 0 degrees, but this is annotated as radians). |
Public methods |
|
|---|---|
static final @AngleRadiansFloat float |
degreesToRadians(@AngleDegreesFloat float degrees) |
static final @AngleDegreesFloat @FloatRange(from = -180.0, to = 180.0, fromInclusive = false) float |
normalizedAboutZeroDegrees(@AngleDegreesFloat float degrees)Returns the equivalent angle in degrees in the range (-180, 180]. |
static final @AngleRadiansFloat @FloatRange(from = -3.141592653589793, to = 3.141592653589793, fromInclusive = false) float |
normalizedAboutZeroRadians(@AngleRadiansFloat float radians)Returns the equivalent angle in radians in the range (-π, π]. |
static final @AngleDegreesFloat @FloatRange(from = 0.0, to = 360.0, toInclusive = false) float |
normalizedDegrees(@AngleDegreesFloat float degrees)Returns the equivalent angle in degrees in the range [0, 360). |
static final @AngleRadiansFloat @FloatRange(from = 0.0, to = 6.283185307179586, toInclusive = false) float |
normalizedRadians(@AngleRadiansFloat float radians)Returns the equivalent angle in radians in the range [0, 2π). |
static final @AngleDegreesFloat float |
radiansToDegrees(@AngleRadiansFloat float radians) |
Public fields
FULL_TURN_DEGREES
public static final @AngleDegreesFloat float FULL_TURN_DEGREES
Angle of 360 degrees (2*PI radians).
FULL_TURN_RADIANS
public static final @AngleRadiansFloat float FULL_TURN_RADIANS
Angle of 2*PI radians (360 degrees)
HALF_TURN_DEGREES
public static final @AngleDegreesFloat float HALF_TURN_DEGREES
Angle 180 degrees (PI radians).
HALF_TURN_RADIANS
public static final @AngleRadiansFloat float HALF_TURN_RADIANS
Angle of PI radians (180 degrees).
QUARTER_TURN_DEGREES
public static final @AngleDegreesFloat float QUARTER_TURN_DEGREES
Angle of 90 degrees (PI/2 radians).
QUARTER_TURN_RADIANS
public static final @AngleRadiansFloat float QUARTER_TURN_RADIANS
Angle of PI/2 radians (90 degrees).
ZERO_DEGREES
public static final @AngleDegreesFloat float ZERO_DEGREES
Angle of zero (also 0 radians, but this is annotated as degrees).
ZERO_RADIANS
public static final @AngleRadiansFloat float ZERO_RADIANS
Angle of zero (also 0 degrees, but this is annotated as radians).
Public methods
degreesToRadians
public static final @AngleRadiansFloat float degreesToRadians(@AngleDegreesFloat float degrees)
normalizedAboutZeroDegrees
public static final @AngleDegreesFloat @FloatRange(from = -180.0, to = 180.0, fromInclusive = false) float normalizedAboutZeroDegrees(@AngleDegreesFloat float degrees)
Returns the equivalent angle in degrees in the range (-180, 180].
normalizedAboutZeroRadians
public static final @AngleRadiansFloat @FloatRange(from = -3.141592653589793, to = 3.141592653589793, fromInclusive = false) float normalizedAboutZeroRadians(@AngleRadiansFloat float radians)
Returns the equivalent angle in radians in the range (-π, π].
normalizedDegrees
public static final @AngleDegreesFloat @FloatRange(from = 0.0, to = 360.0, toInclusive = false) float normalizedDegrees(@AngleDegreesFloat float degrees)
Returns the equivalent angle in degrees in the range [0, 360).
normalizedRadians
public static final @AngleRadiansFloat @FloatRange(from = 0.0, to = 6.283185307179586, toInclusive = false) float normalizedRadians(@AngleRadiansFloat float radians)
Returns the equivalent angle in radians in the range [0, 2π).
radiansToDegrees
public static final @AngleDegreesFloat float radiansToDegrees(@AngleRadiansFloat float radians)