1 |
{ |
2 |
A set of randomly located points at known positions to be |
3 |
interpolated by gensurf. |
4 |
} |
5 |
{ The following are our known point values } |
6 |
point(i,j) = select( i*3+j+1, |
7 |
2, 1, 5, { x0, y0, z0 } |
8 |
3.7, 1, 1, |
9 |
4.2, 2.5, 2, |
10 |
3,7, 2.5, 4, |
11 |
2, 2.5, 3, |
12 |
2, 3.5, 2 |
13 |
); |
14 |
|
15 |
Npoints = 6; { Number of points in above } |
16 |
|
17 |
sq(x) : x*x; |
18 |
|
19 |
Recip(x) : if( x, 1/x, 1e10 ); |
20 |
|
21 |
Sum(f,x,y,n) = if(n-.5, f(x,y,n-1)+Sum(f,x,y,n-1), 0); |
22 |
|
23 |
weight(x,y,i) = Recip(sq(x-point(i,0)) + sq(y-point(i,1))); |
24 |
|
25 |
wval(x,y,i) = weight(x,y,i) * point(i,2); |
26 |
|
27 |
sheight(x,y) = Sum(wval,x,y,Npoints) / Sum(weight,x,y,Npoints); |