DirectX Math庫定義了以下用於近似涉及π的不同表達式的常量:
const float XM_PI = 3.141592654f;
const float XM_2PI = 6.283185307f;
const float XM_1DIVPI = 0.318309886f;
const float XM_1DIV2PI = 0.159154943f;
const float XM_PIDIV2 = 1.570796327f;
const float XM_PIDIV4 = 0.785398163f;
另外,它還定義了以下內聯函數用於在弧度和度之間進行轉換:
inline float XMConvertToRadians(float fDegrees){ return fDegrees * (XM_PI / 180.0f); }
inline float XMConvertToDegrees(float fRadians){ return fRadians * (180.0f / XM_PI); }
它還定義了最小/最大功能:
template<class T> inline T XMMin(T a, T b) { return (a< b) ? a : b; }
template<class T> inline T XMMax(T a, T b) { return (a> b) ? a : b; }