home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
pgmutl
/
elan.zoo
/
intgraph
/
peano.eln
< prev
next >
Wrap
Text File
|
1988-10-11
|
2KB
|
108 lines
PROC approximation north (INT CONST n):
IF n <> 0
THEN
approximation east (n-1);
line segment east;
approximation north (n-1);
line segment north;
approximation north (n-1);
line segment west;
approximation west (n-1)
FI
ENDPROC approximation north;
PROC approximation east (INT CONST n):
IF n <> 0
THEN
approximation north (n-1);
line segment north;
approximation east (n-1);
line segment east;
approximation east (n-1);
line segment south;
approximation south (n-1)
FI
ENDPROC approximation east;
PROC approximation south (INT CONST n):
IF n <> 0
THEN
approximation west (n-1);
line segment west;
approximation south (n-1);
line segment south;
approximation south (n-1);
line segment east;
approximation east (n-1)
FI
ENDPROC approximation south;
PROC approximation west (INT CONST n):
IF n <> 0
THEN
approximation south (n-1);
line segment south;
approximation west (n-1);
line segment west;
approximation west (n-1);
line segment north;
approximation north (n-1)
FI
ENDPROC approximation west;
PROC line segment north:
draw (x, y + d)
ENDPROC line segment north;
PROC line segment south:
draw (x, y - d)
ENDPROC line segment south;
PROC line segment east:
draw (x + d, y)
ENDPROC line segment east;
PROC line segment west:
draw (x - d, y)
ENDPROC line segment west;
PROC draw (REAL CONST xp, yp):
draw (round (scale * xp * aspect),
graphics y limit - round (scale * yp));
x := xp;
y := yp
ENDPROC draw;
PROC move (REAL CONST xp, yp):
move (round (scale * xp * aspect),
graphics y limit - round (scale * yp));
x := xp;
y := yp
ENDPROC move;
program:
ask order;
draw curve;
end program.
ask order:
enter graphics mode;
INT VAR n :: ask int ("Peano curve of order? ").
draw curve:
REAL VAR x, y;
REAL CONST
d :: 1.0 / 2.0 ** n,
scale :: real (min (graphics x limit,
graphics y limit - line height));
move (d / 2.0, d / 2.0);
approximation east (n).
end program:
wait for confirmation (graphics x limit DIV 2, 1);
leave graphics mode.