ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/noise.cal
Revision: 1.3
Committed: Wed Nov 21 17:45:45 2018 UTC (5 years, 5 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 1.2: +10 -7 lines
Log Message:
Minor fixes/improvements

File Contents

# Content
1 { RCSid $Id$ }
2 { 1-D Perlin Noise function }
3
4 frac(x):x-floor(x);
5
6 hermite(p0,p1,r0,r1,t) : p0 * ((2*t-3)*t*t+1) +
7 p1 * (-2*t+3)*t*t +
8 r0 * (((t-2)*t+1)*t) +
9 r1 * ((t-1)*t*t);
10
11 rand2a(x) : 1-2*rand(.69692*x);
12 rand2b(x) : 1-2*rand(.05393*x);
13
14 noise_1(xl,xd,xu) : hermite(
15 rand2a(xl),
16 rand2a(xu),
17 rand2b(xl),
18 rand2b(xu),
19 xd);
20
21 noise(x) : noise_1(floor(x),frac(x),ceil(x));