inside out torus
run it in QBJS
run it in QBJS
Code: (Select All)
r = 50
rr = 100
pi = 3.141593
SCREEN _NEWIMAGE(640, 480, 32), , 1, 0
dim t
'SCREEN , , 0, 0
DO
cls
'PCOPY 1, 0
t = t + .1
FOR u = 0 TO 7 STEP .05
FOR v = 0 TO 7 STEP .1
h = 100 * SIN(t)
x = (100 + 50 * COS(u)) * COS(v) + h
rr = 100 * COS(t)
cc = (pi / 2) * SIN(t)
ss = SIN(v) * COS(t) + SIN(t)
y = (rr + r * COS(u + cc)) * ss
rr = 100 * SIN(t)
cc = (pi / 2) * COS(t)
ss = SIN(v) * SIN(t) + COS(t)
z = (rr + r * COS(u + cc)) * ss
PSET (x + 0.707 * z + 320, y + 0.707 * z + 240), _RGB(255, 0, z * 10)
NEXT
NEXT
'SLEEP
_LIMIT 10
_DISPLAY
LOOP