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

Comparing ray/src/cal/cal/sphsamp.cal (file contents):
Revision 1.2 by greg, Tue Feb 15 23:36:10 2005 UTC vs.
Revision 1.3 by greg, Tue Feb 15 23:45:14 2005 UTC

# Line 1 | Line 1
1   { RCSid $Id$ }
2   {
3 <        Uniform sampling of sphere
3 >        Jittered sampling of a sphere
4 >
5          2/15/2005       G. Ward
6  
7          Constant:
# Line 8 | Line 9
9          Input:
10                  i -             sample number [0,N-1]
11          Output:
12 <                theta   - polar angle (radians)
13 <                phi     - azimuthal angle (radians)
12 >                theta   - polar angle (0-PI)
13 >                phi_un  - azimuthal angle (unnormalized)
14 >                phi     - azimuthal angle (0-2*PI)
15                  Dx      - X-component of direction vector
16                  Dy      - Y-component of direction vector
17                  Dz      - Z-component of direction vector
# Line 18 | Line 20 | S : .7;                        { jitter amount (0-1) }
20  
21   k : 2*sqrt(PI/N);       { k^2 is solid angle of each sample }
22  
23 + mod(n,d) : n - floor(n/d)*d;
24 +
25   alpha0 = asin(2/N*(i+.5) - 1);
26  
27   theta = alpha0 + PI/2 + k*S*(rand(.35*i+10.3) - .5);
28 < phi = sqrt(PI*N)*alpha0 + k*S*(rand(-.83*i-17.9) - .5);
28 > phi_un = sqrt(PI*N)*alpha0 + k*S*(rand(-.83*i-17.9) - .5);
29 > phi = mod(phi_un, 2*PI);
30  
31   sint = sin(theta);
32   Dx = cos(phi)*sint;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines