You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
578 B

#include "emath.h"
namespace segl {
// Trigonometrische Funktionen
float deg2rad(float deg) {
return (deg/180.0f)*3.1415926535897932384626433f;
}
float rad2deg(float rad) {
return (rad/3.1415926535897932384626433f)*180.0f;
}
float ssin(float c) {
int t=(int)c;
if(t!=c)
return sin(deg2rad(c));
t = t % 360;
if(t<0)
t = 360 + t;
switch(t) {
case 0:
return 0.0f;
case 90:
return 1.0f;
case 180:
return 0.0f;
case 270:
return -1.0f;
default:
return sin(deg2rad(c));
}
}
float scos(float c) {
return ssin(c+90.0f);
}
} // namespace segl