Jeu de FPS en multijoueur. Voir la description sur planete casio
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.

#### 118 lines 2.8KB Raw Blame History

 ``````#include "coord.h" #include "FxEngine.h" /* Cosinus and sinus implementation */ /// Math values const double pi=3.141592653589793238462643383279; const double pi2=pi*2; const double pi_sur2=pi/2; /// Internal Use // cos function with 01 for(int p=precision;p>=1;p-=2) u=1-a2/(p*p+p)*u; return u; } // return a with -pi<=api) a-=pi2; return a; } static double cos_recursive(double angle) { if (angle<0) return cos_recursive(-angle); if (angle>=pi_sur2) return -reducted_cos(angle-pi); return reducted_cos(angle); // OK } /// External functions // Official FE_cos function double FE_cos(double angle) { angle=FE_modulo_2pi(angle); return cos_recursive(angle); } // Official FE_sin function double FE_sin(double angle) {return FE_cos(angle-pi_sur2);} #define sgn(x) (x>=0?x:-x) static double matrice[3][3]= { {0,0,0}, {0,0,0}, {0,0,0} }; void FE_calc(FE_point* point) { static FE_position temp; temp.x = point->real.x - FE_user.x; temp.y = point->real.y - FE_user.y; temp.z = point->real.z - FE_user.z; point->rotated.x = (double)(matrice[0][0]*(double)temp.x + matrice[0][1]*(double)temp.y + matrice[0][2]*(double)temp.z); point->rotated.z = (double)(matrice[1][0]*(double)temp.x + matrice[1][1]*(double)temp.y + matrice[1][2]*(double)temp.z); point->rotated.y = (double)(matrice[2][0]*(double)temp.x + matrice[2][1]*(double)temp.y + matrice[2][2]*(double)temp.z); //point->translated.x*=10; //point->translated.y*=10; point->rotated.x*=64; point->rotated.y*=64; point->translated.z=point->rotated.z; if (point->translated.z>0) { point->translated.x=point->rotated.x/point->translated.z; point->translated.y=point->rotated.y/point->translated.z; } else { point->translated.x=point->rotated.x*10000*sgn(point->translated.z); point->translated.y=point->rotated.y*10000*sgn(point->translated.z); } (point->translated.x*1000)/point->translated.z; (point->translated.y*1000)/point->translated.z; point->translated.x+=63; point->translated.y+=31; } // FIABLE void FE_set_matrice(void) { const double A=FE_cos(FE_dv), B=FE_sin(FE_dv); const double C=FE_cos(FE_roulis), D=FE_sin(FE_roulis); const double E=FE_cos(FE_dh), F=FE_sin(FE_dh); const double AD=A*D, BD=B*D; matrice[0][0]=C*E; matrice[0][1]=-C*F; matrice[0][2]=D; matrice[1][0]=BD*E+A*F; matrice[1][1]=-BD*F+A*E; matrice[1][2]=-B*C; matrice[2][0]=-AD*E+B*F; matrice[2][1]=AD*F+B*E; matrice[2][2]=A*C; } ``````