Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <cstdio>
- int main()
- {
- struct point
- {
- float x_pos;
- float y_pos;
- };
- point points[8];
- points[0].x_pos = -200.0f;
- points[0].y_pos = -200.0f;
- points[1].x_pos = 0.0f;
- points[1].y_pos = -200.0f;
- points[2].x_pos = 200.0f;
- points[2].y_pos = -200.0f;
- points[3].x_pos = 200.0f;
- points[3].y_pos = 0.0f;
- points[4].x_pos = 200.0f;
- points[4].y_pos = 200.0f;
- points[5].x_pos = 0.0f;
- points[5].y_pos = 200.0f;
- points[6].x_pos = -200.0f;
- points[6].y_pos = 200.0f;
- points[7].x_pos = -200.0f;
- points[7].y_pos = 0.0f;
- float store_atan[8];
- float store_atan2f[8];
- int i;
- for(i = 0; i < 8; i++)
- {
- store_atan[i] = atanf(points[i].y_pos / points[i].x_pos);
- store_atan2f[i] = atan2f(points[i].y_pos, points[i].x_pos);
- }
- for(i = 0; i < 8; i++)
- {
- printf("store_atan[%d] = %.4f\n", i, store_atan[i]);
- printf("store_atan2f[%d] = %.4f\n\n", i, store_atan2f[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement