ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/pabopto2bsdf.c
(Generate patch)

Comparing ray/src/cv/pabopto2bsdf.c (file contents):
Revision 2.26 by greg, Thu Aug 21 10:33:48 2014 UTC vs.
Revision 2.27 by greg, Fri Oct 3 21:57:06 2014 UTC

# Line 21 | Line 21 | char                   *progname;
21  
22   typedef struct {
23          const char      *fname;         /* input file path */
24 <        double          theta, phi;     /* input angles */
24 >        double          theta, phi;     /* input angles (degrees) */
25 >        double          up_phi;         /* azimuth for "up" direction */
26          int             igp[2];         /* input grid position */
27          int             isDSF;          /* data is DSF (rather than BSDF)? */
28          long            dstart;         /* data start offset in file */
# Line 60 | Line 61 | init_pabopto_inp(const int i, const char *fname)
61          }
62          inpfile[i].fname = fname;
63          inpfile[i].isDSF = -1;
64 +        inpfile[i].up_phi = 0;
65          inpfile[i].theta = inpfile[i].phi = -10001.;
66                                  /* read header information */
67          while ((c = getc(fp)) == '#' || c == EOF) {
# Line 84 | Line 86 | init_pabopto_inp(const int i, const char *fname)
86                                  continue;
87                          }
88                  }
89 +                if (sscanf(buf, "upphi %lf", &inpfile[i].up_phi) == 1)
90 +                        continue;
91                  if (sscanf(buf, "intheta %lf", &inpfile[i].theta) == 1)
92                          continue;
93                  if (sscanf(buf, "inphi %lf", &inpfile[i].phi) == 1)
# Line 104 | Line 108 | init_pabopto_inp(const int i, const char *fname)
108                  fputs(": unknown incident angle\n", stderr);
109                  return(0);
110          }
111 +                                /* convert to Y-up orientation */
112 +        inpfile[i].phi += 90.-inpfile[i].up_phi;
113                                  /* convert angle to grid position */
114          dv[2] = sin(M_PI/180.*inpfile[i].theta);
115          dv[0] = cos(M_PI/180.*inpfile[i].phi)*dv[2];
# Line 141 | Line 147 | add_pabopto_inp(const int i)
147   #endif
148                                          /* read scattering data */
149          while (fscanf(fp, "%lf %lf %lf\n", &theta_out, &phi_out, &val) == 3)
150 <                add_bsdf_data(theta_out, phi_out, val, inpfile[i].isDSF);
150 >                add_bsdf_data(theta_out, phi_out+90.-inpfile[i].up_phi,
151 >                                val, inpfile[i].isDSF);
152          n = 0;
153          while ((c = getc(fp)) != EOF)
154                  n += !isspace(c);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines