(***********************************************************) (* *) (* TURBO GRAPHIX version 1.05A *) (* *) (* Bezier polynomial module *) (* Module version 1.00A *) (* *) (* Copyright (C) 1985 by *) (* BORLAND International *) (* *) (***********************************************************) procedure bezier(A:PlotArray; MaxContrPoints:integer; var B:PlotArray; MaxIntPoints:integer); const MaxControlPoints=25; type CombiArray=array [0..MaxControlPoints] of real; var n:integer; ContrPoint,IntPoint:integer; t,SumX,SumY,prod,DeltaT,quot:real; combi:CombiArray; begin MaxContrPoints:=MaxContrPoints-1; DeltaT:=1.0/(MaxIntPoints-1); combi[0]:=1; combi[MaxContrPoints]:=1; for n:=0 to MaxContrPoints-2 do combi[n+1]:=combi[n]*(MaxContrPoints-n)/(n+1); for IntPoint:=1 to MaxIntPoints do begin t:=(IntPoint-1)*DeltaT; if t<=0.5 then begin prod:=1.0-t; quot:=prod; for n:=1 to MaxContrPoints-1 do prod:=prod*quot; quot:=t/quot; SumX:=A[MaxContrPoints+1,1]; SumY:=A[MaxContrPoints+1,2]; for n:=MaxContrPoints downto 1 do begin SumX:=combi[n-1]*A[n,1]+quot*SumX; SumY:=combi[n-1]*A[n,2]+quot*SumY; end; end else begin prod:=t; quot:=prod; for n:=1 to MaxContrPoints-1 do prod:=prod*quot; quot:=(1-t)/quot; SumX:=A[1,1]; SumY:=A[1,2]; for n:=1 to MaxContrPoints do begin SumX:=combi[n]*A[n+1,1]+quot*SumX; SumY:=combi[n]*A[n+1,2]+quot*SumY; end; end; B[IntPoint,1]:=SumX*prod; B[IntPoint,2]:=SumY*prod; end; end;