|
|
researchv9-SUN3(old)
From theo Wed Aug 6 16:12 EDT 1980
Brian:
This is the efficient procedure for splines.
It requires points from 0 to N-1. To keep the
same convention as before we must have
P(0) = P(1) and P(N-2) = P(N-1).
spline(){
int i,j,ILEN=10,I,Xs,Ys;
double X1, X2, X3, Y1, Y2, Y3;
double xi,u,LEN=10.0;
I=0;
for(i=0;i< N-2; i++){
xi=i;
X1 = (X[i+2]+X[i])/2 - X[i+1];
X2 = X[i+1]-X[i];
X3 = (X[i+1]+X[i])/2;
Y1 = (Y[i+2]+Y[i])/2 - Y[i+1];
Y2 = Y[i+1]-Y[i];
Y3 = (Y[i+1]+Y[i])/2;
for(j=0;j<ILEN;j++){
u = I; u = u/LEN - xi;
Xs = (X1*u + X2)*u + X3;
Ys = (Y1*u + Y2)*u + Y3;
if(!I) move(Xs,Ys); else cont(Xs,Ys);
I++;
}
}
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.