:::

7-1 vpython

vpython

  • 安裝
sudo install python3-pip
pip3 install vpython

 

  • 程式
from vpython import *

scene = canvas(title = "1D Motion", width = 800, height = 600, x = 0, y = 0, center = vector(0, 0.1, 0), \
        background = vector(0, 0.6, 0.6))
size = 0.1   # 木塊邊長
L = 1        # 地板長度
v = 0.03     # 木塊速度
t = 0        # 時間
dt = 0.01    # 時間間隔
floor = box(pos = vector(0, 0, 0), length = L, height = size*0.1, width = L*0.5, color = color.blue)

 

 


Google網站翻譯工具列

站內搜尋