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 functions

@AngleRadiansFloat Float
android
@AngleDegreesFloat @FloatRange(from = -180.0, to = 180.0, fromInclusive = false) Float

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

android
@AngleRadiansFloat @FloatRange(from = -3.141592653589793, to = 3.141592653589793, fromInclusive = false) Float

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

android
@AngleDegreesFloat @FloatRange(from = 0.0, to = 360.0, toInclusive = false) Float

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

android
@AngleRadiansFloat @FloatRange(from = 0.0, to = 6.283185307179586, toInclusive = false) Float

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

android
@AngleDegreesFloat Float
android

Public properties

@AngleDegreesFloat Float

Angle of 360 degrees (2*PI radians).

android
@AngleRadiansFloat Float

Angle of 2*PI radians (360 degrees)

android
@AngleDegreesFloat Float

Angle 180 degrees (PI radians).

android
@AngleRadiansFloat Float

Angle of PI radians (180 degrees).

android
@AngleDegreesFloat Float

Angle of 90 degrees (PI/2 radians).

android
@AngleRadiansFloat Float

Angle of PI/2 radians (90 degrees).

android
@AngleDegreesFloat Float

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

android
@AngleRadiansFloat Float

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

android

Public functions

degreesToRadians

fun degreesToRadians(degrees: @AngleDegreesFloat Float): @AngleRadiansFloat Float

normalizedAboutZeroDegrees

fun normalizedAboutZeroDegrees(degrees: @AngleDegreesFloat Float): @AngleDegreesFloat @FloatRange(from = -180.0, to = 180.0, fromInclusive = false) Float

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

normalizedAboutZeroRadians

fun normalizedAboutZeroRadians(radians: @AngleRadiansFloat Float): @AngleRadiansFloat @FloatRange(from = -3.141592653589793, to = 3.141592653589793, fromInclusive = false) Float

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

normalizedDegrees

fun normalizedDegrees(degrees: @AngleDegreesFloat Float): @AngleDegreesFloat @FloatRange(from = 0.0, to = 360.0, toInclusive = false) Float

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

normalizedRadians

fun normalizedRadians(radians: @AngleRadiansFloat Float): @AngleRadiansFloat @FloatRange(from = 0.0, to = 6.283185307179586, toInclusive = false) Float

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

radiansToDegrees

fun radiansToDegrees(radians: @AngleRadiansFloat Float): @AngleDegreesFloat Float

Public properties

FULL_TURN_DEGREES

val FULL_TURN_DEGREES: @AngleDegreesFloat Float

Angle of 360 degrees (2*PI radians).

FULL_TURN_RADIANS

val FULL_TURN_RADIANS: @AngleRadiansFloat Float

Angle of 2*PI radians (360 degrees)

HALF_TURN_DEGREES

val HALF_TURN_DEGREES: @AngleDegreesFloat Float

Angle 180 degrees (PI radians).

HALF_TURN_RADIANS

val HALF_TURN_RADIANS: @AngleRadiansFloat Float

Angle of PI radians (180 degrees).

QUARTER_TURN_DEGREES

val QUARTER_TURN_DEGREES: @AngleDegreesFloat Float

Angle of 90 degrees (PI/2 radians).

QUARTER_TURN_RADIANS

val QUARTER_TURN_RADIANS: @AngleRadiansFloat Float

Angle of PI/2 radians (90 degrees).

ZERO_DEGREES

val ZERO_DEGREES: @AngleDegreesFloat Float

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

ZERO_RADIANS

val ZERO_RADIANS: @AngleRadiansFloat Float

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