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 1.5 by greg, Mon Jun 24 16:00:30 1991 UTC vs.
Revision 1.8 by greg, Tue Jun 25 16:42:03 1991 UTC

# Line 105 | Line 105 | register OBJREC  *so;
105          theta = PI/180.0/2.0 * so->oargs.farg[3];
106          if (theta <= FTINY)
107                  objerror(so, USER, "zero size");
108 <        src->ss = theta >= PI/4 ? 1.0 : tan(theta);
108 >        src->ss = theta >= PI/4.0 ? 1.0 : tan(theta);
109          src->ss2 = 2.0*PI * (1.0 - cos(theta));
110   }
111  
# Line 288 | Line 288 | FVECT  nrm;            /* source surface normal */
288  
289          d = DOT(sp->aim, nrm);
290          if (d > FTINY)                  /* center in front? */
291 <                return(0);
291 >                return(1);
292                                          /* else check horizon */
293          d1 = 1. - sp->siz/(2.*PI);
294 <        return(1.-FTINY-d*d > d1*d1);
294 >        return(1.-FTINY-d*d < d1*d1);
295 > }
296 >
297 >
298 > double
299 > spotdisk(oc, op, sp, pos)       /* intersect spot with object op */
300 > FVECT  oc;
301 > OBJREC  *op;
302 > register SPOT  *sp;
303 > FVECT  pos;
304 > {
305 >        FVECT  onorm;
306 >        double  offs, d, dist;
307 >        register int  i;
308 >
309 >        offs = getplaneq(onorm, op);
310 >        d = -DOT(onorm, sp->aim);
311 >        if (d >= -FTINY && d <= FTINY)
312 >                return(0.);
313 >        dist = (DOT(pos, onorm) - offs)/d;
314 >        if (dist < 0.)
315 >                return(0.);
316 >        for (i = 0; i < 3; i++)
317 >                oc[i] = pos[i] + dist*sp->aim[i];
318 >        return(sp->siz*dist*dist/PI/(d*d));
319 > }
320 >
321 >
322 > double
323 > beamdisk(oc, op, sp, dir)       /* intersect beam with object op */
324 > FVECT  oc;
325 > OBJREC  *op;
326 > register SPOT  *sp;
327 > FVECT  dir;
328 > {
329 >        FVECT  onorm;
330 >        double  offs, d, dist;
331 >        register int  i;
332 >
333 >        offs = getplaneq(onorm, op);
334 >        d = -DOT(onorm, dir);
335 >        if (d >= -FTINY && d <= FTINY)
336 >                return(0.);
337 >        dist = (DOT(sp->aim, onorm) - offs)/d;
338 >        for (i = 0; i < 3; i++)
339 >                oc[i] = sp->aim[i] + dist*dir[i];
340 >        return(sp->siz/PI/(d*d));
341   }
342  
343  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines