Files
ss/include/egg/math/eggMath.h
T
Elijah Thomas dc221b4795 Misc Egg (#37)
* EGG: Archive, DvdFile, DvdRipper

* start eggStream

* FrmHeap and AssertHeap OK

* progress on EggController

* port in WPAD stuff

* update WPAD/WUD/KPAD/SC symbols

* eggController OK

* bytematch more CoreController virtual funcs

* eggDecomp/eggStreamDecomp Ok

* eggDvdRipper OK

* EGG gfx splits

* Finished Splitting EGG

* create egg Files

* eggDecomp.h -> eggStreamDecomp.h

* Revert some format changes
2024-10-01 20:24:25 -04:00

71 lines
1.2 KiB
C++

#ifndef EGG_MATH_H
#define EGG_MATH_H
#include <MSL_C/float.h>
#include <common.h>
namespace EGG {
template <typename T>
class Math {
public:
static T maxNumber() {
// TODO: Generalize to other classes
// This is low priority since it will always be a float
return 3.402823466e+38f;
}
static T pi() {
return 3.14159265f;
}
static T pi_half() {
return pi() / 2.0f;
}
static T epsilon() {
return 1.192092896e-07f;
}
static T inv(T t) {
return 1 / t;
}
static T abs(T t) {
return t > (T)0 ? t : -t;
}
static T zero() {
return (T)0;
}
static T sqrt(T);
static T sin(T);
static T cos(T);
static T tan(T);
static T asin(T);
static T acos(T);
static T atan2(T, T);
static T log10(T);
static T gcd(T, T);
static T lcm(T, T);
};
// There is
// Math<f32>::zero
// Math<f32>::pi_half
// Math<f32>::neg(f32)
// Math<f32>::abs(f32)
// f32 impls
// /* 8049ab60 */ Math<f32>::sqrt(f32);
// /* 8049abb0 */ Math<f32>::sin(f32);
// /* 8049abe0 */ Math<f32>::cos(f32);
// /* 8049ac10 */ Math<f32>::acos(f32);
// /* 8049ac40 */ Math<f32>::atan2(f32, f32);
} // namespace EGG
#endif