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

Comparing ray/src/cv/bsdf2rad.c (file contents):
Revision 2.8 by greg, Mon Mar 24 05:36:40 2014 UTC vs.
Revision 2.9 by greg, Mon Mar 24 06:07:46 2014 UTC

# Line 94 | Line 94 | main(int argc, char *argv[])
94          min_log = log(bsdf_min*.5 + 1e-5);
95                                                  /* output BSDF rep. */
96          for (n = 0; (n < 6) & (2*n+3 < argc); n++) {
97 <                double  theta = atof(argv[2*n+2]);
97 >                double  theta = (M_PI/180.)*atof(argv[2*n+2]);
98 >                double  phi = (M_PI/180.)*atof(argv[2*n+3]);
99 >                if (theta < -FTINY) {
100 >                        fprintf(stderr, "%s: theta values must be positive\n",
101 >                                        progname);
102 >                        return(1);
103 >                }
104                  if (inpXML) {
105 <                        input_orient = (theta <= 90.) ? 1 : -1;
105 >                        input_orient = (theta <= M_PI/2.) ? 1 : -1;
106                          output_orient = doTrans ? -input_orient : input_orient;
107                  }
108 <                idir[2] = sin((M_PI/180.)*theta);
109 <                idir[0] = idir[2] * cos((M_PI/180.)*atof(argv[2*n+3]));
110 <                idir[1] = idir[2] * sin((M_PI/180.)*atof(argv[2*n+3]));
108 >                idir[2] = sin(theta);
109 >                idir[0] = idir[2] * cos(phi);
110 >                idir[1] = idir[2] * sin(phi);
111                  idir[2] = input_orient * sqrt(1. - idir[2]*idir[2]);
112   #ifdef DEBUG
113                  fprintf(stderr, "Computing BSDF for incident direction (%.1f,%.1f)\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines