Rotation

Represents a magnitude of angular displacement, internally stored as a Double of degrees. It may be greater than a full turn (360 degrees).

This representation does not define whether positive rotations are clockwise or anticlockwise, as that depends on axis of rotation (and the observer's frame of reference in space).

Most arithmetic operations are supported, and will automatically result in a Rotation or Bearing depending on the operation.

See also

Types

Link copied to clipboard
object Companion

Companion object containing predefined rotation values.

Properties

Link copied to clipboard

Returns the absolute value of this rotation.

Link copied to clipboard

Returns this Rotation as a scalar value in arc minutes.

Link copied to clipboard

Returns this Rotation as a scalar value in arc seconds.

Link copied to clipboard

Returns this Rotation as a scalar value in degrees.

Link copied to clipboard

Returns this Rotation as a scalar value in gradians.

Link copied to clipboard

Returns this Rotation as a scalar value in radians.

Link copied to clipboard

Returns true if this rotation is finite (not infinite).

Link copied to clipboard

Returns true if this rotation is infinite (positive or negative).

Link copied to clipboard

Returns true if this rotation is less than zero.

Link copied to clipboard

Returns true if this rotation is greater than zero.

Link copied to clipboard

Returns true if this rotation is equal to zero.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Rotation): Int
Link copied to clipboard
operator fun div(other: Double): Rotation

Divides this rotation by a scalar value.

operator fun div(other: Rotation): Double

Divides this rotation by another rotation, resulting in a dimensionless scalar.

Link copied to clipboard
operator fun minus(other: Rotation): Rotation

Subtracts another rotation from this rotation.

Link copied to clipboard
fun mod(other: Rotation): Rotation

Returns the modulo of this rotation with respect to another rotation.

Link copied to clipboard
operator fun plus(other: Bearing): Bearing

Adds this Rotation to a Bearing.

operator fun plus(other: Rotation): Rotation

Adds another rotation to this rotation.

Link copied to clipboard
operator fun rem(other: Rotation): Rotation

Returns the remainder of dividing this rotation by another rotation.

Link copied to clipboard

Rounds this rotation to an Int value in the specified unit.

Link copied to clipboard

Rounds this rotation to a Long value in the specified unit.

Link copied to clipboard
operator fun times(other: Double): Rotation

Multiplies this rotation by a scalar value.

Link copied to clipboard
fun toDmsString(decimalPlaces: Int = 2): String

Format this Rotation as Degrees, ArcMinutes, and ArcSeconds components.

Link copied to clipboard

Converts this rotation to a Double value in the specified unit.

Link copied to clipboard

Converts this rotation to a Float value in the specified unit.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of this rotation in degrees.

fun toString(unit: RotationUnit = Radians, decimalPlaces: Int = 2): String

Returns a formatted string representation of this rotation.

Link copied to clipboard
operator fun unaryMinus(): Rotation

Returns the negation of this rotation.

Link copied to clipboard
operator fun unaryPlus(): Rotation

Returns this rotation unchanged.