![]() |
Матрица статей Список статей Всячина Контакты | ||||||||||||
|
Ледяные фракталы
program Ice1; uses CRT, Graph; var gd, gm: Integer; procedure Draw(x, y, l, u : Real; t : Integer); procedure Draw2(Var x, y: Real; l, u : Real; t : Integer); begin Draw(x, y, l, u, t); x := x + l*cos(u); y := y - l*sin(u); end; begin if t > 0 then begin l := l*0.5; Draw2(x, y, l, u, t-1); Draw2(x, y, l*0.8, u+pi/2, t-1); Draw2(x, y, l*0.8, u-pi/2, t-1); Draw2(x, y, l, u, t-1) end else Line(Round(x), Round(y), Round(x+cos(u)*l), Round(y-sin(u)*l)) end; begin gd := Detect; InitGraph(gd, gm, 'c:\bp\bgi'); Draw(410, 10, 400, -pi, 5); Draw(10, 410, 400, 0, 5); Draw(10, 10, 400, -pi/2, 5); Draw(410, 410, 400, pi/2, 5); ReadKey; CloseGraph end. program Ice2; uses CRT, Graph; var gd, gm: Integer; procedure Draw(x, y, l, u : Real; t : Integer); procedure Draw2(Var x, y: Real; l, u : Real; t : Integer); begin Draw(x, y, l, u, t); x := x + l*cos(u); y := y - l*sin(u); end; begin if t > 0 then begin l := l*0.5; Draw2(x, y, l, u, t-1); Draw2(x, y, l*0.45, u+2*pi/3, t-1); Draw2(x, y, l*0.45, u-pi/3, t-1); Draw2(x, y, l*0.45, u+pi/3, t-1); Draw2(x, y, l*0.45, u-2*pi/3, t-1); Draw2(x, y, l, u, t-1) end else Line(Round(x), Round(y), Round(x+cos(u)*l), Round(y-sin(u)*l)) end; begin gd := Detect; InitGraph(gd, gm, 'c:\bp\bgi'); Draw(210, 8, 400, -2*pi/3, 3); Draw(10, 354, 400, 0, 3); Draw(410, 354, 400, 2*pi/3, 3); ReadKey; CloseGraph end. Смотрите также: Ссылки: |