Advertisement
Guest User

Untitled

a guest
Oct 27th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. void RotationCarre(float x,float y,float angle,float Rayon, ML_Color color)
  2. /* Centre abscisse , Centre Ordonné, angle theta, cotéducarré/2 */
  3. {
  4.  float pos[2] = {1,1};
  5.  float angleVector[2] = {1,1};
  6.  float xVertex[4];
  7.  float yVertex[4];
  8.  pos[0] = x;
  9.  pos[1] = y;
  10.  angle = angle*3.14159/180;
  11.  angleVector[0] = Rayon * cos(angle);
  12.  angleVector[1] = -Rayon * sin(angle);
  13.  
  14. xVertex[0] = pos[0] + angleVector[0] - angleVector[1];
  15. xVertex[1] = pos[0] + angleVector[0] + angleVector[1];
  16. xVertex[2] = pos[0] - angleVector[0] + angleVector[1];
  17. xVertex[3] = pos[0] - angleVector[0] - angleVector[1];
  18.      
  19.  yVertex[0] = pos[1] + angleVector[0] + angleVector[1];
  20.  yVertex[1] = pos[1] - angleVector[0] + angleVector[1];
  21.  yVertex[2] = pos[1] - angleVector[0] - angleVector[1];
  22.  yVertex[3] = pos[1] + angleVector[0] - angleVector[1];
  23.  
  24.  ML_polygon(xVertex,yVertex,4,ML_BLACK);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement