home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / CMU / cmu_files / cal / test.h < prev   
Text File  |  1990-12-11  |  854b  |  35 lines

  1. #define LEFT         0
  2. #define RIGHT        1
  3.  
  4. #define NUMDISTORTIONPOLYS    4
  5. #define UNDISTORT(eye)        ((eye == LEFT) ? 0 : 1)
  6. #define DISTORT(eye)        ((eye == LEFT) ? 2 : 3)
  7.  
  8. /* ideal to XY */ 
  9. #define IXY(x1,y1,x2,y2,eye) \
  10.     coordsel(DISTORT(eye)); \
  11.     coordmap1((double)x1, (double)y1, &x2, &y2);
  12.  
  13. /* XY to ideal */
  14. #define XYI(x1,y1,x2,y2,eye) \
  15.     coordsel(UNDISTORT(eye)); \
  16.     coordmap1((double)x1, (double)y1, &x2, &y2);
  17.  
  18. /* ideal to row-column */ 
  19. #define IRC(x,y,r,c,eye) {\
  20.     double xt, yt; \
  21.     coordsel (DISTORT(eye)); \
  22.     coordmap1((double)x, (double)y, &xt, &yt); \
  23.     r = (0.5 - yt) * (maxrow+1) + 0.5; \
  24.     c = (0.5 + xt) * (maxcol+1) + 0.5; \
  25. }
  26.  
  27. /* row-column to ideal */ 
  28. #define RCI(r,c,x,y,eye) {\
  29.     double xt, yt; \
  30.     xt = (c)/(double)(maxcol+1) - 0.5; \
  31.     yt = 0.5 - (r)/(double)(maxrow+1); \
  32.     coordsel (UNDISTORT(eye)); \
  33.     coordmap1(xt, yt, &x, &y); \
  34. }
  35.