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 1.4 by greg, Wed Jul 24 16:48:26 1991 UTC vs.
Revision 1.9 by greg, Tue Jul 30 13:00:26 1991 UTC

# Line 84 | Line 84 | char  *nm;
84                      dim[3] = 1;
85                      r1 = (dim[1]+urand(urind(ilhash(dim,4),i)))/nalt;
86                      dim[3] = 2;
87 <                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nalt;
87 >                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nazi;
88                      flatdir(dn, r1, r2);
89                      for (j = 0; j < 3; j++)
90 <                        dir[j] = dn[0]*u[j] + dn[1]*v[j] - dn[2]*fa->norm[j];
90 >                        dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*fa->norm[j];
91                                          /* random location */
92                      do {
93                          dim[3] = 3;
# Line 111 | Line 111 | char  *nm;
111                      for (j = 0; j < 3; j++)
112                          org[j] += .001*fa->norm[j];
113                                          /* send sample */
114 <                    raysamp(distarr+dim[1]*nazi+dim[2], org, dir, rt);
114 >                    raysamp(distarr+3*(dim[1]*nazi+dim[2]), org, dir, rt);
115                  }
116          rayflush(rt);
117                                  /* write out the face w/ distribution */
# Line 133 | Line 133 | char  *nm;
133          int  dim[4];
134          int  n, nalt, nazi;
135          float  *distarr;
136 <        double  r1, r2;
136 >        double  r1, r2, r3;
137          FVECT  org, dir;
138          FVECT  u, v;
139          register int  i, j;
# Line 157 | Line 157 | char  *nm;
157                      dim[3] = 1;
158                      r1 = (dim[1]+urand(urind(ilhash(dim,4),i)))/nalt;
159                      dim[3] = 2;
160 <                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nalt;
160 >                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nazi;
161                      rounddir(dir, r1, r2);
162                                          /* random location */
163                      mkaxes(u, v, dir);          /* yuck! */
164                      dim[3] = 3;
165 <                    r1 = sqrt(urand(urind(ilhash(dim,4),i)));
165 >                    r3 = sqrt(urand(urind(ilhash(dim,4),i)));
166                      dim[3] = 4;
167                      r2 = 2.*PI*urand(urind(ilhash(dim,4),i));
168 <                    for (j = 0; j < 3; j++)
169 <                        org[j] = ob->oargs.farg[j] + ob->oargs.farg[3] *
170 <                                        ( r1*cos(r2)*u[j] + r1*sin(r2)*v[j]
171 <                                                - sqrt(1.01-r1*r1)*dir[j] );
172 <
168 >                    r1 = r3*ob->oargs.farg[3]*cos(r2);
169 >                    r2 = r3*ob->oargs.farg[3]*sin(r2);
170 >                    r3 = ob->oargs.farg[3]*sqrt(1.01-r3*r3);
171 >                    for (j = 0; j < 3; j++) {
172 >                        org[j] = ob->oargs.farg[j] + r1*u[j] + r2*v[j] +
173 >                                        r3*dir[j];
174 >                        dir[j] = -dir[j];
175 >                    }
176                                          /* send sample */
177 <                    raysamp(distarr+dim[1]*nazi+dim[2], org, dir, rt);
177 >                    raysamp(distarr+3*(dim[1]*nazi+dim[2]), org, dir, rt);
178                  }
179          rayflush(rt);
180                                  /* write out the sphere w/ distribution */
# Line 191 | Line 194 | char  *nm;
194          int  dim[4];
195          int  n, nalt, nazi;
196          float  *distarr;
197 <        double  r1, r2;
197 >        double  r1, r2, r3;
198          FVECT  dn, org, dir;
199          FVECT  u, v;
200          register CONE  *co;
# Line 219 | Line 222 | char  *nm;
222                      r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nalt;
223                      flatdir(dn, r1, r2);
224                      for (j = 0; j < 3; j++)
225 <                        dir[j] = dn[0]*u[j] + dn[1]*v[j] - dn[2]*co->ad[j];
225 >                        dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*co->ad[j];
226                                          /* random location */
227                      dim[3] = 3;
228 <                    r1 = sqrt(CO_R0(co)*CO_R0(co) +
228 >                    r3 = sqrt(CO_R0(co)*CO_R0(co) +
229                                  urand(urind(ilhash(dim,4),i))*
230                                  (CO_R1(co)*CO_R1(co) - CO_R0(co)*CO_R0(co)));
231                      dim[3] = 4;
232                      r2 = 2.*PI*urand(urind(ilhash(dim,4),i));
233 +                    r1 = r3*cos(r2);
234 +                    r2 = r3*sin(r2);
235                      for (j = 0; j < 3; j++)
236 <                        org[j] = CO_P0(co)[j] +
237 <                                        r1*cos(r2)*u[j] + r1*sin(r2)*v[j]
233 <                                        + .001*co->ad[j];
236 >                        org[j] = CO_P0(co)[j] + r1*u[j] + r1*v[j] +
237 >                                        .001*co->ad[j];
238  
239                                          /* send sample */
240 <                    raysamp(distarr+dim[1]*nazi+dim[2], org, dir, rt);
240 >                    raysamp(distarr+3*(dim[1]*nazi+dim[2]), org, dir, rt);
241                  }
242          rayflush(rt);
243                                  /* write out the ring w/ distribution */
# Line 268 | Line 272 | register struct rtproc  *rt;
272  
273          if (rt->nrays <= 0)
274                  return;
275 <        i = 6*rt->nrays + 3;
272 <        rt->buf[i++] = 0.; rt->buf[i++] = 0.; rt->buf[i] = 0.;
275 >        bzero(rt->buf+6*rt->nrays, 6*sizeof(float));
276          if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf,
277                          3*sizeof(float)*rt->nrays,
278                          6*sizeof(float)*(rt->nrays+1)) <
# Line 325 | Line 328 | double  alt, azi;
328          d2 = 2.*PI * azi;
329          dv[0] = d1*cos(d2);
330          dv[1] = d1*sin(d2);
331 <        dv[2] = sqrt(1. - d1*d1);
331 >        dv[2] = sqrt(1. - alt);
332   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines