remove trig tables, they are unused and alternatives are faster

This commit is contained in:
jacob1 2018-04-28 00:04:42 -04:00
parent d56a4ee378
commit 29920c8999
3 changed files with 0 additions and 5673 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
#include <cmath>
#include "tpt-math.h"
#include "TrigTables.h"
/**
* Fast trig functions, using lookup table
* Only use for things that require no accuracy, like cyclone tool
* Do not use for any core simulation stuff
*/
float orig_atan(float val)
{
return atan(val);
}
namespace tpt
{
float sin(float angle)
{
angle *= 81.4873;
int i = (int)angle % 512;
if (i < 0)
{
i += 512;
}
return sineLookupTable[i];
}
float cos(float angle)
{
angle *= 81.4873;
int i = (int)angle % 512;
if (i < 0)
{
i += 512;
}
return cosineLookupTable[i];
}
float tan(float angle)
{
angle *= 81.4873;
int i = (int)angle % 512;
if (i < 0)
{
i += 512;
}
return tanLookupTable[i];
}
float atan(float ratio)
{
if (ratio > 20)
{
return orig_atan(ratio);
}
if (ratio < -20)
{
return orig_atan(ratio);
}
return atanLookupTable[(int)(ratio * 100) + 2000];
}
float atan2(float y, float x)
{
if (x > 0)
{
return tpt::atan(y / x);
}
else if (x < 0)
{
if (y >= 0)
{
return tpt::atan(y / x) + M_PI;
}
return tpt::atan(y / x) - M_PI;
}
else if (y > 0)
return M_PI_2;
else if (y < 0)
return M_PI_2;
else
return 0.0f;
}
}

View File

@ -1,28 +0,0 @@
#ifndef TPT_MATH_
#define TPT_MATH_
#ifndef M_PI
#define M_PI 3.14159265f
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079633f
#endif
namespace tpt
{
float sin(float angle);
float cos(float angle);
float tan(float angle);
float asin(float angle);
float acos(float angle);
float atan(float ratio);
float atan2(float y, float x);
}
#endif /* TPT_MATH_ */