MA\GWMA.BAS ·
BAS ·
1.3 KB ·
1991-04-01 ·
from WhatPC_Issue-21_Apr-1991
100 '
110 ' GWMA, a simple GW-BASIC illustration of the formula behind MA
120 '
130 KEY OFF:SCREEN 2:CLS
140 '
150 ' Give the variables some values...
160 '
170 A = -239 ' -1000 to + 1000
180 B = -.8 ' -2 to +2
190 C = 312.8 ' -1000 to +1000
200 D = 7.8 ' -12 to + 12
210 XSHRINK = 1: YSHRINK = .5 ' Scale parameters
220 XOFS = 400: YOFS = 300 ' Image centre point
230 '
240 ' Setup complete, now start the calculations
250 '
260 WHILE INKEY$ = ""
270 IF X < 0 THEN XS = -1 ELSE XS = 1 ' These are the
280 XP = Y - ( XS * ( ABS ( B * X - C ) ) ) ^1 / D ' important lines
290 YP = A - X ' to use.
300 PSET ( (XP+XOFS)*XSHRINK, (YP+YOFS)*YSHRINK )
310 X = XP ' Set new X
320 Y = YP ' and new Y.
330 WEND
340 '
350 CLS ' If a key is pressed,
360 SCREEN 0 ' reset screen.