home *** CD-ROM | disk | FTP | other *** search
/ The Party 1994: Try This At Home / disk_image.bin / source / cloak / mapping.c < prev    next >
C/C++ Source or Header  |  1994-12-09  |  925b  |  43 lines

  1. #include <math.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. int main (int argc, char** argv)
  7.   {
  8.   double Angle;
  9.   long dx, dy, dt;
  10.   int cMapping;
  11.   int i, j;
  12.  
  13.   if (argc==3)
  14.     {
  15.     srand (atoi(argv[2]));
  16.     argc--;
  17.     }
  18.   else
  19.     srand (time(NULL));
  20.   if (argc == 2)
  21.     {
  22.     cMapping=atoi(argv[1]);
  23.     if (cMapping>8)
  24.       cMapping=8;
  25.     for (i=0; i<cMapping; i++)
  26.       {
  27.       for (j=0; j<3; j++)
  28.         {
  29.         Angle=(double)rand()/RAND_MAX*2*M_PI;
  30.         dx=(long)(sin(Angle)*4*65536);
  31.         dy=(long)(cos(Angle)*4*65536);
  32.         dt=(long)((double)rand()*1.5/RAND_MAX*524288-262144);
  33.         printf ("Ydx%1d%1d =\t\t%ld\n", i, j, dx);
  34.         printf ("Ydy%1d%1d =\t\t%ld\n", i, j, dy);
  35.         printf ("Ydt%1d%1d =\t\t%ld\n", i, j, dt);
  36.         printf ("Yt%1d%1d dd\t\t0\n", i, j);
  37.         }
  38.       printf ("\n");
  39.       }
  40.     }
  41.   return 0;
  42.   }
  43.