Initial
This commit is contained in:
20
proto/source/TRIG.CPP
Normal file
20
proto/source/TRIG.CPP
Normal file
@@ -0,0 +1,20 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user