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.9 by greg, Tue Jul 30 13:00:26 1991 UTC vs.
Revision 1.10 by greg, Tue Aug 13 13:45:18 1991 UTC

# Line 38 | Line 38 | struct rtproc  *rt;
38   char  *nm;
39   {
40   #define MAXMISS         (5*n*il->nsamps)
41 <        int  dim[4];
42 <        int  n, nalt, nazi;
41 >        int  dim[3];
42 >        int  n, nalt, nazi, h;
43          float  *distarr;
44 <        double  r1, r2;
44 >        double  sp[2], r1, r2;
45          FVECT  dn, org, dir;
46          FVECT  u, v;
47          double  ur[2], vr[2];
# Line 81 | Line 81 | char  *nm;
81              for (dim[2] = 0; dim[2] < nazi; dim[2]++)
82                  for (i = 0; i < il->nsamps; i++) {
83                                          /* random direction */
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)))/nazi;
84 >                    h = ilhash(dim, 3) + i;
85 >                    peano(sp, 2, urand(h), .02);
86 >                    r1 = (dim[1] + sp[0])/nalt;
87 >                    r2 = (dim[2] + sp[1])/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];
91                                          /* random location */
92                      do {
93 <                        dim[3] = 3;
94 <                        r1 = ur[0] + (ur[1]-ur[0]) *
95 <                                        urand(urind(ilhash(dim,4),i+nmisses));
96 <                        dim[3] = 4;
97 <                        r2 = vr[0] + (vr[1]-vr[0]) *
98 <                                        urand(urind(ilhash(dim,4),i+nmisses));
93 >                        peano(sp, 2, urand(h+nmisses), .01);
94 >                        r1 = ur[0] + (ur[1]-ur[0]) * sp[0];
95 >                        r2 = vr[0] + (vr[1]-vr[0]) * sp[1];
96                          for (j = 0; j < 3; j++)
97                              org[j] = r1*u[j] + r2*v[j]
98                                          + fa->offset*fa->norm[j];
# Line 130 | Line 127 | struct illum_args  *il;
127   struct rtproc  *rt;
128   char  *nm;
129   {
130 <        int  dim[4];
130 >        int  dim[3];
131          int  n, nalt, nazi;
132          float  *distarr;
133 <        double  r1, r2, r3;
133 >        double  sp[4], r1, r2, r3;
134          FVECT  org, dir;
135          FVECT  u, v;
136          register int  i, j;
# Line 153 | Line 150 | char  *nm;
150          for (dim[1] = 0; dim[1] < nalt; dim[1]++)
151              for (dim[2] = 0; dim[2] < nazi; dim[2]++)
152                  for (i = 0; i < il->nsamps; i++) {
153 +                                        /* next sample point */
154 +                    peano(sp, 4, urand(ilhash(dim,3)+i), .02);
155                                          /* random direction */
156 <                    dim[3] = 1;
157 <                    r1 = (dim[1]+urand(urind(ilhash(dim,4),i)))/nalt;
159 <                    dim[3] = 2;
160 <                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nazi;
156 >                    r1 = (dim[1] + sp[0])/nalt;
157 >                    r2 = (dim[2] + sp[1])/nazi;
158                      rounddir(dir, r1, r2);
159                                          /* random location */
160                      mkaxes(u, v, dir);          /* yuck! */
161 <                    dim[3] = 3;
162 <                    r3 = sqrt(urand(urind(ilhash(dim,4),i)));
166 <                    dim[3] = 4;
167 <                    r2 = 2.*PI*urand(urind(ilhash(dim,4),i));
161 >                    r3 = sqrt(sp[2]);
162 >                    r2 = 2.*PI*sp[3];
163                      r1 = r3*ob->oargs.farg[3]*cos(r2);
164                      r2 = r3*ob->oargs.farg[3]*sin(r2);
165                      r3 = ob->oargs.farg[3]*sqrt(1.01-r3*r3);
# Line 191 | Line 186 | struct illum_args  *il;
186   struct rtproc  *rt;
187   char  *nm;
188   {
189 <        int  dim[4];
189 >        int  dim[3];
190          int  n, nalt, nazi;
191          float  *distarr;
192 <        double  r1, r2, r3;
192 >        double  sp[4], r1, r2, r3;
193          FVECT  dn, org, dir;
194          FVECT  u, v;
195          register CONE  *co;
# Line 215 | Line 210 | char  *nm;
210          for (dim[1] = 0; dim[1] < nalt; dim[1]++)
211              for (dim[2] = 0; dim[2] < nazi; dim[2]++)
212                  for (i = 0; i < il->nsamps; i++) {
213 +                                        /* next sample point */
214 +                    peano(sp, 4, urand(ilhash(dim,3)+i), .02);
215                                          /* random direction */
216 <                    dim[3] = 1;
217 <                    r1 = (dim[1]+urand(urind(ilhash(dim,4),i)))/nalt;
221 <                    dim[3] = 2;
222 <                    r2 = (dim[2]+urand(urind(ilhash(dim,4),i)))/nalt;
216 >                    r1 = (dim[1] + sp[0])/nalt;
217 >                    r2 = (dim[2] + sp[1])/nalt;
218                      flatdir(dn, r1, r2);
219                      for (j = 0; j < 3; j++)
220                          dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*co->ad[j];
221                                          /* random location */
227                    dim[3] = 3;
222                      r3 = sqrt(CO_R0(co)*CO_R0(co) +
223 <                                urand(urind(ilhash(dim,4),i))*
224 <                                (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));
223 >                            sp[2]*(CO_R1(co)*CO_R1(co) - CO_R0(co)*CO_R0(co)));
224 >                    r2 = 2.*PI*sp[3];
225                      r1 = r3*cos(r2);
226                      r2 = r3*sin(r2);
227                      for (j = 0; j < 3; j++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines