Files
tp/include/JSystem/JMath/JMATrigonometric.h
T

45 lines
917 B
C++
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef JMATRIGONOMETRIC_H
#define JMATRIGONOMETRIC_H
#include "dolphin/types.h"
#include "MSL_C/utility.h"
struct TSinCosTable {
std::pair<f32, f32> table[0x2000];
2021-12-23 20:56:02 -08:00
f32 sinShort(s16 v) const { return table[static_cast<u16>(v) >> 3].first; }
f32 cosShort(s16 v) const { return table[static_cast<u16>(v) >> 3].second; }
};
struct TAtanTable {
f32 table[1025];
u8 pad[0x1C];
};
struct TAsinAcosTable {
f32 table[1025];
u8 pad[0x1C];
};
namespace JMath {
extern TSinCosTable sincosTable_;
extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath
2023-02-26 22:18:40 -08:00
inline f32 JMASCosShort(s16 v) {
return JMath::sincosTable_.cosShort(v);
}
inline f32 JMASinShort(s16 v) {
return JMath::sincosTable_.sinShort(v);
2021-12-23 20:56:02 -08:00
}
2023-02-26 22:18:40 -08:00
inline f32 JMASCos(s16 v) {
return JMASCosShort(v);
}
inline f32 JMASSin(s16 v) {
return JMASinShort(v);
2021-12-23 20:56:02 -08:00
}
2021-03-28 22:49:05 +02:00
#endif /* JMATRIGONOMETRIC_H */