' 2002, Initial version\r
' 2024.09, Improved program readability using AI\r
\r
-' use:\r
-' cursor keys - move around\r
+' Keyboard controls:\r
+' Cursor keys - move around\r
' - - fly up\r
' + - fly down\r
' ESC - exit program\r
DECLARE SUB mulcor ()\r
DECLARE SUB nait3d ()\r
DECLARE SUB calcsin ()\r
-DIM SHARED xn(4000), yn(4000), zn(4000)\r
+DIM SHARED vertexX(4000), vertexY(4000), vertexZ(4000)\r
DIM SHARED x(4000), y(4000), z(4000)\r
\r
DIM SHARED xo(4000), yo(4000), zo(4000)\r
-DIM SHARED point1(4000), point2(4000)\r
-DIM SHARED col(4000)\r
-DIM SHARED nump, numl\r
-DIM SHARED tmnump, tmnuml, tm\r
+DIM SHARED linePoint1(4000), linePoint2(4000)\r
+DIM SHARED lineColor(4000)\r
+DIM SHARED vertexCount, lineCount\r
+DIM SHARED tmvertexCount, tmlineCount, tm\r
DIM SHARED myx, myy, myz, mye, myk\r
\r
myx = 520\r
mkgr2 0, 0, 500\r
mkgr3 0, -500, 0\r
\r
- xn(nump + 1) = 0\r
- yn(nump + 1) = -500\r
- zn(nump + 1) = 0\r
+ vertexX(vertexCount + 1) = 0\r
+ vertexY(vertexCount + 1) = -500\r
+ vertexZ(vertexCount + 1) = 0\r
\r
- xn(nump + 2) = 0\r
- yn(nump + 2) = 500\r
- zn(nump + 2) = 0\r
+ vertexX(vertexCount + 2) = 0\r
+ vertexY(vertexCount + 2) = 500\r
+ vertexZ(vertexCount + 2) = 0\r
\r
- xn(nump + 3) = -500\r
- yn(nump + 3) = 0\r
- zn(nump + 3) = 0\r
+ vertexX(vertexCount + 3) = -500\r
+ vertexY(vertexCount + 3) = 0\r
+ vertexZ(vertexCount + 3) = 0\r
\r
- xn(nump + 4) = 500\r
- yn(nump + 4) = 0\r
- zn(nump + 4) = 0\r
+ vertexX(vertexCount + 4) = 500\r
+ vertexY(vertexCount + 4) = 0\r
+ vertexZ(vertexCount + 4) = 0\r
\r
- xn(nump + 5) = 0\r
- yn(nump + 5) = 0\r
- zn(nump + 5) = -500\r
+ vertexX(vertexCount + 5) = 0\r
+ vertexY(vertexCount + 5) = 0\r
+ vertexZ(vertexCount + 5) = -500\r
\r
- xn(nump + 6) = 0\r
- yn(nump + 6) = 0\r
- zn(nump + 6) = 500\r
+ vertexX(vertexCount + 6) = 0\r
+ vertexY(vertexCount + 6) = 0\r
+ vertexZ(vertexCount + 6) = 500\r
\r
- point1(numl + 1) = nump + 1\r
- point2(numl + 1) = nump + 2\r
- col(numl + 1) = c\r
+ linePoint1(lineCount + 1) = vertexCount + 1\r
+ linePoint2(lineCount + 1) = vertexCount + 2\r
+ lineColor(lineCount + 1) = c\r
\r
- point1(numl + 2) = nump + 3\r
- point2(numl + 2) = nump + 4\r
- col(numl + 2) = c\r
+ linePoint1(lineCount + 2) = vertexCount + 3\r
+ linePoint2(lineCount + 2) = vertexCount + 4\r
+ lineColor(lineCount + 2) = c\r
\r
- point1(numl + 3) = nump + 5\r
- point2(numl + 3) = nump + 6\r
- col(numl + 3) = c\r
+ linePoint1(lineCount + 3) = vertexCount + 5\r
+ linePoint2(lineCount + 3) = vertexCount + 6\r
+ lineColor(lineCount + 3) = c\r
\r
- nump = nump + 6\r
- numl = numl + 3\r
- tmnump = nump\r
- tmnuml = numl\r
+ vertexCount = vertexCount + 6\r
+ lineCount = lineCount + 3\r
+ tmvertexCount = vertexCount\r
+ tmlineCount = lineCount\r
END SUB\r
\r
SUB graaf\r
FOR z = -500 TO 500 STEP 50\r
\r
d = d + 1\r
- xn(nump + d) = x\r
+ vertexX(vertexCount + d) = x\r
valem x / 50, z / 50, y\r
- yn(nump + d) = y * 50\r
- zn(nump + d) = z\r
+ vertexY(vertexCount + d) = y * 50\r
+ vertexZ(vertexCount + d) = z\r
\r
IF z > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 1\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 1\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
IF x > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 21\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 21\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
NEXT z\r
NEXT x\r
\r
- nump = nump + d\r
- numl = numl + e\r
+ vertexCount = vertexCount + d\r
+ lineCount = lineCount + e\r
END SUB\r
\r
SUB mkgr (x1, y1, z1)\r
FOR y = -500 TO 500 STEP 100\r
\r
d = d + 1\r
- xn(nump + d) = x1\r
- yn(nump + d) = y1 + y\r
- zn(nump + d) = z1 + z\r
+ vertexX(vertexCount + d) = x1\r
+ vertexY(vertexCount + d) = y1 + y\r
+ vertexZ(vertexCount + d) = z1 + z\r
\r
IF y > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 1\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 1\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
IF z > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 11\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 11\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
NEXT y\r
NEXT z\r
\r
- nump = nump + d\r
- numl = numl + e\r
+ vertexCount = vertexCount + d\r
+ lineCount = lineCount + e\r
END SUB\r
\r
SUB mkgr2 (x1, y1, z1)\r
FOR y = -500 TO 500 STEP 100\r
\r
d = d + 1\r
- xn(nump + d) = x1 + x\r
- yn(nump + d) = y1 + y\r
- zn(nump + d) = z1\r
+ vertexX(vertexCount + d) = x1 + x\r
+ vertexY(vertexCount + d) = y1 + y\r
+ vertexZ(vertexCount + d) = z1\r
\r
IF y > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 1\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 1\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
IF x > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 11\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 11\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
NEXT y\r
NEXT x\r
\r
- nump = nump + d\r
- numl = numl + e\r
+ vertexCount = vertexCount + d\r
+ lineCount = lineCount + e\r
END SUB\r
\r
SUB mkgr3 (x1, y1, z1)\r
FOR z = -500 TO 500 STEP 100\r
\r
d = d + 1\r
- xn(nump + d) = x1 + x\r
- yn(nump + d) = y1\r
- zn(nump + d) = z\r
+ vertexX(vertexCount + d) = x1 + x\r
+ vertexY(vertexCount + d) = y1\r
+ vertexZ(vertexCount + d) = z\r
\r
IF z > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 1\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 1\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
IF x > -500 THEN\r
e = e + 1\r
- point1(numl + e) = nump + d\r
- point2(numl + e) = nump + d - 11\r
- col(numl + e) = c\r
+ linePoint1(lineCount + e) = vertexCount + d\r
+ linePoint2(lineCount + e) = vertexCount + d - 11\r
+ lineColor(lineCount + e) = c\r
END IF\r
\r
NEXT z\r
NEXT x\r
\r
- nump = nump + d\r
- numl = numl + e\r
+ vertexCount = vertexCount + d\r
+ lineCount = lineCount + e\r
END SUB\r
\r
SUB nait3d\r
\r
1\r
-nump = tmnump\r
-numl = tmnuml\r
+vertexCount = tmvertexCount\r
+lineCount = tmlineCount\r
tm = tm + 1\r
graaf\r
\r
C1 = COS(deg1): S1 = SIN(deg1)\r
C2 = COS(Deg2): S2 = SIN(Deg2)\r
\r
-FOR a = 1 TO nump\r
+FOR a = 1 TO vertexCount\r
\r
- xo = xn(a) - myx\r
- yo = -yn(a) - myy\r
- zo = zn(a) - myz\r
+ xo = vertexX(a) - myx\r
+ yo = -vertexY(a) - myy\r
+ zo = vertexZ(a) - myz\r
\r
x1 = (xo * C1 - zo * S1)\r
z1 = (xo * S1 + zo * C1)\r
END IF\r
NEXT\r
\r
-FOR a = 1 TO numl\r
- p1 = point1(a)\r
- p2 = point2(a)\r
+FOR a = 1 TO lineCount\r
+ p1 = linePoint1(a)\r
+ p2 = linePoint2(a)\r
\r
IF xo(p1) = -1 OR xo(p2) = -1 THEN\r
' Do nothing\r
ELSE\r
LINE (xo(p1), yo(p1))-(xo(p2), yo(p2)), 0\r
- LINE (x(p1), y(p1))-(x(p2), y(p2)), col(a)\r
+ LINE (x(p1), y(p1))-(x(p2), y(p2)), lineColor(a)\r
END IF\r
\r
NEXT\r
END SELECT\r
END IF\r
\r
-_LIMIT (30)\r
\r
GOTO 1\r
END SUB\r
CLS\r
\r
FOR a = 1 TO 4000\r
- col(a) = 15\r
+ lineColor(a) = 15\r
NEXT a\r
\r
-nump = 0\r
-numl = 0\r
+vertexCount = 0\r
+lineCount = 0\r
\r
getcor\r
\r
'z = z + 3 * ((-INT((x - .3) / 20) * INT((23 + x - ABS(y * 1.2)) / 15)) + -INT(-y / 20) * -INT(-x / 20) * INT(-((x - 2) * (x - 2) + (y * 1.2 - 4) * (y * 1.2 - 4)) / 2000 + 1.01) + -INT(y / 20) * -INT(-x / 20) * INT(-((x - 2) * (x - 2) + (y * 1.2 + 4) * (y * 1.2 + 4)) / 2000 + 1.01)) ' heart\r
\r
END SUB\r
+\r