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

Comparing ray/src/util/rsensor.c (file contents):
Revision 2.10 by greg, Thu May 19 16:09:38 2011 UTC vs.
Revision 2.13 by greg, Wed Oct 16 04:35:50 2013 UTC

# Line 398 | Line 398 | init_ptable(
398                  tvals[i] = 1. - ( (1.-frac)*cos(thdiv[t]) +
399                                                  frac*cos(thdiv[t+1]) );
400                                  /* offset b/c sensor values are centered */
401 <                if (!t || (t < sntp[0]-1) & (frac >= 0.5))
402 <                        frac -= 0.5;
403 <                else {
401 >                if ((t < sntp[0]-1) & (frac >= 0.5)) {
402 >                        if ((frac -= 0.5) < 0)
403 >                                frac = 0;
404 >                } else {
405                          frac += 0.5;
406                          --t;
407                  }
# Line 470 | Line 471 | sens_val(
471          int     t, p;
472          
473          dv[2] = DOT(dvec, ourview.vdir);
474 <        theta = (float)((1./DEGREE) * acos(dv[2]));
474 >        theta = acos(dv[2]);
475          if (theta >= maxtheta)
476                  return(.0f);
477          dv[0] = DOT(dvec, ourview.hvec);
478          dv[1] = DOT(dvec, ourview.vvec);
479 <        phi = (float)((1./DEGREE) * atan2(-dv[0], dv[1]));
480 <        while (phi < .0f) phi += 360.f;
479 >        phi = atan2(-dv[0], dv[1]);
480 >        while (phi < .0f) phi += (float)(2.*PI);
481          t = (int)(theta/maxtheta * sntp[0]);
482 <        p = (int)(phi*(1./360.) * sntp[1]);
482 >        p = (int)(phi*(1./(2.*PI)) * sntp[1]);
483                          /* hack for non-uniform sensor grid */
484 +        theta *= (float)(1./DEGREE);
485 +        phi *= (float)(1./DEGREE);
486          while (t+1 < sntp[0] && theta >= s_theta(t+1))
487                  ++t;
488          while (t-1 >= 0 && theta <= s_theta(t-1))
# Line 542 | Line 545 | comp_sensor(
545                                  continue;
546                          }
547                          rr.rmax = .0;
548 <                        rayorigin(&rr, PRIMARY, NULL, NULL);
548 >                        rayorigin(&rr, PRIMARY|SPECULAR, NULL, NULL);
549                          scalecolor(rr.rcoef, sf);
550                          if (ray_pqueue(&rr) == 1)
551                                  addcolor(vsum, rr.rcol);
# Line 558 | Line 561 | comp_sensor(
561                          continue;
562                  }
563                  rr.rmax = .0;
564 <                rayorigin(&rr, PRIMARY, NULL, NULL);
564 >                rayorigin(&rr, PRIMARY|SPECULAR, NULL, NULL);
565                  scalecolor(rr.rcoef, sf);
566                  if (ray_pqueue(&rr) == 1)
567                          addcolor(vsum, rr.rcol);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines