SHARE
TWEET

Untitled

a guest Jul 17th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM *** Pythagoras tree ****
  2. SCREEN 12: REM screen 12 voor VGA
  3.   CLS : pi = 4 * ATN(1)
  4.   WINDOW (-2.5, 2)-(5.5, 5)
  5.   INPUT "tolerantie (kan .1 zijn) =", eps: CLS
  6.   p = 32: DIM xa(p), ya(p), xb(p), yb(p), s(p)
  7. REM *** initialiseren ****
  8.   h = pi / 3'prescribed angle
  9.   a1 = COS(h) * COS(h): b1 = SIN(h) * COS(h)
  10.   a2 = SIN(h) * SIN(h): b2 = -b1
  11.   xa = 0: ya = -1: xb = 0: yb = 0: g = 0: m = 0
  12.   LINE (0, 0)-(1, 0): LINE -(1, -1)
  13.   LINE -(0, -1): LINE -(0, 0)
  14. DO WHILE m >= 0
  15.   diff = ABS(xb - xa) + ABS(yb - ya)
  16.   IF g < p AND diff > eps THEN
  17.     m = m + 1: g = g + 1: s(m) = g
  18.     GOSUB graphics
  19.       xa = xan: ya = yan: xb = xbn: yb = ybn
  20.     ELSE
  21.       xa = xa(m): ya = ya(m): xb = xb(m): yb = yb(m)
  22.       g = s(m): m = m - 1
  23.     END IF
  24. LOOP: END
  25.  
  26. graphics:
  27.     u = xb - xa: v = yb -ya
  28.     xan = xb: yan = yb
  29.     xbn = xb + a1 * u - b1 * v: ybn = yb + b1 * u + a1 * v
  30.     un = xbn - xan: vn = ybn - yan
  31.     xcn = xbn + vn: ycn = ybn - un
  32.     xdn = xan + vn: ydn = yan - un
  33.       LINE (xan, yan)-(xbn, ybn): LINE -(xcn, ycn)
  34.       LINE -(xdn, ydn): LINE -(xan, yan)
  35.     xa(m) = xdn: ya(m) = ydn
  36.     xb(m) = xa(m) + a2 * u - b2 * v: yb(m) = ya(m) + b2 * u + a2 * v
  37.     ur = xb(m) - xa(m): vr = yb(m) - ya(m)
  38.     xcr = xb(m) + vr: ycr = yb(m) - ur
  39.     xdr = xa(m) + vr: ydr = ya(m) - ur
  40.        LINE (xa(m), ya(m))-(xb(m), yb(m)): LINE -(xcr, ycr)
  41.        LINE -(xdr, ydr): LINE -(xa(m), ya(m))
  42. RETURN
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top