Yage3D.net
 

yage.core.math.math

Authors:
Eric Poggel

License:
LGPL v3

Math functions not in the standard library.

bool almostEqual (float a, float b, float fudge = 0.0001F);
TODO:
Can this be replaced with the faster Tango.math.IEEE.feqrel? Check if two floats are almost equal, that is, they differ no more than fudge from one another, relatively speaking. If fudge is 0.0001 (the default) Then 10000 and 10001 will compare equally and so will 1.000 and 1.0001; but if either of those differ more, they are not considered equal. Also, numbers with an absolute difference less than or equal to fudge will always compare equal. This allows 0.00001 and 0 to be almost equal.

T clamp (T)(T v, T lower, T upper);
Clamp v between l and u

uint nextPow2 (uint input);
Returns the first integer n such that 2^n >= input.

Example:
nextPow2 (9); // returns 16

float map (float v, float oldmin, float oldmax, float newmin, float newmax);
Map a value from one range to another

class random ;
Generate a random number between min and max.

static float opCall (float min, float max);
ditto

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:26 2010