So much faster than
matplotlib 3d projection
from visual import *
from random import uniform
display(center=(0,0,0), #pusat display
background=(1,1,1),
#autoscale=False, #agar display tidak otomatis mengikuti obyek
width=600,
height=600,
forward=(-0.4,-0.3,-1)) #arah kamera
x = 1.
y = 1.
z = 1.
dt = 1./64.
s = 10.
b = 8./3.
r = 28
w = 0.
dw = 0.01
n = 0
while 1:
rate(1)
while n<3000:
n += 1
xdot = s * (y-x)
ydot = x*r -x*z -y
zdot = x*y -b*z
x = x+xdot*dt
y = y+ydot*dt
z = z+zdot*dt
w +=dw
if w>1 or w<0:
dw = -dw
sphere(pos=(x,y,z),radius=.7,color=(0.,w,0))
No comments:
Post a Comment