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.
|
|
|
|
#include "emath.h"
|
|
|
|
|
|
|
|
|
|
// 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:
|
|
|
|
|
// std::cout << "ssin sollte keinen defaultwert zur<75>ckliefern. c=" << c << ", t=" << t << std::endl;
|
|
|
|
|
return sin(deg2rad(c));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float scos(float c) {
|
|
|
|
|
return ssin(c+90.0f);
|
|
|
|
|
}
|