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.9 by greg, Sat Feb 22 02:07:24 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Routines to do the actual calculation for mkillum
6   */
# Line 71 | Line 68 | char  *nm;
68                  u[0] = VERTEX(fa,i)[0] - VERTEX(fa,j)[0];
69                  u[1] = VERTEX(fa,i)[1] - VERTEX(fa,j)[1];
70                  u[2] = VERTEX(fa,i)[2] - VERTEX(fa,j)[2];
71 <                if (DOT(u,u) >= fa->area-FTINY)
71 >                if ((r1 = DOT(u,u)) >= fa->area-FTINY)
72                          break;
73          }
74          if (i < fa->nv) {       /* got one! -- let's align our axes */
75 <                normalize(u);
75 >                r2 = 1.0/sqrt(r1);
76 >                u[0] *= r2; u[1] *= r2; u[2] *= r2;
77                  fcross(v, fa->norm, u);
78          } else                  /* oh well, we'll just have to wing it */
79                  mkaxes(u, v, fa->norm);
# Line 117 | Line 115 | char  *nm;
115                          objerror(ob, WARNING, "bad aspect");
116                          rt->nrays = 0;
117                          freeface(ob);
118 <                        free((char *)distarr);
118 >                        free((void *)distarr);
119                          o_default(ob, il, rt, nm);
120                          return;
121                      }
# Line 136 | Line 134 | char  *nm;
134                  printobj(il->altmat, ob);
135                                  /* clean up */
136          freeface(ob);
137 <        free((char *)distarr);
137 >        free((void *)distarr);
138   #undef MAXMISS
139   }
140  
# Line 162 | Line 160 | char  *nm;
160                  nalt = nazi = 1;
161          else {
162                  n = 4.*PI * il->sampdens;
163 <                nalt = sqrt(n/PI) + .5;
164 <                nazi = PI*nalt + .5;
163 >                nalt = sqrt(2./PI*n) + .5;
164 >                nazi = PI/2.*nalt + .5;
165          }
166          n = nalt*nazi;
167          distarr = (float *)calloc(n, 3*sizeof(float));
# Line 206 | Line 204 | char  *nm;
204          } else
205                  printobj(il->altmat, ob);
206                                  /* clean up */
207 <        free((char *)distarr);
207 >        free((void *)distarr);
208   }
209  
210  
# Line 259 | Line 257 | char  *nm;
257                      r1 = r3*cos(r2);
258                      r2 = r3*sin(r2);
259                      for (j = 0; j < 3; j++)
260 <                        org[j] = CO_P0(co)[j] + r1*u[j] + r1*v[j] +
260 >                        org[j] = CO_P0(co)[j] + r1*u[j] + r2*v[j] +
261                                          .001*co->ad[j];
262  
263                                          /* send sample */
# Line 275 | Line 273 | char  *nm;
273                  printobj(il->altmat, ob);
274                                  /* clean up */
275          freecone(ob);
276 <        free((char *)distarr);
276 >        free((void *)distarr);
277   }
278  
279  
# Line 305 | Line 303 | register struct rtproc  *rt;
303          bzero(rt->buf+6*rt->nrays, 6*sizeof(float));
304          errno = 0;
305          if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf,
306 <                        3*sizeof(float)*rt->nrays,
306 >                        3*sizeof(float)*(rt->nrays+1),
307                          6*sizeof(float)*(rt->nrays+1)) <
308 <                        3*sizeof(float)*rt->nrays )
308 >                        3*sizeof(float)*(rt->nrays+1) )
309                  error(SYSTEM, "error reading from rtrace process");
310          i = rt->nrays;
311          while (i--) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines