from visual import * from visual.text import * #1 draw 3 axis. xaxis = arrow(pos=(0,0,0), axis=(1,0,0), shaftwidth=0.01, color=color.red) yaxis = arrow(pos=(0,0,0), axis=(0,1,0), shaftwidth=0.01, color=color.green) zyaxis = arrow(pos=(0,0,0), axis=(0,0,1), shaftwidth=0.01, color=color.blue) #1 Space Curve 繪製Helix 曲線 #a=3 #b=0.5 #step = 0.1 #t=arange(0,5*2*pi+step, step) #curve(x=a*cos(t), y=a*sin(t), z=b*t, color=color.red, radius=0.1) #2 Twisted Cubic #step = 0.1 #maxno = 1 #t=arange(-maxno, maxno+step ,step) #curve(x=t, y=t*t, z=t**3, color=color.white, radius=0.03) #curve(x=t, y=t*t, z=0, color=color.red, radius=0.01) #curve(x=t, y=0, z=t**3, color=color.green, radius=0.01) #curve(x=0, y=t*t, z=t**3, color=color.blue, radius=0.01) #3 #cylinder(axis = (0,0,2*b*pi), color=color.yellow, radius=a) #6 參數式,彩色繪製 #t = arange(0, 10, 0.1) #curve(x=sin(t),y=1.0/(1+t),z=t**0.5,red=cos(t),green=0,blue=0.5*(1-cos(t)) )