1 |
– |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
7 |
– |
#include "random.h" |
8 |
– |
|
4 |
|
/* |
5 |
|
* Binary space partitioning curve for multidimensional sampling. |
6 |
|
* |
7 |
|
* Written by Christophe Schlick |
8 |
|
*/ |
9 |
|
|
10 |
< |
multisamp(t, n, r) /* convert 1-dimensional sample to N dimensions */ |
11 |
< |
double t[]; /* returned N-dimensional vector */ |
12 |
< |
register int n; /* number of dimensions */ |
13 |
< |
double r; /* 1-dimensional sample [0,1) */ |
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 |
< |
register int i, k; |
22 |
> |
int i, k; |
23 |
|
int ti[8]; |
24 |
|
double s; |
25 |
|
|
36 |
|
} |
37 |
|
i = n; |
38 |
|
while (i-- > 0) |
39 |
< |
t[i] = 1./256. * (ti[i] + frandom()); |
39 |
> |
t[i] = (1./256.) * (ti[i] + frandom()); |
40 |
|
} |