11 static const float EULER = 2.7182818284590452353;
12 static const float PI = 3.14159265358979;
13 static const float PI2 = 6.28318530717958;
14 static const float PI_HALF = 1.570796326794;
16 static const float RAD2DEG = 57.2957795130823208768;
17 static const float DEG2RAD = 0.01745329251994329577;
88 int max_range =
Math.
Pow(2, 30);
90 float rand_float = (
float)random_int / (
float)max_range;
91 float range = max - min;
93 return min + (rand_float * range);
150 proto
static float DiffAngle(
float angle1,
float angle2);
163 proto
static float Pow(
float v,
float power);
285 proto
static float Sqrt(
float val);
311 proto
static float Sin(
float angle);
323 proto
static float Cos(
float angle);
335 proto
static float Tan(
float angle);
347 proto
static float Asin(
float s);
359 proto
static float Acos(
float c);
421 proto
static float Ceil(
float f);
435 proto
static float WrapFloat(
float f,
float min,
float max);
489 proto
static int WrapInt(
int i,
int min,
int max);
520 proto
static float Clamp(
float value,
float min,
float max);
533 proto
static float Min(
float x,
float y);
546 proto
static float Max(
float x,
float y);
560 proto
static bool IsInRange(
float v,
float min,
float max);
588 proto
static float Lerp(
float a,
float b,
float time);
658 proto
static float SmoothCD(
float val,
float target, inout
float velocity[],
float smoothTime,
float maxVelocity,
float dt);
661 static float Poisson(
float mean,
int occurences)
671 ErrorEx(
"Values above '12' cause int overflow! Returning '1'");
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float DiffAngle(float angle1, float angle2)
Return relative difference between angles.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto bool IsPointInCircle(vector c, float r, vector p)
Returns if point is inside circle.
static int Factorial(int val)
values above '12' will cause int overflow
static proto float Atan(float x)
Returns angle in radians from tangent.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto float HypotenuseOfRightTriangle(float s, float a)
Returns hypotenus of a right triangle.
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto bool IsInRangeInt(int v, int min, int max)
Returns if value is between min and max (inclusive)
static proto int WrapInt(int i, int min, int max)
Returns wrap number to specified interval [min, max[.
static const float PI_HALF
static proto float Log2(float x)
Returns the binary (base-2) logarithm of x.
static proto float WrapFloat0X(float f, float max)
Returns wrap number to specified interval [0, max[.
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto float WrapFloatInclusive(float f, float min, float max)
Returns wrap number to specified interval [min, max].
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float SignFloat(float f)
Returns sign of given value.
static proto float Asin(float s)
Returns angle in radians from sinus.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto int WrapInt0X(int i, int max)
Returns wrap number to specified interval [0, max[.
static proto bool IsInRange(float v, float min, float max)
Returns if value is between min and max (inclusive)
static proto float Tan(float angle)
Returns tangent of angle in radians.
static proto float Atan2(float y, float x)
Returns angle in radians from tangent.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
static proto float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Does the CD smoothing function - easy in | easy out / S shaped smoothing.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float SqrFloat(float f)
Returns squared value.
static proto int SignInt(int i)
Returns sign of given value.
static proto int GetNthBitSet(int value, int n)
returns the the index of n-th bit set in a bit mask counting from the right, for instance,...
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
static proto int SqrInt(int i)
Returns squared value.
static proto float Min(float x, float y)
Returns smaller of two given values.
static float Poisson(float mean, int occurences)
occurences values above '12' will cause Factorial to overflow int.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float AbsFloat(float f)
Returns absolute value.
static proto float WrapFloat(float f, float min, float max)
Returns wrap number to specified interval [min, max[.
static proto float NormalizeAngle(float ang)
Normalizes the angle (0...360)
static const float RAD2DEG
static proto int GetNumberOfSetBits(int i)
returns the number of bits set in a bitmask i
static const float DEG2RAD
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float Ceil(float f)
Returns ceil of value.
static proto float WrapFloat0XInclusive(float f, float max)
Returns wrap number to specified interval [0, max].
static proto int AbsInt(int i)
Returns absolute value.
static proto float RemainderFloat(float x, float y)
Returns the floating-point remainder of x/y rounded to nearest.
static proto bool IsPointInRectangle(vector mi, vector ma, vector p)
Returns if point is inside rectangle.
static proto float Sqrt(float val)
Returns square root.
static proto float AreaOfRightTriangle(float s, float a)
Returns area of a right triangle.
static proto float Floor(float f)
Returns floor of value.