bias_fast
Inspired by Ken Perlin's bias function, this function is a mere approximation.
However, it has some interesting advantages over the original.
By removing expensive logarithm and power function calls it operates much faster and as an added benefit it is symmetrical.
/*
** Usage:
** bias(b,t)
**
** Arguments:
** b bais, real
** t value, real
**
** Returns:
** If (t) varies over the [0,1] interval, then
** the result also varies over that interval.
** The zero and one endpoints of the interval
** are mapped onto themselves. Other values
** are shifted upward toward one if (b) is
** greater than 0.5, and shifted downward
** toward zero if (b) is between 0.0 and 0.5.
**
** GMLscripts.com
*/
{
return argument1/((1/argument0-2)*(1-argument1)+1);
}
** Usage:
** bias(b,t)
**
** Arguments:
** b bais, real
** t value, real
**
** Returns:
** If (t) varies over the [0,1] interval, then
** the result also varies over that interval.
** The zero and one endpoints of the interval
** are mapped onto themselves. Other values
** are shifted upward toward one if (b) is
** greater than 0.5, and shifted downward
** toward zero if (b) is between 0.0 and 0.5.
**
** GMLscripts.com
*/
{
return argument1/((1/argument0-2)*(1-argument1)+1);
}
[Please Login]
Projects: 3
Contributor: xot
comments powered by Disqus

Related: