Defines a math utility class.
More...
|
static void | smooth (float *x, float target, float elapsedTime, float responseTime) |
| Updates the given scalar towards the given target using a smoothing function. More...
|
|
local | smooth ( local x, local target, local elapsedTime, local responseTime) |
| Updates the given scalar towards the given target using a smoothing function. More...
|
|
static void | smooth (float *x, float target, float elapsedTime, float riseTime, float fallTime) |
| Updates the given scalar towards the given target using a smoothing function. More...
|
|
static float | lerp (float from, float to, float alpha) |
| Linearly interpolates between from value to to value by alpha which is in the range [0,1]. More...
|
|
var | lerp ( var from, var to, var alpha) |
| Linearly interpolates between from value to to value by alpha which is in the range [0,1]. More...
|
|
Defines a math utility class.
This is primarily used for optimized internal math operations.
static void smooth |
( |
float * |
x, |
|
|
float |
target, |
|
|
float |
elapsedTime, |
|
|
float |
responseTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given response time determines the amount of smoothing (lag). A longer response time yields a smoother result and more lag. To force the scalar to follow the target closely, provide a response time that is very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
responseTime | response time (in the same units as elapsedTime). |
var smooth |
( |
var |
x, |
|
|
var |
target, |
|
|
var |
elapsedTime, |
|
|
var |
responseTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given response time determines the amount of smoothing (lag). A longer response time yields a smoother result and more lag. To force the scalar to follow the target closely, provide a response time that is very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
responseTime | response time (in the same units as elapsedTime). |
local smooth |
( |
local |
x, |
|
|
local |
target, |
|
|
local |
elapsedTime, |
|
|
local |
responseTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given response time determines the amount of smoothing (lag). A longer response time yields a smoother result and more lag. To force the scalar to follow the target closely, provide a response time that is very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
responseTime | response time (in the same units as elapsedTime). |
static void smooth |
( |
float * |
x, |
|
|
float |
target, |
|
|
float |
elapsedTime, |
|
|
float |
riseTime, |
|
|
float |
fallTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given rise and fall times determine the amount of smoothing (lag). Longer rise and fall times yield a smoother result and more lag. To force the scalar to follow the target closely, provide rise and fall times that are very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
riseTime | response time for rising slope (in the same units as elapsedTime). |
fallTime | response time for falling slope (in the same units as elapsedTime). |
var smooth |
( |
var |
x, |
|
|
var |
target, |
|
|
var |
elapsedTime, |
|
|
var |
riseTime, |
|
|
var |
fallTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given rise and fall times determine the amount of smoothing (lag). Longer rise and fall times yield a smoother result and more lag. To force the scalar to follow the target closely, provide rise and fall times that are very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
riseTime | response time for rising slope (in the same units as elapsedTime). |
fallTime | response time for falling slope (in the same units as elapsedTime). |
local smooth |
( |
local |
x, |
|
|
local |
target, |
|
|
local |
elapsedTime, |
|
|
local |
riseTime, |
|
|
local |
fallTime |
|
) |
| |
|
static |
Updates the given scalar towards the given target using a smoothing function.
The given rise and fall times determine the amount of smoothing (lag). Longer rise and fall times yield a smoother result and more lag. To force the scalar to follow the target closely, provide rise and fall times that are very small relative to the given elapsed time.
- Parameters
-
x | the scalar to update. |
target | target value. |
elapsedTime | elapsed time between calls. |
riseTime | response time for rising slope (in the same units as elapsedTime). |
fallTime | response time for falling slope (in the same units as elapsedTime). |
static float lerp |
( |
float |
from, |
|
|
float |
to, |
|
|
float |
alpha |
|
) |
| |
|
static |
Linearly interpolates between from value to to value by alpha which is in the range [0,1].
- Parameters
-
from | the from value. |
to | the to value. |
alpha | the alpha value between [0,1] |
- Returns
- interpolated float value
var lerp |
( |
var |
from, |
|
|
var |
to, |
|
|
var |
alpha |
|
) |
| |
|
static |
Linearly interpolates between from value to to value by alpha which is in the range [0,1].
- Parameters
-
from | the from value. |
to | the to value. |
alpha | the alpha value between [0,1] |
- Returns
- interpolated float value
local lerp |
( |
local |
from, |
|
|
local |
to, |
|
|
local |
alpha |
|
) |
| |
|
static |
Linearly interpolates between from value to to value by alpha which is in the range [0,1].
- Parameters
-
from | the from value. |
to | the to value. |
alpha | the alpha value between [0,1] |
- Returns
- interpolated float value
The documentation for this class was generated from the following file: