Академический Документы
Профессиональный Документы
Культура Документы
/**
* Determines if a value is a power of 2
*
* @param
val
* @return
*/
private static function isPowerOfTwo(val:uint):Boolean {
return (val != 0) && ((val & (val - 1)) == 0);
}
/**
* Calculates returns a number that will contain val
* which is of the pattern 2n +1
*
* @param
val
* @return
*/
private static function adjustUp(val:int):int {
var size:int = 2;
while (size + 1 < val) {
size *= 2;
}
return size + 1;
}
The added vertex is shifted in z-coordinate direction by random value denoted by . This
procedure is recursively repeated for each subsquare, then for every their descendants, and so on.
In order to be resulting surface fBm, the random number must be generated with Gaussian
distribution
according to
have to be modified
Figure: Example of fractal terrain with fractal dimension D=2.5. (a) wire frame model (b) the
same model textured