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

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 2.73 by greg, Fri Oct 14 00:54:21 2016 UTC vs.
Revision 2.75 by greg, Sat Oct 15 14:54:39 2016 UTC

# Line 58 | Line 58 | ambcollision(                          /* proposed direciton collides? */
58          FVECT   dv
59   )
60   {
61 <        const double    cos_thresh = 0.9999995; /* about 3.44 arcminutes */
62 <        int             ii, jj;
63 <
61 >        double  cos_thresh;
62 >        int     ii, jj;
63 >                                        /* min. spacing = 1/4th division */
64 >        cos_thresh = (PI/4.)/(double)hp->ns;
65 >        cos_thresh = 1. - .5*cos_thresh*cos_thresh;
66 >                                        /* check existing neighbors */
67          for (ii = i-1; ii <= i+1; ii++) {
68                  if (ii < 0) continue;
69                  if (ii >= hp->ns) break;
# Line 72 | Line 75 | ambcollision(                          /* proposed direciton collides? */
75                          if (jj >= hp->ns) break;
76                          if ((ii==i) & (jj==j)) continue;
77                          ap = &ambsam(hp,ii,jj);
78 <                        if (ap->d <= .5/FHUGE) continue;
78 >                        if (ap->d <= .5/FHUGE)
79 >                                continue;       /* no one home */
80                          VSUB(avec, ap->p, hp->rp->rop);
81                          dprod = DOT(avec, dv);
82                          if (dprod >= cos_thresh*VLEN(avec))
83                                  return(1);      /* collision */
84                  }
85          }
86 <        return(0);
86 >        return(0);                      /* nothing to worry about */
87   }
88  
89  
# Line 122 | Line 126 | resample:
126                                          /* avoid coincident samples */
127          if (!n && ambcollision(hp, i, j, ar.rdir)) {
128                  spt[0] = frandom(); spt[1] = frandom();
129 <                goto resample;
129 >                goto resample;          /* reject this sample */
130          }
131          dimlist[ndims++] = AI(hp,i,j) + 90171;
132          rayvalue(&ar);                  /* evaluate ray */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines