diff --git a/src/FxEngine/FxEngine.c b/src/FxEngine/FxEngine.c index 8c1441d..d7f705c 100644 --- a/src/FxEngine/FxEngine.c +++ b/src/FxEngine/FxEngine.c @@ -1,4 +1,5 @@ #include "FxEngine.h" + #include #include diff --git a/src/FxEngine/math/functions.c b/src/FxEngine/math/functions.c new file mode 100644 index 0000000..702e007 --- /dev/null +++ b/src/FxEngine/math/functions.c @@ -0,0 +1,43 @@ +#include "functions.h" + +static const double pi2=pi*2; +static const double pi_sur2=pi/2; +// cos (01 + for(int p=13;p>=1;p-=2) + u=1-a2/(p*p+p)*u; + return u; +} + +static void modulo_2pi(double& a) +{ + while (a<=-pi2) a+=pi2; + while (a>pi2) a-=pi2; + return a; +} + +double FE_cos(double angle) +{ + modulo_2pi(angle); + int angle_arrondi=(int)(angle/pi_sur2); + switch (angle_arrondi) + { + case -2: + case 1: + return -reducted_cos(angle); + case -1: + case 0: + return reducted_cos(angle); + } +} + +double FE_sin(double angle) +{ + return FE_cos(angle-pi_sur2); +} diff --git a/src/FxEngine/math/functions.h b/src/FxEngine/math/functions.h new file mode 100644 index 0000000..dc5049a --- /dev/null +++ b/src/FxEngine/math/functions.h @@ -0,0 +1,12 @@ +#ifndef FE_FUNCTIONS_H +#define FE_FUNCTIONS_H + +const extern double pi=3.141592653589793238462643383279 + +double FE_cos(double angle); +double FE_sin(double angle); + + + + +#endif \ No newline at end of file