21 lines
579 B
C++
21 lines
579 B
C++
#include <proto/trig.hpp>
|
|
#include <proto/angles.hpp>
|
|
#include <proto/fixed.hpp>
|
|
#include <common/math.hpp>
|
|
|
|
void TrigTable::build(const Angles &angles)
|
|
{
|
|
double angleRad;
|
|
|
|
angle360(angles.angle360());
|
|
mCosTable.size(angles.angle360());
|
|
mSinTable.size(angles.angle360());
|
|
for(int currAngle=0;currAngle<angles.angle360();currAngle++)
|
|
{
|
|
angleRad=Math::pi2()*(double)currAngle/(double)angles.angle360();
|
|
mCosTable.operator[](currAngle)=(int)(Math::cos(angleRad)*FixedPoint::FPMul);
|
|
mSinTable.operator[](currAngle)=(int)(Math::sin(angleRad)*FixedPoint::FPMul);
|
|
}
|
|
}
|
|
|