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, 6 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

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