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
static final @AngleDegreesFloat @FloatRange(from = -180.0, to = 180.0, fromInclusive = false) float

Returns the equivalent angle in degrees in the range (-180, 180].

static final @AngleRadiansFloat @FloatRange(from = -3.141592653589793, to = 3.141592653589793, fromInclusive = false) float

Returns the equivalent angle in radians in the range (-π, π].

static final @AngleDegreesFloat @FloatRange(from = 0.0, to = 360.0, toInclusive = false) float

Returns the equivalent angle in degrees in the range [0, 360).

static final @AngleRadiansFloat @FloatRange(from = 0.0, to = 6.283185307179586, toInclusive = false) float

Returns the equivalent angle in radians in the range [0, 2π).

static final @AngleDegreesFloat float

Public fields

FULL_TURN_DEGREES

Added in 1.0.0-alpha07
public static final @AngleDegreesFloat float FULL_TURN_DEGREES

Angle of 360 degrees (2*PI radians).

FULL_TURN_RADIANS

Added in 1.0.0-alpha07
public static final @AngleRadiansFloat float FULL_TURN_RADIANS

Angle of 2*PI radians (360 degrees)

HALF_TURN_DEGREES

Added in 1.0.0-alpha07
public static final @AngleDegreesFloat float HALF_TURN_DEGREES

Angle 180 degrees (PI radians).

HALF_TURN_RADIANS

Added in 1.0.0-alpha07
public static final @AngleRadiansFloat float HALF_TURN_RADIANS

Angle of PI radians (180 degrees).

INSTANCE

Added in 1.0.0-alpha07
public static @NonNull Angle INSTANCE

QUARTER_TURN_DEGREES

Added in 1.0.0-alpha07
public static final @AngleDegreesFloat float QUARTER_TURN_DEGREES

Angle of 90 degrees (PI/2 radians).

QUARTER_TURN_RADIANS

Added in 1.0.0-alpha07
public static final @AngleRadiansFloat float QUARTER_TURN_RADIANS

Angle of PI/2 radians (90 degrees).

ZERO_DEGREES

Added in 1.0.0-alpha07
public static final @AngleDegreesFloat float ZERO_DEGREES

Angle of zero (also 0 radians, but this is annotated as degrees).

ZERO_RADIANS

Added in 1.0.0-alpha07
public static final @AngleRadiansFloat float ZERO_RADIANS

Angle of zero (also 0 degrees, but this is annotated as radians).

Public methods

degreesToRadians

Added in 1.0.0-alpha07
public static final @AngleRadiansFloat float degreesToRadians(@AngleDegreesFloat float degrees)

normalizedAboutZeroDegrees

Added in 1.0.0-alpha07
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

Added in 1.0.0-alpha07
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

Added in 1.0.0-alpha07
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

Added in 1.0.0-alpha07
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

Added in 1.0.0-alpha07
public static final @AngleDegreesFloat float radiansToDegrees(@AngleRadiansFloat float radians)