![]() |
Roboid Control for C#
|
Angle utilities
Static Public Member Functions | |
static float | Clamp (float angle, float min, float max) |
Clamp the angle between the given min and max values. | |
static float | Difference (float a, float b) |
Determine the angle difference, result is a normalized angle. | |
static float | Normalize (float angle) |
Normalize an angle to the range -180 < angle <= 180. | |
static float | MoveTowards (float fromAngle, float toAngle, float maxAngle) |
Rotate from one angle to the other with a maximum degrees. | |
static float | ToFactor (Vector2 v1, Vector2 v2) |
Map interval of angles between vectors [0..Pi] to interval [0..1]. | |
Static Public Attributes | |
const float | pi = 3.1415927410125732421875F |
const float | Deg2Rad = 360.0f / ((float)Math.PI * 2) |
const float | Rad2Deg = ((float)Math.PI * 2) / 360.0f |
|
static |
Clamp the angle between the given min and max values.
angle | The angle to clamp |
min | The minimum angle |
max | The maximum angle |
Angles are normalized
|
static |
Determine the angle difference, result is a normalized angle.
a | First first angle |
b | The second angle |
Angle values should be degrees
|
static |
Normalize an angle to the range -180 < angle <= 180.
angle | The angle to normalize |
Angle values should be in degrees
|
static |
Rotate from one angle to the other with a maximum degrees.
fromAngle | Starting angle |
toAngle | Target angle |
maxAngle | Maximum angle to rotate |
This function is compatible with radian and degrees angles
Map interval of angles between vectors [0..Pi] to interval [0..1].
v1 | The first vector |
v2 | The second vector |
Vectors a and b must be normalized