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

Comparing ray/src/rt/pmapdata.c (file contents):
Revision 2.22 by rschregle, Wed Apr 8 15:14:21 2020 UTC vs.
Revision 2.23 by rschregle, Wed Apr 14 11:26:25 2021 UTC

# Line 13 | Line 13 | static const char RCSid[] = "$Id$";
13  
14     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
15     (c) Fraunhofer Institute for Solar Energy Systems,
16 +       supported by the German Research Foundation
17 +       (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme" (FARESYS))
18     (c) Lucerne University of Applied Sciences and Arts,
19 <       supported by the Swiss National Science Foundation (SNSF, #147053)
19 >       supported by the Swiss National Science Foundation
20 >       (SNSF #147053, "Daylight Redirecting Components")
21     ==========================================================================
22    
23     $Id$
# Line 222 | Line 225 | int newPhoton (PhotonMap* pmap, const RAY* ray)
225         ambincl != inset(ambset, ray -> ro -> omod))
226        return -1;
227  
228 <   if (pmapNumROI && pmapROI) {      
228 >   if (pmapNumROI && pmapROI) {
229        unsigned inROI = 0;
230 +      FVECT    photonDist;
231        
232 <      /* Store photon if within a region of interest (for ze Ecksperts!) */
233 <      for (i = 0; !inROI && i < pmapNumROI; i++)
234 <         inROI = (ray -> rop [0] >= pmapROI [i].min [0] &&
235 <                  ray -> rop [0] <= pmapROI [i].max [0] &&
236 <                  ray -> rop [1] >= pmapROI [i].min [1] &&
237 <                  ray -> rop [1] <= pmapROI [i].max [1] &&
238 <                  ray -> rop [2] >= pmapROI [i].min [2] &&
239 <                  ray -> rop [2] <= pmapROI [i].max [2]);
232 >      /* Store photon if within a region of interest (for ze Ecksperts!)
233 >         Note size of spherical ROI is squared. */
234 >      for (i = 0; !inROI && i < pmapNumROI; i++) {
235 >         VSUB(photonDist, ray -> rop, pmapROI [i].pos);
236 >        
237 >         inROI = (
238 >            PMAP_ROI_ISSPHERE(pmapROI + i)
239 >            ?  DOT(photonDist, photonDist) <= pmapROI [i].siz [0]
240 >            :  fabs(photonDist [0]) <= pmapROI [i].siz [0] &&
241 >               fabs(photonDist [1]) <= pmapROI [i].siz [1] &&
242 >               fabs(photonDist [2]) <= pmapROI [i].siz [2]
243 >         );
244 >      }
245        if (!inROI)
246           return -1;
247     }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines