Skip to content
Snippets Groups Projects
Commit 65c3e873 authored by Taha Belkhiri's avatar Taha Belkhiri
Browse files

ajout fonction trajectoire

parent 97f33067
Branches
No related tags found
No related merge requests found
......@@ -9,6 +9,12 @@ void initBall (){
}
double f(int x, float xc, float yc, float xf, float yf, float xt, float yt){
double returnValue = yf * ((x - xc)/(xf - xc)) * ((x - xt)/(xf - xt)) + yc * ((x - xf)/(xc - xf)) * ((x - xt)/(xc - xt)) + yt * ((x - xc)/(xt - xc)) * ((x - xf)/(xt - xf));
return returnValue;
}
void laGrange (float beta[3],float Z[3]){ // y , x
printf("x canon : %f, x chute : %f, x filet : %f\n", Z[0], Z[1], Z[2]);
printf("y canon : %f, y chute : %f, y filet : %f\n", beta[0], beta[1], beta[2]);
......@@ -43,6 +49,9 @@ void calculationTrajectory(canon_t canon, int xDropPoint, int yDropPoint){
float setUp[2][3];
float distance= (float)(yDropPoint-canon.y);
printf("test : %f\n", y);
trajectory[0][0]=canon.y;
trajectory[0][1]=canon.x;
......@@ -70,7 +79,7 @@ void calculationTrajectory(canon_t canon, int xDropPoint, int yDropPoint){
laGrange(setUp[1],setUp[0]); //laGrange(y, x);
printf("coef a:%f; coef b:%f; coef c:%f\n", coefLagrange.a, coefLagrange.b, coefLagrange.c);
//printf("coef a:%f; coef b:%f; coef c:%f\n", coefLagrange.a, coefLagrange.b, coefLagrange.c);
float step= distance / (NUMBERPOINT-1);
......
......@@ -251,7 +251,7 @@ void drawTrajectoireSideView(){
);
for(int i=0; i<NUMBERPOINT-1; i++){
printf("point %d (%d, %d)\n", i, trajectory[i][0], trajectory[i][1]);
//printf("point %d (%d, %d)\n", i, trajectory[i][0], trajectory[i][1]);
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
SDL_RenderDrawLine(renderer, trajectory[i][0], trajectory[i][1], trajectory[i+1][0], trajectory[i+1][1]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment