ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/multisamp.c
Revision: 2.6
Committed: Wed Apr 17 15:07:29 2024 UTC (2 weeks, 1 day ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 2.5: +6 -7 lines
Log Message:
chore: ansification

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: multisamp.c,v 2.5 2003/06/07 12:50:20 schorsch Exp $";
3 #endif
4 /*
5 * Binary space partitioning curve for multidimensional sampling.
6 *
7 * Written by Christophe Schlick
8 */
9
10 #include "copyright.h"
11
12 #include <stdlib.h>
13
14 #include "random.h"
15
16
17 /* Convert 1-dimensional sample to N dimensions */
18 void
19 multisamp(double t[], int n, double r)
20 {
21 int j;
22 int i, k;
23 int ti[8];
24 double s;
25
26 i = n;
27 while (i-- > 0)
28 ti[i] = 0;
29 j = 8;
30 while (j--) {
31 k = s = r*(1<<n);
32 r = s - k;
33 i = n;
34 while (i-- > 0)
35 ti[i] += ti[i] + ((k>>i) & 1);
36 }
37 i = n;
38 while (i-- > 0)
39 t[i] = (1./256.) * (ti[i] + frandom());
40 }