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

Comparing ray/src/common/bsdf_m.c (file contents):
Revision 3.16 by greg, Thu Jun 9 17:09:39 2011 UTC vs.
Revision 3.21 by greg, Wed May 2 16:28:45 2012 UTC

# Line 87 | Line 87 | fequal(double a, double b)
87          return (a <= 1e-6) & (a >= -1e-6);
88   }
89  
90 /* Returns the name of the given tag */
91 #ifdef ezxml_name
92 #undef ezxml_name
93 static char *
94 ezxml_name(ezxml_t xml)
95 {
96        if (xml == NULL)
97                return NULL;
98        return xml->name;
99 }
100 #endif
101
90   /* Returns the given tag's character content or empty string if none */
91   #ifdef ezxml_txt
92   #undef ezxml_txt
# Line 190 | Line 178 | fo_getndx(const FVECT v, void *p)
178   {
179          ANGLE_BASIS     *ab = (ANGLE_BASIS *)p;
180          int     li, ndx;
181 <        double  pol, azi, d;
181 >        double  pol, azi;
182  
183          if (v == NULL)
184                  return -1;
# Line 230 | Line 218 | io_getohm(int ndx, void *p)
218          if (li == last_li)                      /* cached latitude? */
219                  return last_ohm;
220          last_li = li;
233        theta1 = M_PI/180. * ab->lat[li+1].tmin;
234        if (ab->lat[li].nphis == 1)             /* special case */
235                return last_ohm = M_PI*(1. - sq(cos(theta1)));
221          theta = M_PI/180. * ab->lat[li].tmin;
222 +        theta1 = M_PI/180. * ab->lat[li+1].tmin;
223          return last_ohm = M_PI*(sq(cos(theta)) - sq(cos(theta1))) /
224                                  (double)ab->lat[li].nphis;
225   }
# Line 347 | Line 333 | load_angle_basis(ezxml_t wab)
333                                  ezxml_child(ezxml_child(wbb,
334                                          "ThetaBounds"), "UpperTheta")));
335                  if (!i)
336 <                        abase_list[nabases].lat[i].tmin =
351 <                                        -abase_list[nabases].lat[i+1].tmin;
336 >                        abase_list[nabases].lat[0].tmin = 0;
337                  else if (!fequal(atof(ezxml_txt(ezxml_child(ezxml_child(wbb,
338                                          "ThetaBounds"), "LowerTheta"))),
339                                  abase_list[nabases].lat[i].tmin)) {
# Line 610 | Line 595 | SDloadMtx(SDData *sd, ezxml_t wtl)
595                                  sd->name);
596                  return SDEsupport;
597          }
598 <                                        /* get angle basis */
599 <        rval = load_angle_basis(ezxml_child(ezxml_child(wtl,
600 <                                "DataDefinition"), "AngleBasis"));
601 <        if (rval < 0)
602 <                return convert_errcode(rval);
598 >                                        /* get angle bases */
599 >        for (wld = ezxml_child(ezxml_child(wtl, "DataDefinition"), "AngleBasis");
600 >                                wld != NULL; wld = wld->next) {
601 >                rval = load_angle_basis(wld);
602 >                if (rval < 0)
603 >                        return convert_errcode(rval);
604 >        }
605                                          /* load BSDF components */
606          for (wld = ezxml_child(wtl, "WavelengthData");
607                                  wld != NULL; wld = wld->next) {
# Line 769 | Line 756 | SDgetMtxCDist(const FVECT inVec, SDComponent *sdc)
756          }
757          cdlast = NULL;                  /* check for it in cache list */
758          for (cd = (SDMatCDst *)sdc->cdList; cd != NULL;
759 <                                cdlast = cd, cd = (SDMatCDst *)cd->next)
759 >                                        cdlast = cd, cd = cd->next)
760                  if (cd->indx == myCD.indx && (cd->calen == myCD.calen) &
761                                          (cd->ob_priv == myCD.ob_priv) &
762                                          (cd->ob_vec == myCD.ob_vec))
# Line 788 | Line 775 | SDgetMtxCDist(const FVECT inVec, SDComponent *sdc)
775          }
776          if (cdlast != NULL) {           /* move entry to head of cache list */
777                  cdlast->next = cd->next;
778 <                cd->next = sdc->cdList;
778 >                cd->next = (SDMatCDst *)sdc->cdList;
779                  sdc->cdList = (SDCDst *)cd;
780          }
781          return (SDCDst *)cd;            /* ready to go */
# Line 808 | Line 795 | SDsampMtxCDist(FVECT ioVec, double randX, const SDCDst
795                                          /* binary search to find index */
796          ilower = 0; iupper = mcd->calen;
797          while ((i = (iupper + ilower) >> 1) != ilower)
798 <                if ((long)target >= (long)mcd->carr[i])
798 >                if (target >= mcd->carr[i])
799                          ilower = i;
800                  else
801                          iupper = i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines