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

Comparing ray/src/rt/srcsupp.c (file contents):
Revision 2.21 by greg, Thu Dec 4 05:26:28 2014 UTC vs.
Revision 2.23 by greg, Thu Apr 21 00:40:35 2016 UTC

# Line 76 | Line 76 | setflatss(                             /* set sampling for a flat source */
76          double  mult;
77          int  i;
78  
79 <        getperpendicular(src->ss[SU], src->snorm);
79 >        getperpendicular(src->ss[SU], src->snorm, rand_samp);
80          mult = .5 * sqrt( src->ss2 );
81          for (i = 0; i < 3; i++)
82                  src->ss[SU][i] *= mult;
# Line 98 | Line 98 | fsetsrc(                       /* set a face as a source */
98          src->so = so;
99                                                  /* get the face */
100          f = getface(so);
101 <        if (f->area == 0.0)
101 >        if (f->area == 0.)
102                  objerror(so, USER, "zero source area");
103                                                  /* find the center */
104          for (j = 0; j < 3; j++) {
# Line 196 | Line 196 | rsetsrc(                       /* set a ring (disk) as a source */
196          src->so = so;
197                                                  /* get the ring */
198          co = getcone(so, 0);
199 +        if (co == NULL)
200 +                objerror(so, USER, "illegal source");
201          if (CO_R1(co) <= FTINY)
202                  objerror(so, USER, "illegal source radius");
203          VCOPY(src->sloc, CO_P0(co));
# Line 222 | Line 224 | cylsetsrc(                     /* set a cylinder as a source */
224          src->so = so;
225                                                  /* get the cylinder */
226          co = getcone(so, 0);
227 +        if (co == NULL)
228 +                objerror(so, USER, "illegal source");
229          if (CO_R0(co) <= FTINY)
230                  objerror(so, USER, "illegal source radius");
231          if (CO_R0(co) > .2*co->al)              /* heuristic constraint */
# Line 234 | Line 238 | cylsetsrc(                     /* set a cylinder as a source */
238                                                  /* set sampling vectors */
239          for (i = 0; i < 3; i++)
240                  src->ss[SU][i] = .5 * co->al * co->ad[i];
241 <        getperpendicular(src->ss[SW], co->ad);
241 >        getperpendicular(src->ss[SW], co->ad, rand_samp);
242          for (i = 0; i < 3; i++)
243                  src->ss[SW][i] *= .8559 * CO_R0(co);
244          fcross(src->ss[SV], src->ss[SW], co->ad);
# Line 336 | Line 340 | rgetmaxdisk(           /* get center and squared radius of ring
340          CONE  *co;
341          
342          co = getcone(op, 0);
343 +        if (co == NULL)
344 +                return(0.);
345          VCOPY(ocent, CO_P0(co));
346          return(CO_R1(co)*CO_R1(co));
347   }
# Line 364 | Line 370 | rgetplaneq(                    /* get plane equation for ring */
370          CONE  *co;
371  
372          co = getcone(op, 0);
373 +        if (co == NULL) {
374 +                memset(nvec, 0, sizeof(FVECT));
375 +                return(0.);
376 +        }
377          VCOPY(nvec, co->ad);
378          return(DOT(nvec, CO_P0(co)));
379   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines