Table of Contents

Class Angle

Namespace
SimulationFramework
Assembly
SimulationFramework.dll

Provides utilities for working with angles.

public static class Angle
Inheritance
Angle
Inherited Members

Fields

DegreesToRadians

The ratio of one degree to one radian. Multiplying a value by this constant converts it from degrees to radians.

public const float DegreesToRadians = 0.017453292

Field Value

float

RadiansToDegrees

The ratio of one radian to one degree. Multiplying a value by this constant converts it from radians to degrees.

public const float RadiansToDegrees = 57.295776

Field Value

float

Methods

Distance(float, float)

Finds the distance between two angles along the unit circle.

public static float Distance(float a, float b)

Parameters

a float
b float

Returns

float

FromVector(Vector2)

Finds the angle of the provided vector

public static float FromVector(Vector2 vector)

Parameters

vector Vector2

Returns

float

The normalized angle of the vector.

Lerp(float, float, float)

Linearly interpolates from one angle towards another along the unit circle.

public static float Lerp(float a, float b, float t)

Parameters

a float

The angle to interpolate from.

b float

The angle to interpolate to.

t float

The interpolation weight. A value of 0 returns a, and a value of 1 returns b.

Returns

float

The value between a and b according to t.

LerpClamped(float, float, float)

Linearly interpolates from one angle towards another along the unit circle.

public static float LerpClamped(float a, float b, float t)

Parameters

a float

The angle to interpolate from.

b float

The angle to interpolate to.

t float

The interpolation weight. A value of 0 returns a, and a value of 1 returns b.

Returns

float

The value between a and b according to t.

Normalize(float)

Finds the smallest positive angle which is equivalent to the given angle.

public static float Normalize(float radians)

Parameters

radians float

The angle to normalize, in radians.

Returns

float

The normalized angle. This value will within the range [0, 2pi)

Step(float, float, float)

Steps one angle towards another along the unit circle.

public static float Step(float a, float b, float s)

Parameters

a float

The angle to step from, in radians.

b float

The angle to step towards, in radians.

s float

The amount to step by, in radians.

Returns

float

a - s or a + s, whichever is closer to b on the unit circle. If the distance between a and b is less than s, then b is returned.

ToDegrees(float)

Converts a value from radians to degrees.

public static float ToDegrees(float radians)

Parameters

radians float

The value to convert to degrees.

Returns

float

The provided value converted to degrees.

ToRadians(float)

Converts a value from degrees to radians.

public static float ToRadians(float degrees)

Parameters

degrees float

The value to convert to radians.

Returns

float

The provided value converted to radians.

ToVector(float)

Converts the provided angle to a unit vector..

public static Vector2 ToVector(float radians)

Parameters

radians float

Returns

Vector2