Polarith AI
1.8

◆ MapUrq()

static float MapUrq ( float  urq,
float  min,
float  max,
float  value 
)
static

Gets the function value for the given argument value using the "Uniform Rational Quantization (URQ)" function [Schlick 95], whereby returned function values are always between 0 and 1 if the given value is between min and max .

The parameters min and max control the mapped argument interval of the function. Usually, min is 0, to shift the argument interval, a value greater than 0 can be specified.

If the urq parameter is equal to 1, it becomes a linear function. If it is greater than 1, e.g. 10, the function approximates a square root arc; and if it is lesser than 1, e.g. 0.1, a quadratic function is approximated. Note, the parameter urq should always be greater than 0.

If urq or value is 0 and max minus min is 0, then this function would divide by zero, and therefore, float.PositiveInfinity is returned.

Parameters
minSpecifies the minimum of the URQ function argument interval.
maxSpecifies the maximum of the URQ function argument interval.
valueThe argument value to be mapped.
urqThe URQ parameter to control the function shape.
Returns
The mapped URQ function value.
Imprint