This commit is contained in:
Бранимир Караџић
2024-05-01 08:21:07 -07:00
parent 74bda7e6cc
commit c5876a7391
2 changed files with 5 additions and 2 deletions

View File

@@ -20,9 +20,12 @@ namespace bx
/// The ratio of a circle's circumference to its radius. Pi multiplied by 2, or Tau. pi*2
constexpr float kPi2 = 6.2831853071795864769252867665590f;
/// The reciprocal of pi. 1/pi
/// The reciprocal of kPi. 1/kPi
constexpr float kInvPi = 1.0f/kPi;
/// The reciprocal of kPi2. 1/kPi2
constexpr float kInvPi2 = 1.0f/kPi2;
/// Pi divided by two. pi/2
constexpr float kPiHalf = 1.5707963267948966192313216916398f;

View File

@@ -164,7 +164,7 @@ namespace bx
inline void sinCosApprox(float _a, float* _outSin, float* _outCos)
{
const float aa = _a - floor(_a/kPi2)*kPi2;
const float aa = _a - floor(_a*kInvPi2)*kPi2;
const float absA = abs(aa);
const float cosA = cos(absA);
const float cosASq = square(cosA);