Defines a numerical range that wraps around. More...
Public Member Functions | |
ksRange (float min, float max) | |
Constructor. More... | |
void | SetRange (float min, float max) |
Sets new min and max range values More... | |
float | Wrap (float value) |
Fits a value into the range. More... | |
float | Clamp (float value) |
Clamps a value into the range. More... | |
float | Delta (float from, float to) |
Calculates the shortest delta between two values. More... | |
float | Slerp (float from, float to, float t) |
Spherically interpolates between two values. More... | |
float | MoveTowards (float start, float target, float distance) |
Moves a value towards another in the shorest direction. More... | |
Properties | |
static ksRange | Degrees [get] |
Degrees (0 - 360). More... | |
static ksRange | Radians [get] |
Radians (0 - 2PI). More... | |
float | Min [get] |
Min value in the range (inclusive). More... | |
float | Max [get] |
Max value in the range (exclusive). More... | |
Defines a numerical range that wraps around.
KS.Reactor.ksRange.ksRange | ( | float | min, |
float | max | ||
) |
Constructor.
min | Min value in the range (inclusive). |
max | Max value in the range (exclusive). |
float KS.Reactor.ksRange.Clamp | ( | float | value | ) |
Clamps a value into the range.
value |
float KS.Reactor.ksRange.Delta | ( | float | from, |
float | to | ||
) |
Calculates the shortest delta between two values.
from | |
to |
float KS.Reactor.ksRange.MoveTowards | ( | float | start, |
float | target, | ||
float | distance | ||
) |
Moves a value towards another in the shorest direction.
start | Start value. |
target | Target to move towards. |
distance | delta distance to move. It will not overshoot the target. Negative values will move away from the target. |
void KS.Reactor.ksRange.SetRange | ( | float | min, |
float | max | ||
) |
Sets new min and max range values
min | Min value in the range (inclusive). |
max | Max value in the range (exclusive). |
float KS.Reactor.ksRange.Slerp | ( | float | from, |
float | to, | ||
float | t | ||
) |
Spherically interpolates between two values.
from | Value to interpolate from. |
to | Value to interpolate to. |
t | Amount to interpolate between 0 and 1. |
float KS.Reactor.ksRange.Wrap | ( | float | value | ) |
Fits a value into the range.
This is not a clamp–values outside the range will wrap around.
value |
|
staticget |
Degrees (0 - 360).
|
get |
Max value in the range (exclusive).
|
get |
Min value in the range (inclusive).
|
staticget |
Radians (0 - 2PI).