home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
GA
/
GA028.ZIP
/
HOP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-08-27
|
1KB
|
52 lines
(* Barry Martin's function *)
(* Version 1.1 August 27 1986 *)
VAR
a, b, c : real; { coefficients }
x0, y0 : real; { internal coordinates }
{ converted to plot coordinates x, y below }
CONST boredom = 5000; { how often to change colors }
Procedure Set_Defaults;
BEGIN
a := -3.14;
b := 0.3;
c := 0.3;
xmin := -13.0; { centered viewing window }
xmax := 7.0;
ymin := -7.0;
ymax := 9.0;
END;
Procedure Initialize;
BEGIN
x := 0; x0 := 0;
y := 0; y0 := 0;
END;
Procedure Set_Coefficients;
BEGIN
Writeln;
Writeln('Enter Coefficients---');
Write('A (',a:10:4,'): '); Readln(a);
Write('B (',b:10:4,'): '); Readln(b);
Write('C (',c:10:4,'): '); Readln(c);
END;
Procedure Next_Iteration;
VAR x1, y1 : real;
BEGIN
IF x0 < 0.0 THEN
x1 := y0 + Sqrt(Abs(b * x0 - c))
ELSE
x1 := y0 - Sqrt(Abs(b * x0 - c));
y1 := a - x0;
x0 := x1;
y0 := y1;
x := (x1 + y1); { rotate 45 degrees }
y := (x1 - y1); { fast & lean-- no trig }
END;