# 建中110 數理資優班入學自然能力測驗

本題110學年度建中數理資優班入學試題的第7題
[考古題下載連結](https://drive.google.com/file/d/1ZqQ0kGCWHeNhqjfYuYxCMbdyG_MIdnwl/view?usp=sharing)
[Vpython安裝請參閱這篇](https://hackmd.io/V-yIwkqRREOC6k1HRVbcHg?view)
```python=
from visual import * #載入Vpython繪圖模組
import math
########模擬環境物理描述設定###############
g=9.8 #重力加速度(單位:公尺/秒^2)
size = 0.5 #球半徑(單位:公尺)
h = 15 #掉落高度(單位:公尺)
dt = 0.001 #電腦動畫繪圖時距(單位:秒)
jt=1.000 #拋射時機
jv=8 #拋射速度
t=0
flag=0
angle = 60 #鞋面角度
########物件的物理描述設定###############
#設定背景畫面
scene = display(width=800, #設定畫面寬(單位:像素)
height=800, #設定畫面高(單位:像素)
center = vector(15,h/2,0), #設定位置座標(單位:公尺)
background=vector(0.5,0.7,0.5)) #設定顏色(紅,綠,藍)
#畫地板
floor = box(length=30, #設定地板長(左右)(單位:公尺)
height=0.5, #設定地板高(上下)(單位:公尺)
width=4, #設定地板深(前後)(單位:公尺)
material=materials.wood, #設定地板材質
pos=vector(15,-0.75,0)) #設定位置座標(單位:公尺)
#畫斜面
surface = box(length=30, #設定地板長(左右)(單位:公尺)
height=0.5, #設定地板高(上下)(單位:公尺)
width=4, #設定地板深(前後)(單位:公尺)
material=materials.wood, #設定地板材質
pos=vector(30*math.cos(angle*math.pi/180)/2, 30*math.sin(angle*math.pi/180)/2-0.75, 0),
axis=(30*math.cos(angle*math.pi/180), -30*math.sin(angle*math.pi/180) ,0) ) #設定位置座標(單位:公尺)
#畫球
ball=sphere(radius=size, #設定球體半徑(單位:公尺)
color=color.blue, #設定球體顏色
make_trail=True, #設定顯示軌跡
trail_type="points", #設定軌跡形式(另一選項"curve")
interval=250, #設定軌跡繪製時距(單位:每 250 frame繪一點)
retain=20) #設定軌跡數量
#畫球2
ball_2=sphere(radius=size, #設定球體半徑(單位:公尺)
color=color.red, #設定球體顏色
make_trail=True, #設定顯示軌跡
trail_type="points", #設定軌跡形式(另一選項"curve")
interval=250, #設定軌跡繪製時距(單位:每 250 frame繪一點)
retain=20) #設定軌跡數量
ball.pos = vector( 0, 30*math.sin(angle*math.pi/180), 0.0) #設定位置座標(左,上下,前後)(單位:公尺)
ball.v = vector(0.0, 0.0 , 0.0) #設定速度向量(左,上下,前後)(單位:公尺)
ball_2.pos = vector( 0, 30*math.sin(angle*math.pi/180), 0.0) #設定位置座標(左,上下,前後)(單位:公尺)
ball_2.v = vector(0.0, 0.0 , 0.0) #設定速度向量(左,上下,前後)(單位:公尺)
########繪圖動作###############
while ball.pos.y > 0 and ball_2.pos.y > 0:
rate(1000)
t += dt
ball.v.y += - g*math.sin(angle*math.pi/180)*math.sin(angle*math.pi/180)*dt
ball.v.x += g*math.sin(angle*math.pi/180)*math.cos(angle*math.pi/180)*dt
ball.pos += ball.v*dt
if t < jt:
ball_2.v.y += - g*math.sin(angle*math.pi/180)*math.sin(angle*math.pi/180)*dt
ball_2.v.x += g*math.sin(angle*math.pi/180)*math.cos(angle*math.pi/180)*dt
ball_2.pos += ball_2.v*dt
else:
if flag ==0:
ball_2.v.x += jv*math.sin(angle*math.pi/180)
ball_2.v.y += jv*math.cos(angle*math.pi/180)
ball_2.pos += ball_2.v*dt
flag =1
if flag==1:
ball_2.v.y += - g*dt
ball_2.pos += ball_2.v*dt
```
