Vpython

✻此單元詳細物件參數,可參考網址:(https://www.glowscript.org/docs/VPythonDocs/index.html)

✻使用 GlowScript進行繪圖時,請記得先於第一行打上: GlowScript 3.0 VPython

建立物件練習


1. 球體(sphere)
● 建立物件:
ball=sphere(pos=vector(1,2,1),radius=0.3,color=color.red)

2. 立方體(box)
● 建立物件:
cuboid=box(pos=vector(-2,0,0),length=0.3,width=0.2,height=1 ,color=color.white)

3. 箭頭(arrow)
● 建立物件:
pointer_a=arrow(pos=vector(0,2,1), axis=vector(5,0,0), shaftwidth=1)

4. 柱狀體(cylinder)
●建立物件:
rod = cylinder(pos=vector(0,2,1),axis=vector(5,0,0), radius=1)

5. 螺旋(helix)
●建立物件:
spring = helix(pos=vector(0,2,1), axis=vector(5,0,0), radius=0.5)

課堂任務1:畫出下方的圖

✻背景改為白色:加上此程式碼 scene.background=vec(1,1,1) homework1