Improved julia

This commit is contained in:
neauoire 2020-05-08 21:02:19 +09:00
parent e48355be7e
commit 072482a750
4 changed files with 23 additions and 15 deletions

View File

@ -82,7 +82,7 @@ begin
pset(i, j);
end;
dpix := dpix div 2;
WriteLn('dpix = ', dpix);
Writeln('dpix = ', dpix);
until button or (dpix < 1)
end.

View File

@ -1,46 +1,50 @@
program ExampleJulia;
{Program to compute and plot Julia set.}
const
scale = 0.01;
R = 10;
type
complex = record
r: Real;
i: real
end;
var
i, j, k, n, row, col, Nit: Integer;
x, y: Real;
z, znew, c: complex;
done, gone: Boolean;
drawingRect: Rect;
procedure prod (a, b: complex; var c: complex);
{Does complex multiplication: c = a bullet b}
begin
c.r := a.r * b.r - a.i * b.i;
c.i := a.r * b.i + a.i * b.r;
end;
procedure add (a, b: complex; var c: complex);
{Does complex addition: c = a + b}
begin
c.r := a.r + b.r;
c.i := a.i + b.i;
end;
procedure plot (c, r: integer);
{Procedure to pixel (c.r).}
begin
Moveto(c, r);
Lineto(c, r);
end;
begin
ShowText;
writeLn('How many iterations at each point?');
readLn(Nit);
writeLn('Value of C: (Cr,Ci)?');
ReadLn(c.r, c.i);
showdrawing;
Writeln('Value of Nit,Cr,Ci?');
ReadLn(Nit, c.r, c.i);
Showdrawing;
SetRect(drawingRect, 200, 40, 600, 400);
SetDrawingRect(drawingRect);
ForeColor(blackColor);
n := 0;
for col := 1 to 400 do
@ -59,5 +63,9 @@ begin
plot(col, row);
n := 0;
end;
end.
end.
{ note: Interesting fractals }
{ 10 0 1 }
{ 50 0.3 -0.5 }

View File

@ -19,7 +19,7 @@ program ExampleDrawingExport;
if err = noErr then
Exit(CheckError);
ShowText;
WriteLn('Error:', err);
Writeln('Error:', err);
Cleanup;
Halt;
end;

View File

@ -21,7 +21,7 @@ program ExampleDrawingExport;
if err = noErr then
Exit(CheckError);
ShowText;
WriteLn('Error:', err);
Writeln('Error:', err);
Cleanup;
Halt;
end;