By R. S. Doiel, 2020-05-02
This is a port of the IFS module described in Martin Reiser and Niklaus Wirth's "Programming in Oberon: Steps beyond Pascal and Modula-2". The code has been adapted from the original Oberon presented in the book to Oberon-7 as described in Wirth's Project Oberon 2013.
One module file and several data files are included in this project.
obnc IFS.Mod
The module's Init*
procedure needs to read in the initialization
data before drawing the fractals. The data file format is as follows
The initialization procedures reads text from standard input. The layout of variables is as follows.
x0 y0 e
a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4
d1 d2 d3 d4
e1 e2 e3 e4
f1 f2 f3 f4
p1 p2 p3 p4
x0 y0 e
x0
and y0
are the left and bottom edges. e
is the a scaling factor.
In the source it is referred to as "unit size".
The remaining rows are real number values. Each column represents
a function pass (e.g. 1 to 4). Each rows represents a variable,
a
, b
, c
, d
, e
, f
, p
values.
In all rows numbers are separated by one or more spaces.
440 28 64
0.0 0.85 0.2 -0.15
0.0 0.04 -0.26 0.28
0.0 -0.04 0.23 0.26
0.16 0.85 0.22 0.24
0.0 0.0 0.0 0.0
0.0 1.60 1.60 0.44
0.01 0.85 0.07 0.07
480 1 1200
0.0 0.42 0.42 0.1
0.0 -0.42 0.42 0.0
0.0 0.42 -0.42 0.0
0.5 0.42 0.42 0.1
0.0 0.0 0.0 0.0
0.0 0.2 0.2 0.2
0.05 0.4 0.4 0.15
./IFS < Fern1.txt
./IFS < Tree.txt
The program expects to read a series of integer and real values
from standard input. You can use a POSIX style pipe or redirect
to cause IFS
to read the file.
This code was originally developed by Martin Reiser and Niklaus Wirth as part of their 1992 book, "Programming in Oberon: Steps beyond Pascal and Modula-2"1. This repository was an exercise and seeing how easy it would be to adapt the book's code to Oberon-7.