Untitled


SUBMITTED BY: Guest

DATE: March 3, 2014, 12:04 p.m.

FORMAT: C++

SIZE: 644 Bytes

HITS: 1678

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5. static unsigned char data[100 * 800];
  6. inline void SetAtXY(int x, int y){
  7. data[(x/8)+(y*100)] |= 1<<(7-(x%8));
  8. }
  9. #define CONV_RAD (3.1415926f/180.0f)
  10. int main(void){
  11. float i;
  12. float dist = 360.0f;
  13. #define LOOPS 8
  14. for (i=0;i<LOOPS*360.0f;i+=0.001f){
  15. dist-=0.001f*(1.0f/LOOPS);
  16. SetAtXY( dist*sin((float)i*CONV_RAD) + 400 , dist*cos((float)i*CONV_RAD) + 400 );
  17. }
  18. FILE *fp = fopen("result.pbm","wb");
  19. fprintf(fp, "P4\n800 800\n");
  20. fwrite(data, 1, 80000, fp);
  21. fclose(fp);
  22. }

comments powered by Disqus