Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void f_ball(float sx, float sy, float r, int n)
- {
- al_clear_to_color(black);
- float theta = 0.0;
- float thetainc = 6.283165307/30 ;
- float pX[n], pY[n];
- fstream file;
- file.open("plikxy.txt");
- for(int i=0;i<n;i++)
- {
- theta += thetainc;
- pX[i] = r * cos(theta);
- pX[i] += sx;
- pY[i] = r * sin(theta);
- pY[i] += sy;
- //file<< pX[i] << " " << pY[i] << endl;
- }
- for(int i = 0; i<(n-1); i++)
- {
- for(int j = (i+1); j<n; j++)
- {
- al_draw_line(pX[i], pY[i], pX[j], pY[j], red, 1);
- file<<"Line between "<<pX[i]<<" "<<pY[i]<<" and "<<pX[j]<<" "<<pY[j]<< endl;
- }
- }
- file.close();
- al_flip_display();
- }
Advertisement
Add Comment
Please, Sign In to add comment