MODULE BSplineCurvesTest;
IMPORT
BSplineCurves, KernelLog, MathL, Kernel;
PROCEDURE Test*;
VAR
degree: LONGINT;
closed: BOOLEAN;
curve: BSplineCurves.Curve;
i, N: LONGINT;
d, t: LONGREAL;
kx, ky, x, y: ARRAY [*] OF LONGREAL;
t1, t2, t3: LONGINT;
timer: Kernel.MilliTimer;
BEGIN
degree := 3;
closed := TRUE;
N := 32;
NEW(kx,N); NEW(ky,N);
d := 2.0D0*MathL.pi / N; t := 0;
FOR i := 0 TO N-1 DO
kx[i] := 640*MathL.cos(t);
ky[i] := 480*MathL.sin(t);
t := t + d;
END;
Kernel.SetTimer(timer,0);
NEW(curve,degree,closed);
t1 := Kernel.Elapsed(timer);
Kernel.SetTimer(timer,0);
curve.SetKnots(kx,ky);
t2 := Kernel.Elapsed(timer);
Kernel.SetTimer(timer,0);
curve.GetPoly(1/2,x,y);
t3 := Kernel.Elapsed(timer);
KernelLog.String("Number of output points: "); KernelLog.Int(LEN(x,0),0); KernelLog.Ln;
KernelLog.String("Curve construction: "); KernelLog.Int(t1,0); KernelLog.String(" ms"); KernelLog.Ln;
KernelLog.String("Setting curve knots: "); KernelLog.Int(t2,0); KernelLog.String(" ms"); KernelLog.Ln;
KernelLog.String("Getting curve polyline points: "); KernelLog.Int(t3,0); KernelLog.String(" ms"); KernelLog.Ln;
KernelLog.String("Done!"); KernelLog.Ln;
END Test;
END BSplineCurvesTest.
BSplineCurvesTest.Test ~