ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/multisamp.c
Revision: 2.1
Committed: Tue Nov 12 16:56:06 1991 UTC (32 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.1: +0 -0 lines
Log Message:
updated revision number for release 2.0

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1991 Regents of the University of California */
2    
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * Binary space partitioning curve for multidimensional sampling.
9     *
10     * Written by Christophe Schlick
11     */
12    
13     multisamp(t, n, r) /* convert 1-dimensional sample to N dimensions */
14     double t[]; /* returned N-dimensional vector */
15     register int n; /* number of dimensions */
16     double r; /* 1-dimensional sample [0,1) */
17     {
18     int j;
19     register int i, k;
20     int ti[8];
21     double s;
22    
23     i = n;
24     while (i-- > 0)
25     ti[i] = 0;
26     j = 8;
27     while (j--) {
28     k = s = r*(1<<n);
29     r = s - k;
30     i = n;
31     while (i-- > 0)
32     ti[i] += ti[i] + ((k>>i) & 1);
33     }
34     i = n;
35     while (i-- > 0)
36     t[i] = 1./256. * ti[i];
37     }