Компьютерная обработка и распознавание изображений. Фисенко В.Т - 37 стр.

UptoLike

Составители: 

37
procedure GlobalSpline(n:integer; y:TIntegerArray; var b,c,d:TDoubleArray);
var Li,alpha,beta: TDoubleArray;
i,j:integer;
coeff:double;
begin
if n<4 then exit;
SetLength(Li,n);//выделение памяти под массив вещественных чисел
SetLength(alpha,n);
SetLength(beta,n);
for i:=0 to n-2 do
Li[i]:=y[i+1]-y[i];
//прямой ход прогонки
alpha[1]:=-0.25;
beta[1]:=0.75*(Li[2]-Li[1]);
for i:=1 to n-3 do
begin
coeff:=1.0/(4.0+alpha[i]);
alpha[i+1]:=-coeff;
beta[i+1]:=(3*(Li[i+1]-Li[i])-beta[i])
*coeff;
end;
// обратный ход прогонки
c[0]:=0;
c[n-1]:=0;
j:=n-2;
for i:=1 to n-2 do
begin
c[j]:=alpha[j]*c[j+1]+beta[j];
Dec(j);
end;
//вычисление остальных коэффициентов
coeff:=1.0/3.0;
d[n-2]:=-c[n-2]*coeff;
b[n-2]:=Li[n-2]-c[n-2]-d[n-2];
for i:=0 to n-3 do
begin
d[i]:=(c[i+1]-
c[i])*coeff;
b[i]:=Li[i]-c[i]-d[i];
end;
SetLength(Li,0);
SetLength(alpha,0);
SetLength(beta,0);
end;