← Standard library

angle

struct angle

Available without an import.

An angular measurement stored as radians. Use suffixes such as 45.degrees or 1.0f.radians to state the unit explicitly. Rotation APIs accept this type instead of an ambiguous raw number.

Angle.wax:5

Members

radsfield

public float rads

The raw float value in radians, without normalization.

Angle.wax:10

constructorconstructor

public constructor (float rads)

Stores a raw angle in radians without normalization.

Angle.wax:15

FromRadiansconstructor

public constructor FromRadians (float rads)

Constructs from radians without normalization.

Angle.wax:22

FromDegreesconstructor

public constructor FromDegrees (float degrees)

Converts degrees to float radians without normalization.

Angle.wax:29

FromTurnsconstructor

public constructor FromTurns (float turns)

Converts revolutions to float radians without normalization.

Angle.wax:36

Zerogetter

public static get Zero() : angle

Zero radians.

Angle.wax:44

FullTurngetter

public static get FullTurn() : angle

One revolution, approximately 2*pi radians.

Angle.wax:51

HalfTurngetter

public static get HalfTurn() : angle

Half a revolution, approximately pi radians.

Angle.wax:58

QuarterTurngetter

public static get QuarterTurn() : angle

One quarter revolution, approximately pi/2 radians.

Angle.wax:65

ToRadiansmethod

public fn ToRadians() : float

Returns the stored radians.

Angle.wax:73

ToDegreesmethod

public fn ToDegrees() : float

Converts the stored radians to degrees without normalization.

Angle.wax:80

ToTurnsmethod

public fn ToTurns() : float

Converts the stored radians to revolutions without normalization.

Angle.wax:87

Sinmethod

public fn Sin() : float

Returns the sine of this angle.

Angle.wax:95

Cosmethod

public fn Cos() : float

Returns the cosine of this angle.

Angle.wax:102

Tanmethod

public fn Tan() : float

Returns the tangent of this angle.

Angle.wax:109

Asinmethod

public static fn Asin(float value) : angle

Returns inverse sine as an angle; inputs outside [-1, 1] produce a NaN angle.

Angle.wax:117

Acosmethod

public static fn Acos(float value) : angle

Returns inverse cosine as an angle; inputs outside [-1, 1] produce a NaN angle.

Angle.wax:124

Atanmethod

public static fn Atan(float value) : angle

Returns inverse tangent as an angle.

Angle.wax:131

Atan2method

public static fn Atan2(float y, float x) : angle

Returns the angle of (x, y), using both signs to determine the quadrant.

Angle.wax:138

Lerpmethod

public static fn Lerp(angle a, angle b, float t) : angle

Interpolates along the shortest signed arc from a toward b. Does not clamp t; the result is not normalized.

Angle.wax:147

LerpUnclampedmethod

public static fn LerpUnclamped(angle a, angle b, float t) : angle

Interpolates along the shortest signed arc without clamping t or normalizing the result. Has the same behavior as Lerp.

Angle.wax:157

MoveTowardsmethod

public static fn MoveTowards(angle current, angle target, float maxDelta) : angle

Moves along the shortest signed arc by at most maxDelta radians. Supply a nonnegative delta; the returned angle is not normalized.

Angle.wax:167

Betweenmethod

public static fn Between(angle a, angle b) : angle

Returns the shortest signed rotation from a to b in [-pi, pi]. An exact half-turn retains the sign of the reduced difference.

Angle.wax:183

Normalizemethod

public fn Normalize() : angle

Reduces finite angles to [0, 2*pi). Nonfinite values produce NaN.

Angle.wax:192

NormalizeSignedmethod

public fn NormalizeSigned() : angle

Reduces finite angles to [-pi, pi], retaining either endpoint for exact half-turns. Nonfinite values produce NaN.

Angle.wax:207

IsZeromethod

public fn IsZero() : bool

Tests whether the stored radians are exactly zero, not whether the angle is a whole number of revolutions.

Angle.wax:222

GetHashCodemethod

public fn GetHashCode() : uint32

Hashes stored radians, treating all NaNs alike and both signed zeros alike. Whole-turn-equivalent angles need not hash alike.

Angle.wax:233

ToStringmethod

public fn ToString() : string

Formats the angle in degrees followed by the degree symbol, without normalization.

Angle.wax:252

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Appends the degree representation and returns the number of UTF-8 bytes appended.

Angle.wax:260

Equalsmethod

public fn Equals(angle other) : bool

Compares stored radians without normalization. NaNs compare equal to each other and signed zeros compare equal.

Angle.wax:272

CompareTomethod

public fn CompareTo(angle other) : int32

Orders stored radians without normalization, returning -1, 0, or 1. NaNs sort last and compare equal to each other.

Angle.wax:287