home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 015.lha / tracer_source / g_bod.c < prev    next >
C/C++ Source or Header  |  1986-11-10  |  1KB  |  57 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3. #include "MyMath.h"
  4. #include "rtd.h"
  5. #include "extern.h"
  6. #include "macros.h"
  7.  
  8. FFP    big, little;
  9.  
  10.  
  11. g_bod (f)/* credit for this goes to rich stewart, who wanted to
  12.           do susie in the first place */
  13. FILE * f;
  14. {
  15.     int     x, y;
  16.     char    k;
  17.     char    buf[512];
  18.  
  19.  
  20.     big = SPFlt(0);
  21.     little = ieee_to_ffp(HUGE);
  22.  
  23.     for (ysue = 0; ysue<300; ysue++) {
  24.     if (fgets (buf, 512, f) == NULL)
  25.         break;
  26.  
  27.     /*get rid of EOL that leaves nasty black dots*/
  28.     xsue = strlen (buf) - 1;
  29.  
  30.     for (x = 0; x < xsue; x++) {
  31.  
  32.         k = buf[x];
  33.  
  34.         suzie[x][ysue] = k;
  35.  
  36.         if (SPFix(big) < k)
  37.         big = SPFlt(k);
  38.  
  39.         if (SPFix(little) > k)
  40.         little = SPFlt(k);
  41.     }
  42.     }
  43.  
  44.     /* expand dynamic range to maximum:0.0-1.0*/
  45. /*
  46.     big = big - little;
  47.  
  48.     for (y = 0; y < ysue; y++) {
  49.     for (x = 0; x < xsue; x++) {
  50.         temp = ( (float)(suzie[x][y]) - little) / big ;
  51.         suzie[x][y] = (char) ( temp * 255.0 );
  52.     }
  53.         printf("%f ==> %ud, %f\n", temp, (k=suzie[x][y]), (k/255.0) );
  54.     }
  55. */
  56. }
  57.