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

Comparing ray/src/gen/mkillum2.c (file contents):
Revision 2.4 by greg, Thu Aug 13 10:03:19 1992 UTC vs.
Revision 2.8 by gregl, Wed Jul 9 11:24:52 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 71 | Line 71 | char  *nm;
71                  u[0] = VERTEX(fa,i)[0] - VERTEX(fa,j)[0];
72                  u[1] = VERTEX(fa,i)[1] - VERTEX(fa,j)[1];
73                  u[2] = VERTEX(fa,i)[2] - VERTEX(fa,j)[2];
74 <                if (DOT(u,u) >= fa->area-FTINY)
74 >                if ((r1 = DOT(u,u)) >= fa->area-FTINY)
75                          break;
76          }
77          if (i < fa->nv) {       /* got one! -- let's align our axes */
78 <                normalize(u);
78 >                r2 = 1.0/sqrt(r1);
79 >                u[0] *= r2; u[1] *= r2; u[2] *= r2;
80                  fcross(v, fa->norm, u);
81          } else                  /* oh well, we'll just have to wing it */
82                  mkaxes(u, v, fa->norm);
# Line 162 | Line 163 | char  *nm;
163                  nalt = nazi = 1;
164          else {
165                  n = 4.*PI * il->sampdens;
166 <                nalt = sqrt(n/PI) + .5;
167 <                nazi = PI*nalt + .5;
166 >                nalt = sqrt(2./PI*n) + .5;
167 >                nazi = PI/2.*nalt + .5;
168          }
169          n = nalt*nazi;
170          distarr = (float *)calloc(n, 3*sizeof(float));
# Line 259 | Line 260 | char  *nm;
260                      r1 = r3*cos(r2);
261                      r2 = r3*sin(r2);
262                      for (j = 0; j < 3; j++)
263 <                        org[j] = CO_P0(co)[j] + r1*u[j] + r1*v[j] +
263 >                        org[j] = CO_P0(co)[j] + r1*u[j] + r2*v[j] +
264                                          .001*co->ad[j];
265  
266                                          /* send sample */
# Line 305 | Line 306 | register struct rtproc  *rt;
306          bzero(rt->buf+6*rt->nrays, 6*sizeof(float));
307          errno = 0;
308          if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf,
309 <                        3*sizeof(float)*rt->nrays,
309 >                        3*sizeof(float)*(rt->nrays+1),
310                          6*sizeof(float)*(rt->nrays+1)) <
311 <                        3*sizeof(float)*rt->nrays )
311 >                        3*sizeof(float)*(rt->nrays+1) )
312                  error(SYSTEM, "error reading from rtrace process");
313          i = rt->nrays;
314          while (i--) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines