Angle

Represents an Angle, ratio is in 0, 1 range, radians is in 0, 2PI range, and degrees in 0, 360 range The internal representation is in 0, 1 range to reduce rounding errors, since floating points can represent a lot of values in that range.

The equivalent old Angle constructor is now Angle.fromRadians

Angles advance counter-clock-wise, starting with 0.degrees representing the right vector:

Depending on what the up vector means, then numeric values of sin might be negated.

0.degrees represent right: up=Vector2.UP: cos =+1, sin= 0 || up=Vector2.UP_SCREEN: cos =+1, sin= 0 90.degrees represents up: up=Vector2.UP: cos = 0, sin=+1 || up=Vector2.UP_SCREEN: cos = 0, sin=-1 180.degrees represents left: up=Vector2.UP: cos =-1, sin= 0 || up=Vector2.UP_SCREEN: cos =-1, sin= 0 270.degrees represents down: up=Vector2.UP: cos = 0, sin=-1 || up=Vector2.UP_SCREEN: cos = 0, sin=+1

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

0..360 degrees ->0..PI * 2 radians ->0..1 ratio

Link copied to clipboard

Normalize between 0..1 ... 0..(PI*2).radians ... 0..360.degrees

Link copied to clipboard

Normalize between -.5..+.5 ... -PI..+PI.radians ... -180..+180.degrees

Link copied to clipboard

0..1 ratio ->0..360 degrees

Link copied to clipboard

0..PI * 2 radians ->0..360 degrees

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun Angle.clamp(min: Angle, max: Angle): Angle
Link copied to clipboard
open operator override fun compareTo(other: Angle): Int
Link copied to clipboard
fun cosine(up: Vector2D = Vector2D.UP): Double
Link copied to clipboard
operator fun div(other: Angle): Double
operator fun div(scale: Double): Angle
operator fun div(scale: Float): Angle
operator fun div(scale: Int): Angle
Link copied to clipboard
infix fun inBetween(range: OpenRange<Angle>): Boolean
infix fun inBetween(range: ClosedRange<Angle>): Boolean
fun inBetween(min: Angle, max: Angle, inclusive: Boolean): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun isAlmostEquals(other: Angle, epsilon: Double): Boolean
Link copied to clipboard
fun isAlmostZero(epsilon: Double = 0.001): Boolean
Link copied to clipboard
Link copied to clipboard
operator fun minus(other: Angle): Angle
Link copied to clipboard
operator fun plus(other: Angle): Angle
Link copied to clipboard
operator fun rem(angle: Angle): Angle
Link copied to clipboard
Link copied to clipboard
fun sine(up: Vector2D = Vector2D.UP): Double
Link copied to clipboard
fun tangent(up: Vector2D = Vector2D.UP): Double
Link copied to clipboard
operator fun times(scale: Double): Angle
operator fun times(scale: Float): Angle
operator fun times(scale: Int): Angle
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
infix fun umod(angle: Angle): Angle
Link copied to clipboard
operator fun unaryMinus(): Angle
Link copied to clipboard
operator fun unaryPlus(): Angle
Link copied to clipboard
infix fun Angle.until(other: Angle): OpenRange<Angle>