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

Comparing ray/src/rt/noise3.c (file contents):
Revision 1.3 by greg, Tue Oct 30 21:03:49 1990 UTC vs.
Revision 1.4 by greg, Wed May 22 08:56:21 1991 UTC

# Line 168 | Line 168 | fnoise3(p)                     /* compute fractal noise function */
168   double  p[3];
169   {
170          double  floor();
171 <        long  t[3], v[3], beg[3], s;
171 >        long  t[3], v[3], beg[3];
172          double  fval[8], fc;
173          int  branch;
174 +        register long  s;
175          register int  i, j;
176                                                  /* get starting cube */
177          s = (long)(1.0/EPSILON);
# Line 188 | Line 189 | double  p[3];
189          }
190                                                  /* compute fractal */
191          for ( ; ; ) {
192 <                s >>= 1;
192 >                fc = 0.0;
193 >                for (j = 0; j < 8; j++)
194 >                        fc += fval[j];
195 >                fc *= 0.125;
196 >                if ((s >>= 1) == 0)
197 >                        return(fc);             /* close enough */
198                  branch = 0;
199                  for (i = 0; i < 3; i++) {       /* do center */
200                          v[i] = beg[i] + s;
# Line 196 | Line 202 | double  p[3];
202                                  branch |= 1<<i;
203                          }
204                  }
199                fc = 0.0;
200                for (j = 0; j < 8; j++)
201                        fc += fval[j];
202                fc *= 0.125;
203                if (s < 1)
204                        return(fc);             /* close enough */
205                  fc += s*EPSILON*frand3(v[0],v[1],v[2]);
206                  fval[~branch & 7] = fc;
207                  for (i = 0; i < 3; i++) {       /* do faces */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines