Turok
 
Loading...
Searching...
No Matches
Math Namespace Reference

Functions

float Sin (float f)
 Returns the sine of angle f in radians.
 
float Cos (float f)
 Returns the cosine of angle f in radians.
 
float Tan (float f)
 Returns the tangent of angle f in radians.
 
float ATan2 (float y, float x)
 Returns the angle in radians whose Tan is y/x.
 
float Fabs (float f)
 Returns the absolute value of f.
 
float ACos (float f)
 Returns the arc-cosine of f - the angle in radians whose cosine is f.
 
float Sqrt (float f)
 Returns square root of f.
 
int Abs (int i)
 Returns the absolute value of i.
 
float Ceil (float f)
 Returns the smallest integer greater to or equal to f.
 
float Floor (float f)
 Returns the largest integer smaller to or equal to f.
 
float Log (float f)
 Returns the natural (base e) logarithm of a specified number.
 
float Pow (float x, float y)
 Returns f raised to power p.
 
float Deg2Rad (float degs)
 Degrees-to-radians conversion.
 
float Rad2Deg (float rads)
 Radians-to-Degrees conversion.
 
float InvSqrt (float f)
 Returns inverse square root of f.
 
float IncMax (const float val, const float inc, const float dest)
 returns val +(or minus) inc and never goes above or below dest value
 
int SysRand ()
 Range 0..32767.
 
int Rand ()
 Range 0..32767.
 
uint8 RandByte ()
 Range 0..255.
 
int RandMax (const int max)
 Range 0..max-1.
 
float NLerp (const float a, const float b, const float t)
 Calculates the linear parameter t that produces the interpolant value within the range [a, b].
 
float Accelerate (const float val, const float accel, const float max)
 return val that increases by accel in a weird way to the max value.
 
float RandFloat ()
 Range 0..1.
 
float RandCFloat ()
 Range -1..1.
 
float RandRange (const float min, const float max)
 Returns a random float number between and min [inclusive] and max [inclusive].
 
int Clamp (const int i, const int min, const int max)
 Returns clamped value between min and max.
 
float Clampf (const float f, const float min, const float max)
 Returns clamped value between min and max.
 
float Lerp (float start, const float end, const float time)
 Linearly interpolates between start and end by time.
 
float CosTween (const float t)
 return (0.5f - (Cos(t * pi) * 0.5f));
 
float CosArc (const float t)
 return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
 
float SmoothStep (const float from, const float to, const float t)
 Interpolates between min and max with smoothing at the limits.
 
float HermiteBlend (const float a, const float b, const float t)
 
float Min (const float a, const float b)
 Returns the smallest of the two values.
 
float Max (const float a, const float b)
 Returns the largest of the two values.
 
const int f2i (const float f)
 IEEE 754 float to int.
 
const float i2f (const int i)
 int to IEEE 754 float
 

Variables

const float pi = 3.1415927f
 
const float tau = 6.2831855f
 pi * 2
 
const kVec3 vecZero (0.0f, 0.0f, 0.0f)
 

Function Documentation

◆ Abs()

int Math::Abs ( int i)

Returns the absolute value of i.

◆ Accelerate()

float Math::Accelerate ( const float val,
const float accel,
const float max )

return val that increases by accel in a weird way to the max value.

◆ ACos()

float Math::ACos ( float f)

Returns the arc-cosine of f - the angle in radians whose cosine is f.

◆ ATan2()

float Math::ATan2 ( float y,
float x )

Returns the angle in radians whose Tan is y/x.

◆ Ceil()

float Math::Ceil ( float f)

Returns the smallest integer greater to or equal to f.

◆ Clamp()

int Math::Clamp ( const int i,
const int min,
const int max )

Returns clamped value between min and max.

◆ Clampf()

float Math::Clampf ( const float f,
const float min,
const float max )

Returns clamped value between min and max.

◆ Cos()

float Math::Cos ( float f)

Returns the cosine of angle f in radians.

◆ CosArc()

float Math::CosArc ( const float t)

return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));

◆ CosTween()

float Math::CosTween ( const float t)

return (0.5f - (Cos(t * pi) * 0.5f));

◆ Deg2Rad()

float Math::Deg2Rad ( float degs)

Degrees-to-radians conversion.

◆ f2i()

const int Math::f2i ( const float f)

IEEE 754 float to int.

◆ Fabs()

float Math::Fabs ( float f)

Returns the absolute value of f.

◆ Floor()

float Math::Floor ( float f)

Returns the largest integer smaller to or equal to f.

◆ HermiteBlend()

float Math::HermiteBlend ( const float a,
const float b,
const float t )

◆ i2f()

const float Math::i2f ( const int i)

int to IEEE 754 float

◆ IncMax()

float Math::IncMax ( const float val,
const float inc,
const float dest )

returns val +(or minus) inc and never goes above or below dest value

◆ InvSqrt()

float Math::InvSqrt ( float f)

Returns inverse square root of f.

◆ Lerp()

float Math::Lerp ( float start,
const float end,
const float time )

Linearly interpolates between start and end by time.

◆ Log()

float Math::Log ( float f)

Returns the natural (base e) logarithm of a specified number.

◆ Max()

float Math::Max ( const float a,
const float b )

Returns the largest of the two values.

◆ Min()

float Math::Min ( const float a,
const float b )

Returns the smallest of the two values.

◆ NLerp()

float Math::NLerp ( const float a,
const float b,
const float t )

Calculates the linear parameter t that produces the interpolant value within the range [a, b].

◆ Pow()

float Math::Pow ( float x,
float y )

Returns f raised to power p.

◆ Rad2Deg()

float Math::Rad2Deg ( float rads)

Radians-to-Degrees conversion.

◆ Rand()

int Math::Rand ( )

Range 0..32767.

◆ RandByte()

uint8 Math::RandByte ( )

Range 0..255.

◆ RandCFloat()

float Math::RandCFloat ( )

Range -1..1.

◆ RandFloat()

float Math::RandFloat ( )

Range 0..1.

◆ RandMax()

int Math::RandMax ( const int max)

Range 0..max-1.

◆ RandRange()

float Math::RandRange ( const float min,
const float max )

Returns a random float number between and min [inclusive] and max [inclusive].

◆ Sin()

float Math::Sin ( float f)

Returns the sine of angle f in radians.

◆ SmoothStep()

float Math::SmoothStep ( const float from,
const float to,
const float t )

Interpolates between min and max with smoothing at the limits.

◆ Sqrt()

float Math::Sqrt ( float f)

Returns square root of f.

◆ SysRand()

int Math::SysRand ( )

Range 0..32767.

◆ Tan()

float Math::Tan ( float f)

Returns the tangent of angle f in radians.

Variable Documentation

◆ pi

const float Math::pi = 3.1415927f

Definition at line 1873 of file t1_scriptAPI.cpp.

◆ tau

const float Math::tau = 6.2831855f

pi * 2

Definition at line 1874 of file t1_scriptAPI.cpp.

◆ vecZero

const kVec3 Math::vecZero(0.0f, 0.0f, 0.0f) ( 0. 0f,
0. 0f,
0. 0f )