Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gbmath::functions Namespace Reference

Miscellaneous Math functions. More...


Variance functions

float GetVariance (int count, float *pvals, float &oMean)
 .

float GetVariance (const std::vector< float > &vals, float &oMean)
 .

V3 GetVariance (int count, const V3 *pvals, V3 &oMean)
 .

V3 GetVariance (const std::vector< V3 > &vals, V3 &oMean)
 .


Newell's polygon normal calculator

V3 GetNormal (const V3 *pVs, int count)
 .

V3 GetNormal (const std::vector< V3 > &vs)
 .

V3 GetNormal (const V3 &v0, const V3 &v1, const V3 &v2, const V3 &v3)
 .


Linear Interpolation

V3 Lerp (const V3 &v1, const V3 &v2, float t)
 .

float Lerp (float a, float b, float t)
 .


Threshold functions

float Step (float a, float t)
 .

float SmoothStep (float a, float b, float t)
 .

float Pulse (float a, float b, float t)
 .

float Clamp (float a, float b, float t)
 .

int Clamp (int a, int b, int t)
 .

int Floor (float t)
 .

int Ceiling (float t)
 .

float GammaCorrect (float gamma, float a)
 .

float Bias (float bias, float a)
 .

float Gain (float gain, float a)
 .

int IsZero (float a, float eps)
 .

int Equals (float a, float b, float eps)
 .


Least, Greatest of 3

float Min3 (float a, float b, float c)
 .

int Min3 (int a, int b, int c)
 .

float Max3 (float a, float b, float c)
 .

int Max3 (int a, int b, int c)
 .


Functions

V3 CRSpline (int nknots, const V3 *knot, float t)
 Catmull-Rom Spline.

float Abs (float a)
 Inlined Absolute value function.

int Abs (int a)
 Inlined Absolute value function.

float Mod (float a, float b)
 Returns a positive remainder.

void SetJK (int i, int &oj, int &ok)
 Set i,j,k indices.

int SolveQuadratic (float a, float b, float c, float &r0, float &r1)
 Solve 2nd degree equation.

int SolveCubic (float a, float b, float c, float d, float &r0, float &r1, float &r2)
 Solve 3rd degree equation.


Detailed Description

Miscellaneous Math functions.

Function Documentation

V3 gbmath::functions::CRSpline int    nknots,
const V3   knot,
float    a
 

Catmull-Rom Spline.

Parameters:
nknots  Number of knots
knot  An array of knots
a  A value from [0,1] for interpolation
Returns :
gbmath::V3, the interpolated value.

void gbmath::functions::SetJK int    i,
int &    oj,
int &    ok
[inline]
 

Set i,j,k indices.

Parameters:
i  Set to 0, 1, or 2 to indicate the i vector index.
oj  Set to j vector index.
ok  Set to k vector index.

int gbmath::functions::SolveCubic float    a,
float    b,
float    c,
float    d,
float &    r0,
float &    r1,
float &    r2
[inline]
 

Solve 3rd degree equation.

Bug:
The function is buggy. It does not handle fractional roots well.
Returns :
Number of roots found.
Return values:
r0  the greatest of the roots
r1, r2  set to infinity if only one root

int gbmath::functions::SolveQuadratic float    a,
float    b,
float    c,
float &    r0,
float &    r1
[inline]
 

Solve 2nd degree equation.

Returns :
Number of roots found
Return values:
r0  - the greater of the two roots
r1  - the lesser of the two roots


Generated on Mon Sep 2 14:52:34 2002 for GunBuster Engine by doxygen1.2.17