-' 3D rocket simulator\r
-' made by Svjatoslav Agejenko\r
-' in 2001\r
-' H-Page: svjatoslav.eu\r
-' E-Mail: svjatoslav@svjatoslav.eu\r
- \r
-' arrow keys - move around\r
-' 2, 6, 4, 8 - look around\r
-' - - fly up\r
-' + - fly down\r
-\r
-\r
-DECLARE SUB addp ()\r
-DECLARE SUB addl ()\r
-DEFDBL A-Z\r
-DECLARE SUB teerock ()\r
-DECLARE SUB teemaa ()\r
-DECLARE SUB start ()\r
-DECLARE SUB n3d ()\r
-\r
-DIM SHARED px(1 TO 1500)\r
-DIM SHARED py(1 TO 1500)\r
-DIM SHARED pz(1 TO 1500)\r
-\r
-DIM SHARED l1(1 TO 3000)\r
-DIM SHARED l2(1 TO 3000)\r
-DIM SHARED lc(1 TO 3000)\r
-\r
-DIM SHARED rpx(1 TO 1900)\r
-DIM SHARED rpy(1 TO 1900)\r
-\r
-DIM SHARED rkx(1 TO 200)\r
-DIM SHARED rky(1 TO 200)\r
-DIM SHARED rkz(1 TO 200)\r
-\r
-DIM SHARED mitp, mitl\r
-DIM SHARED myx, myy, myz\r
-DIM SHARED myxp, myyp, myzp\r
-DIM SHARED my1, my2\r
-\r
-\r
-DIM SHARED ox1(1 TO 2500)\r
-DIM SHARED oy1(1 TO 2500)\r
-DIM SHARED ox2(1 TO 2500)\r
-DIM SHARED oy2(1 TO 2500)\r
-DIM SHARED frm, frm2, frm3\r
-\r
-DIM SHARED mk, mks, rs, rst\r
-DIM SHARED pi\r
-DIM SHARED rkb, rke, rkm\r
-DIM SHARED rx, ry, rz, rxp, ryp, rzp\r
-\r
-DIM SHARED tmr$, ts\r
-DIM SHARED ale\r
-\r
-start\r
-my1 = -pi / 2\r
-\r
-rx = 0\r
-ry = mk / 2 + .009\r
-rz = 0\r
-\r
-myx = 0\r
-myy = mk / 2\r
-myz = -.05\r
-\r
-ts = 0\r
-frm2 = 999999\r
-tmr$ = TIME$\r
-1\r
-frm = frm + 1\r
-frm2 = frm2 + 1\r
-\r
-LOCATE 1, 1\r
-PRINT mitp, mitl, mk, mks\r
-LOCATE 2, 1\r
-PRINT rkb, rke, TIMER\r
-\r
-\r
-rx = rx + (rxp * ts)\r
-ry = ry + (ryp * ts)\r
-rz = rz + (rzp * ts)\r
-\r
-ryp = ryp + (.0098 * ts)\r
-rxp = SIN(frm / 20) / 50\r
-'ryp = .001\r
-\r
-FOR a = 1 TO rkm\r
-px(a + rkb - 1) = rkx(a) + rx\r
-py(a + rkb - 1) = rky(a) + ry\r
-pz(a + rkb - 1) = rkz(a) + rz\r
-NEXT a\r
-\r
-\r
-myx = myx + (myxp * ts)\r
-myy = myy + (myyp * ts)\r
-myz = myz + (myzp * ts)\r
-\r
-n3d\r
-\r
-\r
-\r
-a$ = INKEY$\r
-IF a$ <> "" THEN\r
-IF a$ = CHR$(0) + "H" THEN\r
-myzp = myzp - SIN(my1) / 100\r
-myxp = myxp + COS(my1) / 100\r
-END IF\r
-IF a$ = CHR$(0) + "P" THEN\r
-myzp = myzp + SIN(my1) / 100\r
-myxp = myxp - COS(my1) / 100\r
-END IF\r
-\r
-IF a$ = CHR$(0) + "M" THEN\r
-myzp = myzp + COS(my1) / 100\r
-myxp = myxp + SIN(my1) / 100\r
-END IF\r
-IF a$ = CHR$(0) + "K" THEN\r
-myzp = myzp - COS(my1) / 100\r
-myxp = myxp - SIN(my1) / 100\r
-END IF\r
-\r
-\r
-IF a$ = CHR$(27) THEN SYSTEM\r
-IF a$ = "4" THEN my1 = my1 + .1\r
-IF a$ = "6" THEN my1 = my1 - .1\r
-IF a$ = "2" THEN my2 = my2 + .1\r
-IF a$ = "8" THEN my2 = my2 - .1\r
-IF a$ = "-" THEN myyp = myyp + .01\r
-IF a$ = "+" THEN myyp = myyp - .01\r
-IF a$ = " " THEN myzp = myzp / 2: myxp = myxp / 2\r
-\r
-END IF\r
-\r
-v = SQR(rx * rx + ry * ry + rz * rz)\r
-s = SQR(rxp * rxp + ryp * ryp + rzp * rzp)\r
-\r
-\r
-IF tmr$ <> TIME$ THEN\r
-tmr$ = TIME$\r
-\r
-LOCATE 29, 1\r
-PRINT "speed"; INT(s * 1000)\r
-LOCATE 30, 1\r
-PRINT "fps"; frm3; "timeslice"; INT(ts * 1000); "distance"; v;\r
-frm3 = frm2\r
-ts = 1 / frm3\r
-frm2 = 0\r
-addp\r
-addl\r
-END IF\r
-GOTO 1\r
-\r
-SUB addl\r
-mitp = mitp + 1\r
-px(mitp) = rx\r
-py(mitp) = ry\r
-pz(mitp) = rz\r
-\r
-IF ale > 0 THEN\r
-mitl = mitl + 1\r
-l1(mitl) = ale\r
-l2(mitl) = mitp\r
-lc(mitl) = 13\r
-END IF\r
-\r
-ale = mitp\r
-END SUB\r
-\r
-SUB addp\r
-'DIM SHARED mitp, mitl\r
-mitp = mitp + 1\r
-px(mitp) = rx\r
-py(mitp) = ry\r
-pz(mitp) = rz\r
-\r
-mitp = mitp + 1\r
-px(mitp) = rx - .001\r
-py(mitp) = ry - .001\r
-pz(mitp) = rz\r
-\r
-mitp = mitp + 1\r
-px(mitp) = rx + .001\r
-py(mitp) = ry - .001\r
-pz(mitp) = rz\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 14\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp - 2\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 14\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 2\r
-lc(mitl) = 14\r
-\r
-\r
-\r
-END SUB\r
-\r
-SUB n3d\r
-s1 = SIN(my1)\r
-c1 = COS(my1)\r
-\r
-s2 = SIN(my2)\r
-c2 = COS(my2)\r
-\r
-\r
-FOR a = 1 TO mitp\r
-x = px(a) - myx\r
-y = py(a) - myy\r
-z = pz(a) - myz\r
-\r
-x1 = x * s1 + z * c1\r
-z1 = x * c1 - z * s1\r
-\r
-y1 = z1 * s2 + y * c2\r
-z2 = z1 * c2 - y * s2\r
-\r
-IF z2 < .00001 THEN\r
-rpx(a) = -1\r
-ELSE\r
-rpx(a) = x1 / z2 * 200 + 320\r
-rpy(a) = 240 - y1 / z2 * 200\r
-IF rpx(a) < -50 OR rpx(a) > 1000 OR rpy(a) < -50 OR rpy(a) > 1000 THEN rpx(a) = -1\r
-END IF\r
-NEXT a\r
-\r
-\r
-\r
-FOR a = 1 TO mitl\r
-p1 = l1(a)\r
-p2 = l2(a)\r
-x1 = rpx(p1)\r
-y1 = rpy(p1)\r
-x2 = rpx(p2)\r
-y2 = rpy(p2)\r
-IF ox1(a) = -1 OR ox2(a) = -1 THEN ELSE LINE (ox1(a), oy1(a))-(ox2(a), oy2(a)), 0\r
-IF x1 = -1 OR x2 = -1 THEN GOTO 2\r
-LINE (x1, y1)-(x2, y2), lc(a)\r
-2\r
-ox1(a) = x1\r
-oy1(a) = y1\r
-ox2(a) = x2\r
-oy2(a) = y2\r
-\r
-NEXT a\r
-\r
-\r
-END SUB\r
-\r
-SUB start\r
-SCREEN 12\r
-VIEW PRINT 1 TO 30\r
-\r
-mk = 12714\r
-'mks = 250\r
-mks = 500\r
-rst = 4\r
-pi = 3.142657\r
-rs = .00002\r
-frm2 = 0\r
-\r
-ale = -1\r
-px(1) = -.001\r
-py(1) = mk / 2\r
-pz(1) = -.001\r
-\r
-px(2) = .001\r
-py(2) = mk / 2\r
-pz(2) = -.001\r
-\r
-px(3) = .001\r
-py(3) = mk / 2\r
-pz(3) = .001\r
-\r
-px(4) = -.001\r
-py(4) = mk / 2\r
-pz(4) = .001\r
-\r
-mitp = 4\r
-\r
-l1(1) = 1\r
-l2(1) = 2\r
-lc(1) = 14\r
-\r
-l1(2) = 2\r
-l2(2) = 3\r
-lc(2) = 14\r
-\r
-l1(3) = 3\r
-l2(3) = 4\r
-lc(3) = 14\r
-\r
-l1(4) = 4\r
-l2(4) = 1\r
-lc(4) = 14\r
-\r
-mitl = 4\r
-\r
-myx = 0\r
-myy = mk * 2\r
-myz = -35\r
-\r
-teemaa\r
-myxp = 0\r
-myyp = 0\r
-myzp = 0\r
-\r
-my1 = 0\r
-\r
-rkb = mitp + 1\r
-teerock\r
-rke = mitp\r
-\r
-rkm = rke - rkb + 1\r
-'DIM SHARED rkx(1 TO 1000)\r
-'DIM SHARED rky(1 TO 1000)\r
-'DIM SHARED rkz(1 TO 1000)\r
-\r
-FOR a = 1 TO rkm\r
-p = rkb + a - 1\r
-rkx(a) = px(p)\r
-rky(a) = py(p)\r
-rkz(a) = pz(p)\r
-NEXT a\r
-\r
-\r
-END SUB\r
-\r
-SUB teemaa\r
-tmpp = mitp\r
-le2 = 0\r
-\r
-FOR z = -(mk / 3) TO (mk / 3) STEP mks\r
-le = 0\r
-le2 = le2 + 1\r
-FOR x = -(mk / 3) TO (mk / 3) STEP mks\r
-\r
-\r
-IF SQR(x * x + z * z) > (mk / 2.5) THEN GOTO 4\r
-le = le + 1\r
-IF le = 1 THEN xs = (x / mks)\r
-mitp = mitp + 1\r
-px(mitp) = x\r
-v = SQR(x * x + z * z)\r
-py(mitp) = SQR((v + (mk / 2)) * ((mk / 2) - v))\r
-pz(mitp) = z\r
-IF le > 1 THEN\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 3\r
-END IF\r
-\r
-IF le2 > 1 THEN\r
-IF xso > (x / mks) THEN GOTO 4\r
-IF xso + leo <= (x / mks) THEN GOTO 4\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - leo - xso + xs\r
-lc(mitl) = 3\r
-END IF\r
-4\r
-\r
-NEXT x\r
-leo = le\r
-xso = xs\r
-NEXT z\r
-\r
-END SUB\r
-\r
-SUB teerock\r
-\r
-\r
-s = 50\r
-FOR y = -9 TO 10 STEP rst\r
-st = pi * 2 / 6\r
-IF y > 5 THEN s = s - 3\r
-IF y > 8 THEN s = s - 6\r
-FOR a = 0 TO pi * 2 STEP st\r
-x1 = SIN(a) * s\r
-z1 = COS(a) * s\r
-'DIM SHARED mitp, mitl\r
-'DIM SHARED px(1 TO 4000)\r
-'DIM SHARED py(1 TO 4000)\r
-'DIM SHARED pz(1 TO 4000)\r
-'DIM SHARED l1(1 TO 7000)\r
-'DIM SHARED l2(1 TO 7000)\r
-'DIM SHARED lc(1 TO 7000)\r
-\r
-mitp = mitp + 1\r
-px(mitp) = x1 * rs\r
-py(mitp) = y * 50 * rs\r
-pz(mitp) = z1 * rs\r
-\r
-IF a > 0 THEN\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 10\r
-END IF\r
-\r
-IF y > -9 THEN\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 7\r
-lc(mitl) = 10\r
-END IF\r
-\r
-NEXT a\r
-NEXT y\r
-\r
-mitp = mitp + 1\r
-px(mitp) = 0\r
-py(mitp) = 11 * 50 * rs\r
-pz(mitp) = 0\r
-\r
-\r
-FOR a = 1 TO 6\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - a\r
-lc(mitl) = 10\r
-NEXT a\r
-\r
-mitp = mitp + 1\r
-px(mitp) = -100 * rs\r
-py(mitp) = -450 * rs\r
-pz(mitp) = 0\r
-\r
-mitp = mitp + 1\r
-px(mitp) = 100 * rs\r
-py(mitp) = -450 * rs\r
-pz(mitp) = 0\r
-\r
-mitp = mitp + 1\r
-px(mitp) = 0\r
-py(mitp) = -200 * rs\r
-pz(mitp) = 0\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 12\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp - 2\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 12\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 2\r
-lc(mitl) = 12\r
-\r
-\r
-\r
-mitp = mitp + 1\r
-px(mitp) = 0\r
-py(mitp) = -450 * rs\r
-pz(mitp) = -100 * rs\r
-\r
-mitp = mitp + 1\r
-px(mitp) = 0\r
-py(mitp) = -450 * rs\r
-pz(mitp) = 100 * rs\r
-\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 12\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp - 2\r
-l2(mitl) = mitp - 1\r
-lc(mitl) = 12\r
-\r
-mitl = mitl + 1\r
-l1(mitl) = mitp\r
-l2(mitl) = mitp - 2\r
-lc(mitl) = 12\r
-\r
-\r
-END SUB\r
-\r
+' 3D rocket simulator. Rocket takes off from the surface of the planet.
+' made by Svjatoslav Agejenko
+' in 2001
+' H-Page: svjatoslav.eu
+' E-Mail: svjatoslav@svjatoslav.eu
+
+' arrow keys - move around
+' 2, 6, 4, 8 - look around
+' - - fly up
+' + - fly down
+
+DECLARE SUB addp ()
+DECLARE SUB addl ()
+DEFDBL A-Z
+DECLARE SUB teerock ()
+DECLARE SUB teemaa ()
+DECLARE SUB start ()
+DECLARE SUB n3d ()
+
+DIM SHARED px(1 TO 1500)
+DIM SHARED py(1 TO 1500)
+DIM SHARED pz(1 TO 1500)
+
+DIM SHARED l1(1 TO 3000)
+DIM SHARED l2(1 TO 3000)
+DIM SHARED lc(1 TO 3000)
+
+DIM SHARED rpx(1 TO 1900)
+DIM SHARED rpy(1 TO 1900)
+
+DIM SHARED rkx(1 TO 200)
+DIM SHARED rky(1 TO 200)
+DIM SHARED rkz(1 TO 200)
+
+DIM SHARED mitp, mitl
+DIM SHARED myx, myy, myz
+DIM SHARED myxp, myyp, myzp
+DIM SHARED my1, my2
+
+DIM SHARED ox1(1 TO 2500)
+DIM SHARED oy1(1 TO 2500)
+DIM SHARED ox2(1 TO 2500)
+DIM SHARED oy2(1 TO 2500)
+DIM SHARED frm, frm2, frm3
+
+DIM SHARED mk, mks, rs, rst
+DIM SHARED pi
+DIM SHARED rkb, rke, rkm
+DIM SHARED rx, ry, rz, rxp, ryp, rzp
+
+DIM SHARED tmr$, ts
+DIM SHARED ale
+
+start
+my1 = -pi / 2
+
+' Initialize the rocket position and velocity
+rx = 0
+ry = mk / 2 + .009
+rz = 0
+
+myx = 0
+myy = mk / 2
+myz = -.05
+
+ts = 0
+frm2 = 999999
+tmr$ = TIME$
+1
+frm = frm + 1
+frm2 = frm2 + 1
+
+' Display the current values of some variables
+LOCATE 1, 1
+PRINT mitp, mitl, mk, mks
+LOCATE 2, 1
+PRINT rkb, rke, TIMER
+
+' Update rocket position and velocity
+rx = rx + (rxp * ts)
+ry = ry + (ryp * ts)
+rz = rz + (rzp * ts)
+
+' Update the rocket's pitch and roll rates
+ryp = ryp + (.0098 * ts)
+rxp = SIN(frm / 20) / 50
+
+' Update the points that make up the rocket
+FOR a = 1 TO rkm
+ px(a + rkb - 1) = rkx(a) + rx
+ py(a + rkb - 1) = rky(a) + ry
+ pz(a + rkb - 1) = rkz(a) + rz
+NEXT a
+
+' Update the observer position and velocity
+myx = myx + (myxp * ts)
+myy = myy + (myyp * ts)
+myz = myz + (myzp * ts)
+
+' Draw the 3D scene
+n3d
+
+' Handle user input
+a$ = INKEY$
+IF a$ <> "" THEN
+ IF a$ = CHR$(0) + "H" THEN
+ ' Move forward
+ myzp = myzp - SIN(my1) / 100
+ myxp = myxp + COS(my1) / 100
+ END IF
+ IF a$ = CHR$(0) + "P" THEN
+ ' Move backward
+ myzp = myzp + SIN(my1) / 100
+ myxp = myxp - COS(my1) / 100
+ END IF
+ IF a$ = CHR$(0) + "M" THEN
+ ' Move right
+ myzp = myzp + COS(my1) / 100
+ myxp = myxp + SIN(my1) / 100
+ END IF
+ IF a$ = CHR$(0) + "K" THEN
+ ' Move left
+ myzp = myzp - COS(my1) / 100
+ myxp = myxp - SIN(my1) / 100
+ END IF
+
+ ' Change the viewing angle
+ IF a$ = CHR$(27) THEN SYSTEM
+ IF a$ = "4" THEN my1 = my1 + .1
+ IF a$ = "6" THEN my1 = my1 - .1
+ IF a$ = "2" THEN my2 = my2 + .1
+ IF a$ = "8" THEN my2 = my2 - .1
+ IF a$ = "-" THEN myyp = myyp + .01
+ IF a$ = "+" THEN myyp = myyp - .01
+ IF a$ = " " THEN myzp = myzp / 2: myxp = myxp / 2
+END IF
+
+' Calculate the speed and distance of the rocket
+v = SQR(rx * rx + ry * ry + rz * rz)
+s = SQR(rxp * rxp + ryp * ryp + rzp * rzp)
+
+' Display the current frame rate and other information
+IF tmr$ <> TIME$ THEN
+ tmr$ = TIME$
+
+ LOCATE 29, 1
+ PRINT "speed"; INT(s * 1000)
+ LOCATE 30, 1
+ PRINT "fps"; frm3; "timeslice"; INT(ts * 1000); "distance"; v;
+
+ ' Update the frame rate and time slice
+ frm3 = frm2
+ ts = 1 / frm3
+ frm2 = 0
+
+ ' Add new points to the scene
+ addp
+ addl
+END IF
+GOTO 1
+
+SUB addl
+mitp = mitp + 1
+px(mitp) = rx
+py(mitp) = ry
+pz(mitp) = rz
+
+IF ale > 0 THEN
+ mitl = mitl + 1
+ l1(mitl) = ale
+ l2(mitl) = mitp
+ lc(mitl) = 13
+END IF
+
+ale = mitp
+END SUB
+
+SUB addp
+' Add new points to the scene
+mitp = mitp + 1
+px(mitp) = rx
+py(mitp) = ry
+pz(mitp) = rz
+
+mitp = mitp + 1
+px(mitp) = rx - .001
+py(mitp) = ry - .001
+pz(mitp) = rz
+
+mitp = mitp + 1
+px(mitp) = rx + .001
+py(mitp) = ry - .001
+pz(mitp) = rz
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 1
+lc(mitl) = 14
+
+mitl = mitl + 1
+l1(mitl) = mitp - 2
+l2(mitl) = mitp - 1
+lc(mitl) = 14
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 2
+lc(mitl) = 14
+
+END SUB
+
+SUB n3d
+' Convert the 3D points to 2D for drawing
+s1 = SIN(my1)
+c1 = COS(my1)
+
+s2 = SIN(my2)
+c2 = COS(my2)
+
+FOR a = 1 TO mitp
+ x = px(a) - myx
+ y = py(a) - myy
+ z = pz(a) - myz
+
+ ' Apply the rotation transformations
+ x1 = x * s1 + z * c1
+ z1 = x * c1 - z * s1
+
+ y1 = z1 * s2 + y * c2
+ z2 = z1 * c2 - y * s2
+
+ ' Project the 3D point to 2D
+ IF z2 < .00001 THEN
+ rpx(a) = -1
+ ELSE
+ rpx(a) = x1 / z2 * 200 + 320
+ rpy(a) = 240 - y1 / z2 * 200
+
+ ' Check if the point is within the screen boundaries
+ IF rpx(a) < -50 OR rpx(a) > 1000 OR rpy(a) > 1000 THEN
+ rpx(a) = -1
+ END IF
+ END IF
+NEXT a
+
+' Draw the lines that make up the rocket
+FOR a = 1 TO mitl
+ p1 = l1(a)
+ p2 = l2(a)
+ x1 = rpx(p1)
+ y1 = rpy(p1)
+ x2 = rpx(p2)
+ y2 = rpy(p2)
+
+ ' Check if the line is within the screen boundaries.
+ ' If so, erase line at old locations
+ IF ox1(a) = -1 OR ox2(a) = -1 THEN
+ ELSE
+ LINE (ox1(a), oy1(a))-(ox2(a), oy2(a)), 0
+ END IF
+
+ ' Draw the line if both endpoints are within the screen boundaries
+ IF x1 <> -1 AND x2 <> -1 THEN
+ LINE (x1, y1)-(x2, y2), lc(a)
+ END IF
+
+ ' Update the old endpoints of the line for the next frame
+ ox1(a) = x1
+ oy1(a) = y1
+ ox2(a) = x2
+ oy2(a) = y2
+NEXT a
+
+END SUB
+
+SUB start
+' Initialize the graphics mode and set up the scene
+SCREEN 12
+VIEW PRINT 1 TO 30
+
+mk = 12714
+mks = 500
+rst = 4
+pi = 3.142657
+rs = .00002
+frm2 = 0
+
+ale = -1
+px(1) = -.001
+py(1) = mk / 2
+pz(1) = -.001
+
+px(2) = .001
+py(2) = mk / 2
+pz(2) = -.001
+
+px(3) = .001
+py(3) = mk / 2
+pz(3) = .001
+
+px(4) = -.001
+py(4) = mk / 2
+pz(4) = .001
+
+mitp = 4
+
+' Set up the initial lines that make up the rocket
+l1(1) = 1
+l2(1) = 2
+lc(1) = 14
+
+l1(2) = 2
+l2(2) = 3
+lc(2) = 14
+
+l1(3) = 3
+l2(3) = 4
+lc(3) = 14
+
+l1(4) = 4
+l2(4) = 1
+lc(4) = 14
+
+mitl = 4
+
+' Initialize the observer position and velocity
+myx = 0
+myy = mk * 2
+myz = -35
+
+teemaa
+myxp = 0
+myyp = 0
+myzp = 0
+
+my1 = 0
+
+rkb = mitp + 1
+teerock
+rke = mitp
+
+' Calculate the number of points that make up the rocket
+rkm = rke - rkb + 1
+
+' Copy the initial points to the arrays for the rocket
+FOR a = 1 TO rkm
+ p = rkb + a - 1
+ rkx(a) = px(p)
+ rky(a) = py(p)
+ rkz(a) = pz(p)
+NEXT a
+
+END SUB
+
+SUB teemaa
+' Generate the points that make up the earth
+tmpp = mitp
+le2 = 0
+
+FOR z = -(mk / 3) TO (mk / 3) STEP mks
+ le = 0
+ le2 = le2 + 1
+
+ FOR x = -(mk / 3) TO (mk / 3) STEP mks
+ ' Check if the point is within the rocket's radius
+ IF SQR(x * x + z * z) > (mk / 2.5) THEN GOTO 4
+
+ le = le + 1
+
+ ' Add the first point of the line
+ IF le = 1 THEN
+ xs = x / mks
+ END IF
+
+ mitp = mitp + 1
+ px(mitp) = x
+ v = SQR(x * x + z * z)
+ py(mitp) = SQR((v + (mk / 2)) * ((mk / 2) - v))
+ pz(mitp) = z
+
+ ' Add the line to the list of lines
+ IF le > 1 THEN
+ mitl = mitl + 1
+ l1(mitl) = mitp
+ l2(mitl) = mitp - 1
+ lc(mitl) = 3
+ END IF
+
+ ' Add the line to the list of lines if it is part of a circle
+ IF le2 > 1 THEN
+ IF xso > (x / mks) THEN GOTO 4
+ IF xso + leo <= (x / mks) THEN GOTO 4
+
+ mitl = mitl + 1
+ l1(mitl) = mitp
+ l2(mitl) = mitp - leo - xso + xs
+ lc(mitl) = 3
+ END IF
+
+ 4
+ NEXT x
+
+ ' Update the variables for the next circle
+ leo = le
+ xso = xs
+NEXT z
+
+END SUB
+
+SUB teerock
+' Generate the points that make up the rocket
+s = 50
+
+FOR y = -9 TO 10 STEP rst
+ st = pi * 2 / 6
+
+ IF y > 5 THEN
+ s = s - 3
+ END IF
+
+ IF y > 8 THEN
+ s = s - 6
+ END IF
+
+ FOR a = 0 TO pi * 2 STEP st
+ x1 = SIN(a) * s
+ z1 = COS(a) * s
+
+ mitp = mitp + 1
+ px(mitp) = x1 * rs
+ py(mitp) = y * 50 * rs
+ pz(mitp) = z1 * rs
+
+ ' Add the line to the list of lines
+ IF a > 0 THEN
+ mitl = mitl + 1
+ l1(mitl) = mitp
+ l2(mitl) = mitp - 1
+ lc(mitl) = 10
+ END IF
+
+ ' Add the line to the list of lines if it is part of a circle
+ IF y > -9 THEN
+ mitl = mitl + 1
+ l1(mitl) = mitp
+ l2(mitl) = mitp - 7
+ lc(mitl) = 10
+ END IF
+
+ NEXT a
+NEXT y
+
+' Add the points that make up the top of the rocket
+mitp = mitp + 1
+px(mitp) = 0
+py(mitp) = 11 * 50 * rs
+pz(mitp) = 0
+
+FOR a = 1 TO 6
+ mitl = mitl + 1
+ l1(mitl) = mitp
+ l2(mitl) = mitp - a
+ lc(mitl) = 10
+NEXT a
+
+' Add the points that make up the bottom of the rocket
+mitp = mitp + 1
+px(mitp) = -100 * rs
+py(mitp) = -450 * rs
+pz(mitp) = 0
+
+mitp = mitp + 1
+px(mitp) = 100 * rs
+py(mitp) = -450 * rs
+pz(mitp) = 0
+
+mitp = mitp + 1
+px(mitp) = 0
+py(mitp) = -200 * rs
+pz(mitp) = 0
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 1
+lc(mitl) = 12
+
+mitl = mitl + 1
+l1(mitl) = mitp - 2
+l2(mitl) = mitp - 1
+lc(mitl) = 12
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 2
+lc(mitl) = 12
+
+
+
+mitp = mitp + 1
+px(mitp) = 0
+py(mitp) = -450 * rs
+pz(mitp) = -100 * rs
+
+mitp = mitp + 1
+px(mitp) = 0
+py(mitp) = -450 * rs
+pz(mitp) = 100 * rs
+
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 1
+lc(mitl) = 12
+
+mitl = mitl + 1
+l1(mitl) = mitp - 2
+l2(mitl) = mitp - 1
+lc(mitl) = 12
+
+mitl = mitl + 1
+l1(mitl) = mitp
+l2(mitl) = mitp - 2
+lc(mitl) = 12
+
+END SUB