ExpressionMath
(C++)¶
-
group
FnExpressionMath
-
class
FnExpressionMath
¶ - #include <FnExpressionMath.h>
Class providing range common utility functions used in expression math.
Public Types
Public Static Functions
-
static int
clamp
(int value, int a, int b)¶ Clamp the value between
a
andb
. This function works for a>b and a<b.- Return
a
ifvalue
is less thana
,b
ifvalue
is greater thanvalue
elsevalue
.- Parameters
value
-the value to be clamped
a
-lower bound to clamp
value
tob
-upper bound to clamp
value
to.
-
static float
clamp
(float value, float a, float b)¶
-
static double
clamp
(double value, double a, double b)¶
-
static float
lerp
(float mix, float a, float b)¶ Linearly interpolate between
a
andb
using the specified mix Mix values outside of [0,1] are not clamped. Mix value of zero returns ‘a’. This argument order is such to make it similar to fit and cfit- Return
- the value between a and b, using the specified mix
-
static double
lerp
(double mix, double a, double b)¶
-
static float
smoothstep
(float t)¶ Compute a smoothstep (ease in, ease out) version of t: [0,1] This will clamp the output to between 0 and 1
-
static double
smoothstep
(double t)¶
-
static float
fit
(float value, float oldmin, float oldmax, float newmin, float newmax)¶ Example:
fit(0.8, 0, 1, 0, 255) = 204. fit(3,1,4,5,20) = 15
- Return
- a number between
newmin
andnewmax
, which is relative toval
in the range betweenoldmin
andoldmax
.
-
static double
fit
(double value, double oldmin, double oldmax, double newmin, double newmax)¶
-
static float
cfit
(float value, float oldmin, float oldmax, float newmin, float newmax)¶ Same as fit(), but clamps to new borders, works on both increasing / decreasing segments
- See
- fit()
-
static double
cfit
(double value, double oldmin, double oldmax, double newmin, double newmax)¶
-
static float
softcfit
(float value, float oldmin, float oldmax, float newmin, float newmax)¶ Like regular cfit(), only softer, specifically, uses SmoothStep to ease in and out of the fit.
-
static double
softcfit
(double value, double oldmin, double oldmax, double newmin, double newmax)¶
-
static double
retime
(double frame, double start, double end, RetimeHoldMode inMode, RetimeHoldMode outMode)¶
-
static float
randval
(float min, float max, int seed)¶ - Return
- a random value between
[min,max]
-
static double
randval
(double min, double max, int seed)¶
-
static float
noise
(float x)¶ Improved Perlin noise (Siggraph 2002) Ranges from
[0,1]
-
static float
noise
(float x, float y)¶
-
static float
noise
(float x, float y, float z)¶
-
static float
noise
(float x, float y, float z, float w)¶
-
static float
snoise
(float x)¶ Signed Improved Perlin noise (Siggraph 2002) Ranges from
[-1,1] Results are just a rescaled version of noise
-
static float
snoise
(float x, float y)¶
-
static float
snoise
(float x, float y, float z)¶
-
static float
snoise
(float x, float y, float z, float w)¶
-
static int32_t
stablehash
(const std::string &cacheID)¶ We always return a 32-bit integer, no matter which architecture we’re on.
- Note
- Uses MD5 internally.
-
static int
-
class