|
|
1.1 root 1: From theo Wed Aug 6 16:12 EDT 1980
2: Brian:
3: This is the efficient procedure for splines.
4: It requires points from 0 to N-1. To keep the
5: same convention as before we must have
6: P(0) = P(1) and P(N-2) = P(N-1).
7: spline(){
8: int i,j,ILEN=10,I,Xs,Ys;
9: double X1, X2, X3, Y1, Y2, Y3;
10: double xi,u,LEN=10.0;
11: I=0;
12: for(i=0;i< N-2; i++){
13: xi=i;
14: X1 = (X[i+2]+X[i])/2 - X[i+1];
15: X2 = X[i+1]-X[i];
16: X3 = (X[i+1]+X[i])/2;
17: Y1 = (Y[i+2]+Y[i])/2 - Y[i+1];
18: Y2 = Y[i+1]-Y[i];
19: Y3 = (Y[i+1]+Y[i])/2;
20: for(j=0;j<ILEN;j++){
21: u = I; u = u/LEN - xi;
22: Xs = (X1*u + X2)*u + X3;
23: Ys = (Y1*u + Y2)*u + Y3;
24: if(!I) move(Xs,Ys); else cont(Xs,Ys);
25: I++;
26: }
27: }
28: }
29:
30:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.