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

Comparing ray/src/gen/mkillum4.c (file contents):
Revision 2.9 by greg, Fri Jan 25 02:11:13 2008 UTC vs.
Revision 2.11 by greg, Fri Apr 11 20:07:12 2008 UTC

# Line 11 | Line 11 | static const char RCSid[] = "$Id$";
11  
12   #define MAXLATS         46              /* maximum number of latitudes */
13  
14 < /* BSDF angle specification (terminate with nphi = -1) */
14 > /* BSDF angle specification */
15   typedef struct {
16          char    name[64];               /* basis name */
17          int     nangles;                /* total number of directions */
# Line 77 | Line 77 | ab_getvec(             /* get vector for this angle basis index *
77                  ndx -= ab->lat[li].nphis;
78          alt = PI/180.*0.5*(ab->lat[li].tmin + ab->lat[li+1].tmin);
79          azi = 2.*PI*ndx/ab->lat[li].nphis;
80 <        d = sin(alt);
80 >        v[2] = d = cos(alt);
81 >        d = sqrt(1. - d*d);     /* sin(alt) */
82          v[0] = cos(azi)*d;
83          v[1] = sin(azi)*d;
83        v[2] = cos(alt);
84          return(1);
85   }
86  
# Line 151 | Line 151 | ab_getvecR(            /* get reverse vector for this angle basi
151  
152          v[0] = -v[0];
153          v[1] = -v[1];
154 +        v[2] = -v[2];
155  
156          return(1);
157   }
# Line 166 | Line 167 | ab_getndxR(            /* get index corresponding to the reverse
167          
168          v2[0] = -v[0];
169          v2[1] = -v[1];
170 <        v2[2] = v[2];
170 >        v2[2] = -v[2];
171  
172          return ab_getndx(v2, p);
173   }
# Line 192 | Line 193 | load_bsdf_data(                /* load BSDF distribution for this wa
193                  if (!strcmp(cbasis, abase_list[i].name)) {
194                          dp->ninc = abase_list[i].nangles;
195                          dp->ib_priv = (void *)&abase_list[i];
196 <                        dp->ib_vec = ab_getvec;
197 <                        dp->ib_ndx = ab_getndx;
196 >                        dp->ib_vec = ab_getvecR;
197 >                        dp->ib_ndx = ab_getndxR;
198                          dp->ib_ohm = ab_getohm;
199                          break;
200                  }
# Line 206 | Line 207 | load_bsdf_data(                /* load BSDF distribution for this wa
207                  if (!strcmp(rbasis, abase_list[i].name)) {
208                          dp->nout = abase_list[i].nangles;
209                          dp->ob_priv = (void *)&abase_list[i];
210 <                        dp->ob_vec = ab_getvecR;
211 <                        dp->ob_ndx = ab_getndxR;
210 >                        dp->ob_vec = ab_getvec;
211 >                        dp->ob_ndx = ab_getndx;
212                          dp->ob_ohm = ab_getohm;
213                          break;
214                  }
# Line 254 | Line 255 | load_BSDF(             /* load BSDF data from file */
255   )
256   {
257          char                    *path;
258 <        ezxml_t                 fl, wld, wdb;
258 >        ezxml_t                 fl, wtl, wld, wdb;
259          struct BSDF_data        *dp;
260          
261          path = getpath(fname, getrlibpath(), R_OK);
# Line 270 | Line 271 | load_BSDF(             /* load BSDF data from file */
271                  return(NULL);
272          }
273          if (ezxml_error(fl)[0]) {
274 <                sprintf(errmsg, "BSDF \"%s\": %s", path, ezxml_error(fl));
274 >                sprintf(errmsg, "BSDF \"%s\" %s", path, ezxml_error(fl));
275                  error(WARNING, errmsg);
276                  ezxml_free(fl);
277                  return(NULL);
278          }
279 +        if (strcmp(ezxml_name(fl), "WindowElement")) {
280 +                sprintf(errmsg,
281 +                        "BSDF \"%s\": top level node not 'WindowElement'",
282 +                                path);
283 +                error(WARNING, errmsg);
284 +                ezxml_free(fl);
285 +                return(NULL);
286 +        }
287 +        wtl = ezxml_child(ezxml_child(fl, "Optical"), "Layer");
288          dp = (struct BSDF_data *)calloc(1, sizeof(struct BSDF_data));
289 <        for (wld = ezxml_child(fl, "WavelengthData");
289 >        for (wld = ezxml_child(wtl, "WavelengthData");
290                                  wld != NULL; wld = wld->next) {
291                  if (strcmp(ezxml_txt(ezxml_child(wld,"Wavelength")), "Visible"))
292                          continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines