< -->
Program Lissague;{Программа рисования фигур Лиссажу}
{$D-}
Uses Crt, Graph;
var
Colour : Word;
D, R, e, X, Y : Integer;
A1, A2, w1, w2, f1, f2 : Real;
t, dt : Real;
begin
A1 := 320{300 } ;
A2 := 240{200 } ;
w1 := 100{ 3 } ;
w2 := 101{ 5 } ;
f1 := 1.57 ;
f2 := 0 ;
{ Writeln('Введите A1, A2, w1, w2, f1, f2:');
ReadLn(A1, A2, w1, w2, f1, f2);}
D:=Detect;
InitGraph(D, R, '');
e := GraphResult;
if e <> 0 then
begin
WriteLn('Graphics ERROR!!! (', e, ')');
WriteLn(GraphErrorMsg(e));
ReadKey;
Halt;
end;
Randomize;
dt := 0.0;
t:=0.0;
X :=320 +Round(A1 * cos(w1*t + f1));
Y := 240-Round(A2 * sin(w2*t + f2));
SetColor(LightGreen);
Circle(X, Y, 3);
Colour := Random(15)+1{LightMagenta};
While not KeyPressed do
begin
if t > 314.15927{6.28+1.57} then
begin
{ ClearDevice;}
Colour:=Random(15)+1{LightGreen};
t := -1.57;
{ dt := dt+0.03;}
end;
t := t + 0.002;
X := 320 + Round(A1 * cos((w1)*(t) + f1{+dt}));
Y := 240 - Round(A2 * sin((w2)*(t) + f2));
{ X := 320 + Round(A1 * cos((w1)*(t) + f1+dt));
Y := 240 - Round(A2 * sin((w2)*(t) + f2));
} PutPixel(X, Y, Colour);
end;
CloseGraph;
end.
Назад