doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Static Public Member Functions | Static Public Attributes | Private Types | Static Private Attributes | List of all members
idMath Class Reference

#include <Math.h>

Classes

union  _flint
 

Static Public Member Functions

static void Init (void)
 
static float RSqrt (float x)
 
static float InvSqrt (float x)
 
static float InvSqrt16 (float x)
 
static double InvSqrt64 (float x)
 
static float Sqrt (float x)
 
static float Sqrt16 (float x)
 
static double Sqrt64 (float x)
 
static float Sin (float a)
 
static float Sin16 (float a)
 
static double Sin64 (float a)
 
static float Cos (float a)
 
static float Cos16 (float a)
 
static double Cos64 (float a)
 
static void SinCos (float a, float &s, float &c)
 
static void SinCos16 (float a, float &s, float &c)
 
static void SinCos64 (float a, double &s, double &c)
 
static float Tan (float a)
 
static float Tan16 (float a)
 
static double Tan64 (float a)
 
static float ASin (float a)
 
static float ASin16 (float a)
 
static double ASin64 (float a)
 
static float ACos (float a)
 
static float ACos16 (float a)
 
static double ACos64 (float a)
 
static float ATan (float a)
 
static float ATan16 (float a)
 
static double ATan64 (float a)
 
static float ATan (float y, float x)
 
static float ATan16 (float y, float x)
 
static double ATan64 (float y, float x)
 
static float Pow (float x, float y)
 
static float Pow16 (float x, float y)
 
static double Pow64 (float x, float y)
 
static float Exp (float f)
 
static float Exp16 (float f)
 
static double Exp64 (float f)
 
static float Log (float f)
 
static float Log16 (float f)
 
static double Log64 (float f)
 
static int IPow (int x, int y)
 
static int ILog2 (float f)
 
static int ILog2 (int i)
 
static int BitsForFloat (float f)
 
static int BitsForInteger (int i)
 
static int MaskForFloatSign (float f)
 
static int MaskForIntegerSign (int i)
 
static int FloorPowerOfTwo (int x)
 
static int CeilPowerOfTwo (int x)
 
static bool IsPowerOfTwo (int x)
 
static int BitCount (int x)
 
static int BitReverse (int x)
 
static int Abs (int x)
 
static float Fabs (float f)
 
static float Floor (float f)
 
static float Ceil (float f)
 
static float Rint (float f)
 
static int Ftoi (float f)
 
static int FtoiFast (float f)
 
static unsigned long Ftol (float f)
 
static unsigned long FtolFast (float)
 
static signed char ClampChar (int i)
 
static signed short ClampShort (int i)
 
static int ClampInt (int min, int max, int value)
 
static float ClampFloat (float min, float max, float value)
 
static float AngleNormalize360 (float angle)
 
static float AngleNormalize180 (float angle)
 
static float AngleDelta (float angle1, float angle2)
 
static int FloatToBits (float f, int exponentBits, int mantissaBits)
 
static float BitsToFloat (int i, int exponentBits, int mantissaBits)
 
static int FloatHash (const float *array, const int numFloats)
 

Static Public Attributes

static const float PI = 3.14159265358979323846f
 
static const float TWO_PI = 2.0f * PI
 
static const float HALF_PI = 0.5f * PI
 
static const float ONEFOURTH_PI = 0.25f * PI
 
static const float E = 2.71828182845904523536f
 
static const float SQRT_TWO = 1.41421356237309504880f
 
static const float SQRT_THREE = 1.73205080756887729352f
 
static const float SQRT_1OVER2 = 0.70710678118654752440f
 
static const float SQRT_1OVER3 = 0.57735026918962576450f
 
static const float M_DEG2RAD = PI / 180.0f
 
static const float M_RAD2DEG = 180.0f / PI
 
static const float M_SEC2MS = 1000.0f
 
static const float M_MS2SEC = 0.001f
 
static const float INFINITY = 1e30f
 
static const float FLT_EPSILON = 1.192092896e-07f
 

Private Types

enum  {
  LOOKUP_BITS = 8, EXP_POS = 23, EXP_BIAS = 127, LOOKUP_POS = (EXP_POS-LOOKUP_BITS),
  SEED_POS = (EXP_POS-8), SQRT_TABLE_SIZE = (2<<LOOKUP_BITS), LOOKUP_MASK = (SQRT_TABLE_SIZE-1)
}
 

Static Private Attributes

static dword iSqrt [SQRT_TABLE_SIZE]
 
static bool initialized = false
 

Detailed Description

Definition at line 108 of file Math.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
LOOKUP_BITS 
EXP_POS 
EXP_BIAS 
LOOKUP_POS 
SEED_POS 
SQRT_TABLE_SIZE 
LOOKUP_MASK 

Definition at line 222 of file Math.h.

Member Function Documentation

ID_INLINE int idMath::Abs ( int  x)
static

Definition at line 774 of file Math.h.

ID_INLINE float idMath::ACos ( float  a)
static

Definition at line 544 of file Math.h.

ID_INLINE float idMath::ACos16 ( float  a)
static

Definition at line 554 of file Math.h.

ID_INLINE double idMath::ACos64 ( float  a)
static

Definition at line 569 of file Math.h.

ID_INLINE float idMath::AngleDelta ( float  angle1,
float  angle2 
)
static

Definition at line 918 of file Math.h.

ID_INLINE float idMath::AngleNormalize180 ( float  angle)
static

Definition at line 910 of file Math.h.

ID_INLINE float idMath::AngleNormalize360 ( float  angle)
static

Definition at line 903 of file Math.h.

ID_INLINE float idMath::ASin ( float  a)
static

Definition at line 509 of file Math.h.

ID_INLINE float idMath::ASin16 ( float  a)
static

Definition at line 519 of file Math.h.

ID_INLINE double idMath::ASin64 ( float  a)
static

Definition at line 534 of file Math.h.

ID_INLINE float idMath::ATan ( float  a)
static

Definition at line 579 of file Math.h.

ID_INLINE float idMath::ATan ( float  y,
float  x 
)
static

Definition at line 607 of file Math.h.

ID_INLINE float idMath::ATan16 ( float  a)
static

Definition at line 583 of file Math.h.

ID_INLINE float idMath::ATan16 ( float  y,
float  x 
)
static

Definition at line 611 of file Math.h.

ID_INLINE double idMath::ATan64 ( float  a)
static

Definition at line 603 of file Math.h.

ID_INLINE double idMath::ATan64 ( float  y,
float  x 
)
static

Definition at line 632 of file Math.h.

ID_INLINE int idMath::BitCount ( int  x)
static

Definition at line 758 of file Math.h.

ID_INLINE int idMath::BitReverse ( int  x)
static

Definition at line 766 of file Math.h.

ID_INLINE int idMath::BitsForFloat ( float  f)
static

Definition at line 723 of file Math.h.

ID_INLINE int idMath::BitsForInteger ( int  i)
static

Definition at line 727 of file Math.h.

float idMath::BitsToFloat ( int  i,
int  exponentBits,
int  mantissaBits 
)
static

Definition at line 118 of file Math.cpp.

ID_INLINE float idMath::Ceil ( float  f)
static

Definition at line 789 of file Math.h.

ID_INLINE int idMath::CeilPowerOfTwo ( int  x)
static

Definition at line 743 of file Math.h.

ID_INLINE signed char idMath::ClampChar ( int  i)
static

Definition at line 863 of file Math.h.

ID_INLINE float idMath::ClampFloat ( float  min,
float  max,
float  value 
)
static

Definition at line 893 of file Math.h.

ID_INLINE int idMath::ClampInt ( int  min,
int  max,
int  value 
)
static

Definition at line 883 of file Math.h.

ID_INLINE signed short idMath::ClampShort ( int  i)
static

Definition at line 873 of file Math.h.

ID_INLINE float idMath::Cos ( float  a)
static

Definition at line 346 of file Math.h.

ID_INLINE float idMath::Cos16 ( float  a)
static

Definition at line 350 of file Math.h.

ID_INLINE double idMath::Cos64 ( float  a)
static

Definition at line 386 of file Math.h.

ID_INLINE float idMath::Exp ( float  f)
static

Definition at line 648 of file Math.h.

ID_INLINE float idMath::Exp16 ( float  f)
static

Definition at line 652 of file Math.h.

ID_INLINE double idMath::Exp64 ( float  f)
static

Definition at line 683 of file Math.h.

ID_INLINE float idMath::Fabs ( float  f)
static

Definition at line 779 of file Math.h.

ID_INLINE int idMath::FloatHash ( const float array,
const int  numFloats 
)
static

Definition at line 922 of file Math.h.

int idMath::FloatToBits ( float  f,
int  exponentBits,
int  mantissaBits 
)
static

Definition at line 76 of file Math.cpp.

ID_INLINE float idMath::Floor ( float  f)
static

Definition at line 785 of file Math.h.

ID_INLINE int idMath::FloorPowerOfTwo ( int  x)
static

Definition at line 739 of file Math.h.

ID_INLINE int idMath::Ftoi ( float  f)
static

Definition at line 797 of file Math.h.

ID_INLINE int idMath::FtoiFast ( float  f)
static

Definition at line 801 of file Math.h.

ID_INLINE unsigned long idMath::Ftol ( float  f)
static

Definition at line 829 of file Math.h.

ID_INLINE unsigned long idMath::FtolFast ( float  f)
static

Definition at line 833 of file Math.h.

ID_INLINE int idMath::ILog2 ( float  f)
static

Definition at line 715 of file Math.h.

ID_INLINE int idMath::ILog2 ( int  i)
static

Definition at line 719 of file Math.h.

void idMath::Init ( void  )
static

Definition at line 57 of file Math.cpp.

ID_INLINE float idMath::InvSqrt ( float  x)
static

Definition at line 268 of file Math.h.

ID_INLINE float idMath::InvSqrt16 ( float  x)
static

Definition at line 254 of file Math.h.

ID_INLINE double idMath::InvSqrt64 ( float  x)
static

Definition at line 283 of file Math.h.

ID_INLINE int idMath::IPow ( int  x,
int  y 
)
static

Definition at line 711 of file Math.h.

ID_INLINE bool idMath::IsPowerOfTwo ( int  x)
static

Definition at line 754 of file Math.h.

ID_INLINE float idMath::Log ( float  f)
static

Definition at line 687 of file Math.h.

ID_INLINE float idMath::Log16 ( float  f)
static

Definition at line 691 of file Math.h.

ID_INLINE double idMath::Log64 ( float  f)
static

Definition at line 707 of file Math.h.

ID_INLINE int idMath::MaskForFloatSign ( float  f)
static

Definition at line 731 of file Math.h.

ID_INLINE int idMath::MaskForIntegerSign ( int  i)
static

Definition at line 735 of file Math.h.

ID_INLINE float idMath::Pow ( float  x,
float  y 
)
static

Definition at line 636 of file Math.h.

ID_INLINE float idMath::Pow16 ( float  x,
float  y 
)
static

Definition at line 640 of file Math.h.

ID_INLINE double idMath::Pow64 ( float  x,
float  y 
)
static

Definition at line 644 of file Math.h.

ID_INLINE float idMath::Rint ( float  f)
static

Definition at line 793 of file Math.h.

ID_INLINE float idMath::RSqrt ( float  x)
static

Definition at line 241 of file Math.h.

ID_INLINE float idMath::Sin ( float  a)
static

Definition at line 310 of file Math.h.

ID_INLINE float idMath::Sin16 ( float  a)
static

Definition at line 314 of file Math.h.

ID_INLINE double idMath::Sin64 ( float  a)
static

Definition at line 342 of file Math.h.

ID_INLINE void idMath::SinCos ( float  a,
float s,
float c 
)
static

Definition at line 390 of file Math.h.

ID_INLINE void idMath::SinCos16 ( float  a,
float s,
float c 
)
static

Definition at line 406 of file Math.h.

ID_INLINE void idMath::SinCos64 ( float  a,
double &  s,
double &  c 
)
static

Definition at line 443 of file Math.h.

ID_INLINE float idMath::Sqrt ( float  x)
static

Definition at line 302 of file Math.h.

ID_INLINE float idMath::Sqrt16 ( float  x)
static

Definition at line 298 of file Math.h.

ID_INLINE double idMath::Sqrt64 ( float  x)
static

Definition at line 306 of file Math.h.

ID_INLINE float idMath::Tan ( float  a)
static

Definition at line 459 of file Math.h.

ID_INLINE float idMath::Tan16 ( float  a)
static

Definition at line 463 of file Math.h.

ID_INLINE double idMath::Tan64 ( float  a)
static

Definition at line 505 of file Math.h.

Member Data Documentation

const float idMath::E = 2.71828182845904523536f
static

Definition at line 209 of file Math.h.

const float idMath::FLT_EPSILON = 1.192092896e-07f
static

Definition at line 219 of file Math.h.

const float idMath::HALF_PI = 0.5f * PI
static

Definition at line 207 of file Math.h.

const float idMath::INFINITY = 1e30f
static

Definition at line 218 of file Math.h.

bool idMath::initialized = false
staticprivate

Definition at line 238 of file Math.h.

dword idMath::iSqrt
staticprivate

Definition at line 237 of file Math.h.

const float idMath::M_DEG2RAD = PI / 180.0f
static

Definition at line 214 of file Math.h.

const float idMath::M_MS2SEC = 0.001f
static

Definition at line 217 of file Math.h.

const float idMath::M_RAD2DEG = 180.0f / PI
static

Definition at line 215 of file Math.h.

const float idMath::M_SEC2MS = 1000.0f
static

Definition at line 216 of file Math.h.

const float idMath::ONEFOURTH_PI = 0.25f * PI
static

Definition at line 208 of file Math.h.

const float idMath::PI = 3.14159265358979323846f
static

Definition at line 205 of file Math.h.

const float idMath::SQRT_1OVER2 = 0.70710678118654752440f
static

Definition at line 212 of file Math.h.

const float idMath::SQRT_1OVER3 = 0.57735026918962576450f
static

Definition at line 213 of file Math.h.

const float idMath::SQRT_THREE = 1.73205080756887729352f
static

Definition at line 211 of file Math.h.

const float idMath::SQRT_TWO = 1.41421356237309504880f
static

Definition at line 210 of file Math.h.

const float idMath::TWO_PI = 2.0f * PI
static

Definition at line 206 of file Math.h.


The documentation for this class was generated from the following files: