Back to index

radiance  4R0+20100331
conv2.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 main()
00003 {
00004        int    c, n, x, y;
00005        char   com[256];
00006        FILE   *fp, *popen();
00007 
00008        while (scanf("%d", &c) == 1) {
00009               if (c=='E'||c=='X'||c=='I'||c=='T') {
00010        sprintf(com, "genprism alpha_mat %c - -c -l 0 0 .1 > %c.new", c, c);
00011                      fp = popen(com, "w");
00012               } else
00013                      fp = NULL;
00014               n = 0;
00015               scanf("%d", &n);
00016               while (n-- > 0) {
00017                      scanf("%d %d", &x, &y);
00018                      if (fp != NULL)
00019                             fprintf(fp, "%f %f\n", x/256.,y*(2/256.));
00020               }
00021               if (fp != NULL)
00022                      pclose(fp);
00023        }
00024 }