Angle

value class Angle(val radians: Double) : Comparable<Angle>

An angle, its unit spelled at the call site: 90.deg, 0.8.rad.

The type exists so an API taking an angle never accepts a bare Double of ambiguous unit. Deliberately no trigonometry — read radians at use sites (sin(angle.radians)). Arithmetic, comparison, and equality are all raw, with no wrapping and no SCALE rounding — an angle is a parameter, not a stored CGA component — so a sum past a full turn keeps its face value and 370.deg > 10.deg holds. canonical wraps a value to its single-turn representative, and the module-level round function makes identity decisions over angles just as it does over raw components.

Constructors

Link copied to clipboard
constructor(radians: Double)

Wraps the raw radian value — no normalization, no validation.

Properties

Link copied to clipboard

The equivalent angle wrapped to a single turn — the representative in (−180°, 180°], so (-270).deg.canonical == 90.deg.

Link copied to clipboard

The angle in degrees, converted from radians at full Double precision.

Link copied to clipboard

The angle in radians — the raw stored value.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Angle): Int

Compares the two angles by their raw radian values.

Link copied to clipboard
operator fun div(divisor: Double): Angle

Angle / Double => Angle
Returns this angle divided by divisor.

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

Angle - Angle => Angle
Returns the difference of the two angles.

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

Angle + Angle => Angle
Returns the sum of the two angles.

Link copied to clipboard
operator fun times(factor: Double): Angle

Angle * Double => Angle
Returns this angle scaled by factor.

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

Returns the raw radians value — full stored precision, no rounding.

Link copied to clipboard
operator fun unaryMinus(): Angle

-Angle => Angle
Returns the negated angle — the same magnitude turning the opposite way.