daily pastebin goal
34%
SHARE
TWEET

stack-overflow

a guest Nov 17th, 2012 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void f_ball(float sx, float sy, float r, int n)
  2. {      
  3.          al_clear_to_color(black);
  4.          float theta = 0.0;
  5.          float thetainc = 6.283165307/30 ;
  6.          float pX[n], pY[n];
  7.          fstream file;
  8.          file.open("plikxy.txt");
  9.          for(int i=0;i<n;i++)
  10.          {
  11.                         theta += thetainc;
  12.                         pX[i] = r * cos(theta);
  13.                         pX[i] += sx;
  14.                         pY[i] = r * sin(theta);
  15.                         pY[i] += sy;
  16.                         //file<< pX[i] << " " << pY[i] << endl;
  17.         }
  18.        
  19.         for(int i = 0; i<(n-1); i++)
  20.         {
  21.                 for(int j = (i+1); j<n; j++)
  22.                 {
  23.                         al_draw_line(pX[i], pY[i], pX[j], pY[j], red, 1);
  24.                         file<<"Line between "<<pX[i]<<" "<<pY[i]<<" and "<<pX[j]<<" "<<pY[j]<< endl;
  25.                 }
  26.         }
  27.         file.close();
  28.         al_flip_display();
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top