home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / w / w023 / 5.ddi / CELPOC.001 / QARKORBS.POC < prev    next >
Encoding:
Text File  |  1990-07-18  |  939 b   |  54 lines

  1. /* recursive orbiter */
  2.  
  3. double twopi;
  4.  
  5. #define TWOPI (2*3.14159)
  6.  
  7. rorbit(double cx, double cy, int color, int prad, double orad, double frame, double total)
  8. {
  9. double angle;
  10.  
  11.  
  12. SetColor(color);
  13. Circle(cx,cy,prad);
  14. if (prad < 1)
  15.     return;
  16. angle = TWOPI*frame/total;
  17. rorbit(cx+orad*cos(angle),cy+orad*sin(angle),color+6,
  18.     prad/2,orad/3,frame,total/2);
  19. angle *= 2;
  20. rorbit(cx+orad*5/2*cos(angle), cy+orad*5/2*sin(angle),
  21.     color+3, prad/3, orad/3, frame, total/3);
  22. }
  23.  
  24. typedef struct
  25.     {
  26.     int objrad;
  27.     int orbrad;
  28.     int traces;
  29.     int cenx, ceny;
  30.     } OrbData;
  31.  
  32. OrbFunc(double time, OrbData *od)
  33. {
  34. int i;
  35.  
  36. for (i=0; i<od->traces; i++)
  37.     rorbit(od->cenx,od->ceny,100,od->objrad,time*od->orbrad,i,od->traces);
  38. }
  39.  
  40. main()
  41. {
  42. int i;
  43. int frames = 132;
  44. OrbData od;
  45.  
  46. GetSize(&od.cenx, &od.ceny);
  47. od.cenx /= 2;
  48. od.ceny /= 2;
  49. od.objrad = 32;
  50. od.orbrad = frames;
  51. od.traces = 32;
  52. OverTime(OrbFunc,&od);
  53. }
  54.