Katana Plug-in APIs 0.1
Static Public Member Functions

Foundry::Katana::FnExpressionMath Class Reference

#include <FnExpressionMath.h>

List of all members.

Static Public Member Functions

static int clamp (int value, int a, int b)
static float lerp (float mix, float a, float b)
static float smoothstep (float t)
static float fit (float value, float oldmin, float oldmax, float newmin, float newmax)
static float cfit (float value, float oldmin, float oldmax, float newmin, float newmax)
static float softcfit (float value, float oldmin, float oldmax, float newmin, float newmax)
static float randval (float min, float max, int seed)
static float noise (float x)
static float snoise (float x)
static int32_t stablehash (const std::string &cacheID)

Detailed Description

Class providing range common utility functions used in expression math.


Member Function Documentation

static float Foundry::Katana::FnExpressionMath::cfit ( float  value,
float  oldmin,
float  oldmax,
float  newmin,
float  newmax 
) [static]

Same as fit(), but clamps to new borders, works on both increasing / decreasing segments

See also:
fit()
static int Foundry::Katana::FnExpressionMath::clamp ( int  value,
int  a,
int  b 
) [static]

Clamp the value between a and b. This function works for a>b and a<b.

Parameters:
valuethe value to be clamped
alower bound to clamp value to
bupper bound to clamp value to.
Returns:
a if value is less than a, b if value is greater than value else value.
static float Foundry::Katana::FnExpressionMath::fit ( float  value,
float  oldmin,
float  oldmax,
float  newmin,
float  newmax 
) [static]

Example:

 fit(0.8, 0, 1, 0, 255) = 204.
 fit(3,1,4,5,20) = 15
Returns:
a number between newmin and newmax, which is relative to val in the range between oldmin and oldmax.
static float Foundry::Katana::FnExpressionMath::lerp ( float  mix,
float  a,
float  b 
) [static]

Linearly interpolate between a and b 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

Returns:
the value between a and b, using the specified mix
static float Foundry::Katana::FnExpressionMath::noise ( float  x) [static]

Improved Perlin noise (Siggraph 2002) Ranges from [0,1]

static float Foundry::Katana::FnExpressionMath::randval ( float  min,
float  max,
int  seed 
) [static]
Returns:
a random value between [min,max]
static float Foundry::Katana::FnExpressionMath::smoothstep ( float  t) [static]

Compute a smoothstep (ease in, ease out) version of t: [0,1] This will clamp the output to between 0 and 1

static float Foundry::Katana::FnExpressionMath::snoise ( float  x) [static]

Signed Improved Perlin noise (Siggraph 2002) Ranges from [-1,1] Results are just a rescaled version of noise

static float Foundry::Katana::FnExpressionMath::softcfit ( float  value,
float  oldmin,
float  oldmax,
float  newmin,
float  newmax 
) [static]

Like regular cfit(), only softer, specifically, uses SmoothStep to ease in and out of the fit.

See also:
cfit() fit()
static int32_t Foundry::Katana::FnExpressionMath::stablehash ( const std::string &  cacheID) [static]

We always return a 32-bit integer, no matter which architecture we're on.

Note:
Uses MD5 internally.

The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator