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

Comparing ray/src/rt/m_bsdf.c (file contents):
Revision 2.63 by greg, Sat Mar 27 20:08:58 2021 UTC vs.
Revision 2.64 by greg, Wed Aug 25 16:12:21 2021 UTC

# Line 130 | Line 130 | compute_through(BSDFDAT *ndp)
130                                          {1.8, -1.8}, {-2.4, 0}, {0, 2.4},
131                                          {0, -2.4}, {2.4, 0},
132                                  };
133 + #define neighbors(i,j)  \
134 +        ((dir2check[i][0]-dir2check[j][0])*(dir2check[i][0]-dir2check[j][0]) + \
135 +        (dir2check[i][1]-dir2check[j][1])*(dir2check[i][1]-dir2check[j][1]) <= 0.73)
136          const double    peak_over = 1.5;
137          PEAKSAMP        psamp[NDIR2CHECK];
138          SDSpectralDF    *dfp;
# Line 138 | Line 141 | compute_through(BSDFDAT *ndp)
141          double          tomsum, tomsurr;
142          COLOR           vpeak, vsurr;
143          double          vypeak;
144 <        int             i, ns;
144 >        int             i, j, ns;
145          SDError         ec;
146  
147          if (ndp->pr->rod > 0)
# Line 171 | Line 174 | compute_through(BSDFDAT *ndp)
174          vypeak = tomsum = tomsurr = 0;          /* combine top unique values */
175          ns = 0;
176          for (i = 0; i < NDIR2CHECK; i++) {
177 <                if (i && psamp[i].vy == psamp[i-1].vy)
178 <                        continue;               /* assume duplicate sample */
177 >                for (j = i; j--; )              /* check for duplicate sample */
178 >                        if (psamp[j].vy == psamp[i].vy && neighbors(i,j))
179 >                                break;
180 >                if (j >= 0)
181 >                        continue;               /* skip duplicate */
182  
183                  ec = SDsizeBSDF(&tomega, psamp[i].tdir, ndp->vray,
184                                                  SDqueryMin, ndp->sd);
# Line 208 | Line 214 | compute_through(BSDFDAT *ndp)
214          return;
215   baderror:
216          objerror(ndp->mp, USER, transSDError(ec));
217 + #undef neighbors
218   #undef NDIR2CHECK
219   }
220  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines