I cannot use the c++ functions sin()
and cos()
due to certain compiler issues caused by PS3 3.40 SDK. What are the calculations of sin()
& cos()
so i can use functions without needing math.h
?
I have so far came up with these, but they seem to not be functioning correctly?
float sin(float deg) {
bool neg = false;
while (deg >= 360) deg = deg - 360;
while (deg < 0) deg = deg + 360;
if (deg > 180) {
deg = deg - 180;
neg = true;
}
float ret = (float)(4*deg*(180-deg))/(40500-(deg*(180-deg)));
if (neg)return ret*-1;
return ret;
}
float cos(float AnglesDeg)
{
float AnglesRad = DegreesToRadians(AnglesDeg);
float Rad = (float)(PI/2.0f)-AnglesRad;
float ang = RadiansToDegrees(Rad);
return sin(ang);
}