diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2019-02-11 11:49:19 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2019-02-11 11:49:39 +0100 |
commit | 98cab31fc3659e33aef260efca55bf9f1753164c (patch) | |
tree | f1affa84049ef9b268e6c4f521f000478b0f3a8e /app/mpg/1987/src/std primitives | |
parent | 71e2b36ccd05ea678e62e32ee6245df2b8d6ac17 (diff) | |
download | eumel-src-98cab31fc3659e33aef260efca55bf9f1753164c.tar.gz eumel-src-98cab31fc3659e33aef260efca55bf9f1753164c.tar.bz2 eumel-src-98cab31fc3659e33aef260efca55bf9f1753164c.zip |
Add source files from Michael
Diffstat (limited to 'app/mpg/1987/src/std primitives')
-rw-r--r-- | app/mpg/1987/src/std primitives | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/app/mpg/1987/src/std primitives b/app/mpg/1987/src/std primitives new file mode 100644 index 0000000..dca20bd --- /dev/null +++ b/app/mpg/1987/src/std primitives @@ -0,0 +1,79 @@ +PROC std circle (INT CONST xp,yp,r,from,to):
+ moveto (xp,yp);
+ REAL VAR ang :: real (from MOD 360),
+ rad :: real(r),
+ max :: endwinkel,
+ cx :: real (xp),
+ cy :: real (yp),
+ ax0 :: cx,
+ ay0 :: cy,
+ ax1, ay1;
+
+ BOOL VAR fullcircle :: ang = 0.0 AND max = 360.0;
+ IF fullcircle
+ THEN move to (int (cx + rad * cosd (ang)+0.5),
+ int (cy + rad * -sind (ang)+0.5));
+ ang INCR 1.0
+ FI;
+ WHILE ang <= max REP
+ ax1 := cx + rad * cosd (ang);
+ ay1 := cy + rad * -sind (ang);
+ draw arc;
+ ang INCR 1.0
+ PER;
+ IF NOT fullcircle
+ THEN ax0 := cx;
+ ay0 := cy;
+ draw arc;
+ draw to (xp,yp)
+ ELSE move to (xp,yp)
+ FI.
+
+ draw arc:
+ IF clipped line (ax0,ay0,ax1,ay1)
+ THEN draw to (int (ax1+0.5), int (ay1+0.5))
+ FI;
+ ax0 := ax1;
+ ay0 := ay1.
+
+ endwinkel:
+ IF (to MOD 360) = 0
+ THEN 360.0
+ ELSE real (to MOD 360)
+ FI
+END PROC std circle;
+
+PROC std box (INT CONST x0, y0, x1, y1, pattern):
+ REAL VAR xx0 :: real (x0),
+ yy0 :: real (y0),
+ xx1 :: real (x0),
+ yy1 :: real (y1);
+ IF clipped line (xx0,yy0,xx1,yy1)
+ THEN moveto (int (xx0), int (yy0));
+ drawto (int (xx1), int (yy1))
+ FI;
+ xx0 := real (x0);
+ yy0 := real (y1);
+ xx1 := real (x1);
+ yy1 := real (y1);
+ IF clipped line (xx0,yy0,xx1,yy1)
+ THEN moveto (int (xx0), int (yy0));
+ drawto (int (xx1), int (yy1))
+ FI;
+ xx0 := real (x1);
+ yy0 := real (y1);
+ xx1 := real (x1);
+ yy1 := real (y0);
+ IF clipped line (xx0,yy0,xx1,yy1)
+ THEN moveto (int (xx0), int (yy0));
+ drawto (int (xx1), int (yy1))
+ FI;
+ xx0 := real (x1);
+ yy0 := real (y0);
+ xx1 := real (x0);
+ yy1 := real (y0);
+ IF clipped line (xx0,yy0,xx1,yy1)
+ THEN moveto (int (xx0), int (yy0));
+ drawto (int (xx1), int (yy1))
+ FI
+END PROC std box;
|