QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mathlib.c File Reference

Macros

#define DEG2RAD(a)   (a * (M_PI / 180.0))
 
#define FBIAS   (1 << (FEXPBITS - 1))
 
#define FEXPBITS   8
 
#define FEXPMASK   ((1 << FEXPBITS) - 1)
 
#define FEXPMAX   ((1 << FEXPBITS) - 1)
 
#define FMANTBITS   23
 
#define FMANTMASK   ((1 << FMANTBITS) - 1)
 
#define HBIAS   (1 << (HEXPBITS - 1))
 
#define HEXPBITS   5
 
#define HEXPMASK   ((1 << HEXPBITS) - 1)
 
#define HEXPMAX   ((1 << HEXPBITS) - 1)
 
#define HMANTBITS   10
 
#define HMANTMASK   ((1 << HMANTBITS) - 1)
 
#define IMPLEMENT_R_Cull
 
#define IMPLEMENT_VectorNormalize
 
#define sqr(x)   ((x) * (x))
 

Typedefs

typedef vec_t mat2_t [2 *2]
 

Functions

vec_t _DotProduct (const vec3_t v1, const vec3_t v2)
 
void _VectorAdd (const vec3_t veca, const vec3_t vecb, vec3_t out)
 
int _VectorCompare (const vec3_t v1, const vec3_t v2)
 
void _VectorCopy (const vec3_t in, vec3_t out)
 
vec_t _VectorLength (const vec3_t v)
 
void _VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc)
 
vec_t _VectorNormalize (vec3_t v)
 
void _VectorScale (const vec3_t in, vec_t scale, vec3_t out)
 
void _VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out)
 
float anglemod (float a)
 
void AngleQuat (const vec3_t angles, quat_t q)
 
void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
 Convert quake angles to basis vectors. More...
 
void BarycentricCoords (const vec_t **points, int num_points, const vec3_t p, vec_t *lambda)
 
void BOPS_Error (void)
 
int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs, plane_t *p)
 
int CircumSphere (const vec3_t points[], int num_points, sphere_t *sphere)
 
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross)
 
int16_t FloatToHalf (float x)
 
void FloorDivMod (double numer, double denom, int *quotient, int *rem)
 
int GreatestCommonDivisor (int i1, int i2)
 
float HalfToFloat (int16_t x)
 
fixed16_t Invert24To16 (fixed16_t val)
 
int Mat3Decompose (const mat3_t mat, quat_t rot, vec3_t shear, vec3_t scale)
 
vec_t Mat3Determinant (const mat3_t m)
 
void Mat3Init (const quat_t rot, const vec3_t scale, mat3_t mat)
 
int Mat3Inverse (const mat3_t a, mat3_t b)
 
void Mat3Mult (const mat3_t a, const mat3_t b, mat3_t c)
 
void Mat3MultVec (const mat3_t a, const vec3_t b, vec3_t c)
 
void Mat3SymEigen (const mat3_t m, vec3_t e)
 
void Mat3Transpose (const mat3_t a, mat3_t b)
 
void Mat4as3MultVec (const mat4_t a, const vec3_t b, vec3_t c)
 
int Mat4Decompose (const mat4_t mat, quat_t rot, vec3_t shear, vec3_t scale, vec3_t trans)
 Decompose a 4x4 column major matrix into its component transformations. More...
 
void Mat4Init (const quat_t rot, const vec3_t scale, const vec3_t trans, mat4_t mat)
 
int Mat4Inverse (const mat4_t a, mat4_t b)
 
void Mat4Mult (const mat4_t a, const mat4_t b, mat4_t c)
 
void Mat4MultVec (const mat4_t a, const vec3_t b, vec3_t c)
 
void Mat4Transpose (const mat4_t a, mat4_t b)
 
int Q_log2 (int val)
 
void QuatExp (const quat_t a, quat_t b)
 
void QuatInverse (const quat_t in, quat_t out)
 
void QuatMult (const quat_t q1, const quat_t q2, quat_t out)
 
void QuatMultVec (const quat_t q, const vec3_t v, vec3_t out)
 
void QuatToMatrix (const quat_t q, vec_t *m, int homogenous, int vertical)
 
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3])
 
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
 
void RotatePointAroundVector (vec3_t dst, const vec3_t axis, const vec3_t point, float degrees)
 
sphere_t SmallestEnclosingBall (const vec3_t points[], int num_points)
 
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up)
 

Variables

plane_t *const frustum = _frustum
 
int nanmask = 255 << 23
 
const vec_t *const quat_origin = _quat_origin
 
const vec_t *const vec3_origin = _vec3_origin
 

Macro Definition Documentation

#define DEG2RAD (   a)    (a * (M_PI / 180.0))
#define FBIAS   (1 << (FEXPBITS - 1))
#define FEXPBITS   8
#define FEXPMASK   ((1 << FEXPBITS) - 1)
#define FEXPMAX   ((1 << FEXPBITS) - 1)
#define FMANTBITS   23
#define FMANTMASK   ((1 << FMANTBITS) - 1)
#define HBIAS   (1 << (HEXPBITS - 1))
#define HEXPBITS   5
#define HEXPMASK   ((1 << HEXPBITS) - 1)
#define HEXPMAX   ((1 << HEXPBITS) - 1)
#define HMANTBITS   10
#define HMANTMASK   ((1 << HMANTBITS) - 1)
#define IMPLEMENT_R_Cull
#define IMPLEMENT_VectorNormalize
#define sqr (   x)    ((x) * (x))

Typedef Documentation

typedef vec_t mat2_t[2 *2]

Function Documentation

void BOPS_Error ( void  )
int Mat3Decompose ( const mat3_t  mat,
quat_t  rot,
vec3_t  shear,
vec3_t  scale 
)