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
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
Methods
Distance(float, float)
Finds the distance between two angles along the unit circle.
public static float Distance(float a, float b)
Parameters
Returns
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
floatThe angle to interpolate from.
b
floatThe angle to interpolate to.
t
floatThe interpolation weight. A value of 0 returns
a
, and a value of 1 returnsb
.
Returns
- float
The value between
a
andb
according tot
.
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
floatThe angle to interpolate from.
b
floatThe angle to interpolate to.
t
floatThe interpolation weight. A value of 0 returns
a
, and a value of 1 returnsb
.
Returns
- float
The value between
a
andb
according tot
.
Normalize(float)
Finds the smallest positive angle which is equivalent to the given angle.
public static float Normalize(float radians)
Parameters
radians
floatThe 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
floatThe angle to step from, in radians.
b
floatThe angle to step towards, in radians.
s
floatThe amount to step by, in radians.
Returns
- float
ora
-s
, whichever is closer toa
+s
b
on the unit circle. If the distance betweena
andb
is less thans
, thenb
is returned.
ToDegrees(float)
Converts a value from radians to degrees.
public static float ToDegrees(float radians)
Parameters
radians
floatThe 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
floatThe 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