<font color=#008000>
>作者: 吳姿瑩
>更新:2022.12.09
</font>[color=#008000]
# Lesson12: 拋體運動(水平拋射)
###### tags: `運動科學模擬` `多元選修` `vpython` `拋體運動` `水平拋射`
## :memo:什麼是水平拋射運動horizontal projectile motion?
<iframe width="560" height="315" src="https://www.youtube.com/embed/pZZt357pk-I" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
當物體做二維運動時,鉛直方向僅受重力影響,作等加速度運動,水平方向無受作用力影響,合力為零作等速度運動,兩方向運動互有獨立性,並不互相影響兩垂直方向運動,此運動即為拋體運動,又當初速度僅有水平方向初速度,則為水平拋射運動。
- 考慮真實狀況拋體運動--馬格納斯效應(Magnus Effect)轉動的流體拋體運動
<iframe width="560" height="315" src="https://www.youtube.com/embed/2OSrvzNW9FE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
- Is This The World’s Most Difficult Basketball Shot?
<iframe width="560" height="315" src="https://www.youtube.com/embed/18X1hhgXeCc?start=1080" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
## :memo:水平拋射物理觀念
- 水平拋射運動,鉛直方向運動,僅受萬有引力的影響,為等加速度運動,水平方向運動,合力為零,為等速度運動。其運動如下:
(1)$x, y$方向受力
$\vec{F_x} = 0$
$\vec{F_y} = m\vec{g}$
(2). $t秒時的x, y位置$
$\Delta{x}=v_x \times \Delta{t}$
$\Delta{y}=\frac{1}{2}at^2$
(3). $t秒時的x, y速度$
$\Delta{v_x}=v_0$
$\Delta{v_y}=a\times\Delta{t}$
可知$x$方向速度不變,$y$方向速度愈來愈大,
其中在地表重力加速度$a=g=9.8 m/s^2$
(4).Normal acceleration法線加速度$a_N$ 和 Tangential acceleration切線加速度$a_t$
$a_N$:和速度垂直方向,使運動方向發生改變,如同:汽車方向盤
$a_t$:和速度平行方向,使運動快慢發生改變,如同:汽車油門、煞車
<a href="https://imgur.com/ezD4Oo9"><img src="https://i.imgur.com/ezD4Oo9.jpg" title="source: imgur.com" /></a>
由圖可知法線加速度、切線加速度的大小為
$a_N = g\times sin\theta$
$a_t = g\times cos\theta$
$g = \sqrt{a_N^2+a_t^2}$
可知隨著水平運動方向,速度與重力加速度$g$的夾角$\theta$愈來愈小,法線加速度$a_N$愈來愈小,切線加速度$a_t$愈來愈大。
## :memo:設置一個物體sphere水平拋射
### 1.參數設定
|**意涵** |**設定**|
|-----|--------|
|圓球質量 1kg|m = 1 |
|圓球半徑 1m |R = 1 |
|圓球初始高度 20 m|H = 20|
|圓球x方向初速度|vx = 5|
|圓球y方向初速度|vy = 0|
|圓球加速度 $m/s^2$|g = 9.8|
|初始時間|t = 0|
|時間間隔|dt = 0.01|
|地板厚度 0.01 m| thin = 0.01|
### 2.畫面設定
- 前一堂課有關畫布canvas的設定,請設定title="2D Motion", caption='自由落下'的畫布
- 利用box設定一個地板
- 設定兩球sphere,位置皆從==從地板高度H==自由落下(==注意球的半徑、地板厚度==),==初速度為$\vec{v}=(v_x, v_y, 0)$==,初加速度為$\vec{a}=(0, -g, 0)$
```javascript=1
ball = sphere(pos=vec(0, H+R+thin, 0), radius=R, color=color.red,
v=vec(vx, vy, 0), a=vec(0, -g, 0), make_trail=True)
```
- 需畫出三個圖(1)y-t圖(包含x, y兩方向) (2)v-t圖(包含x, y兩方向) (3)a-t圖(包含x, y兩方向)
(==注意畫布的大小以及y位置==),圖的名稱可定義為gd、gd_vec、gd_a
```javascript=1
yt = gcurve(graph=gd, color=color.red, label = "y position")
xt = gcurve(graph=gd, color=color.blue, label = "x position")
vyt = gcurve(graph=gd_vec, color=color.red, label = "y velocity")
vxt = gcurve(graph=gd_vec, color=color.blue, label = "x velocity")
an_t = gcurve(graph=gd_a, color=color.red, label = "法線加速度")
at_t = gcurve(graph=gd_a, color=color.blue, label = "切線加速度")
a_t = gcurve(graph=gd_a, color=color.green, label = "加速度")
```
### 3.物體的運動
- 設置當球的位置在地板之上方,會執行程式,撞擊至地面時(考慮地面厚度、球的半徑),則停止迴圈
```javascript=1
while(ball.pos.y >= R + thin*0.5 ):
...(略)
```
- x方向等速度運動
```javascript=1
# x-direction information
ball.pos.x = vx*t
```
- y方向等速度運動
```javascript=1
# y-direction information
ball.v.y = vy + ball.a.y*t
ball.pos.y = (H + R + thin) + (vy*t + 0.5*ball.a.y*t**2)
```
- 加速度a的資訊
```javascript=1!
# accelation information
at = ball.a.dot(ball.v) / sqrt(ball.v.dot(ball.v))
an = sqrt(g**2-at**2)
a_tot = sqrt(at**2 + an**2)
```
:::spoiler **水平拋射 完整程式碼**
```javascript=1!
"""
Auther :吳姿瑩
Date :2022/08/18
version :python3.10.6 vpython7
chapter :水平拋射
"""
from vpython import *
"""
1. 參數設定, 設定變數及初始值
"""
size = 40 # 地板長度
m = 1 # 圓球質量 1kg
R = 1 # 圓球半徑
H = 20 # 圓球初始高度 20 m
vx = 5 # 圓球x方向初速度(水平拋射)
vy = 0 # 圓球y方向初速度(靜止落下)
g = 9.8 # 圓球加速度
t = 0 # 時間
dt = 0.01 # 時間間隔
thin = 0.01 # 地板厚度
"""
2. 畫面設定
"""
#畫面設定,預設為 640 and 400 像素
scene = canvas(title="2D Motion", caption='水平拋射', width=640, height=400, x=0, y=0, center=vec(0, 0.3, 0), background=vec(204/255,204/255,255/255))
floor = box(pos=vec(0, 0, 0), size=vec(2*size, thin, 10), color=color.green)
ball = sphere(pos=vec(0, H+R+thin, 0), radius=R, color=color.red, v=vec(vx, vy, 0), a=vec(0, -g, 0), make_trail=True)
#畫y-t圖v-t圖設定畫布
gd = graph(title="y-t plot", width=600, height=450, x=0, y=640, xtitle="t(s)", ytitle="position(m)")
gd_vec = graph(title="<b>v<sub>y</sub>-t plot<b>", width=600, height=450, x=0, y=1050, xtitle="t(s)", ytitle="v<sub>y</sub>(m/s)")
gd_a = graph(title="<b>a<sub>y</sub>-t plot<b>", width=600, height=450, x=0, y=1500, xtitle="t(s)", ytitle="a<sub>y</sub>(m/s)")
yt = gcurve(graph=gd, color=color.red, label = "y position")
xt = gcurve(graph=gd, color=color.blue, label = "x position")
vyt = gcurve(graph=gd_vec, color=color.red, label = "y velocity")
vxt = gcurve(graph=gd_vec, color=color.blue, label = "x velocity")
an_t = gcurve(graph=gd_a, color=color.red, label = "法線加速度")
at_t = gcurve(graph=gd_a, color=color.blue, label = "切線加速度")
a_t = gcurve(graph=gd_a, color=color.green, label = "加速度")
"""
3. 物體運動部分, 圓球到達地板邊緣時停止執行
"""
#等待click才會開始執行
T = text(text='Please click to run! ',pos=vec(-30, -10, 0), align='left', height = 3, color=color.black)
scene.waitfor('click')
while(ball.pos.y >= R + thin*0.5 ):
rate(100)
# x-direction information
ball.pos.x = vx*t
# y-direction information
ball.v.y = vy + ball.a.y*t
ball.pos.y = (H + R + thin) + (vy*t + 0.5*ball.a.y*t**2)
# accelation information
at = ball.a.dot(ball.v) / sqrt(ball.v.dot(ball.v))
an = sqrt(g**2-at**2)
a_tot = sqrt(at**2 + an**2)
yt.plot(pos = (t, ball.pos.y))
xt.plot(pos = (t, ball.pos.x))
vyt.plot(pos = (t, ball.v.y))
vxt.plot(pos = (t, ball.v.x))
an_t.plot(pos = (t, an))
at_t.plot(pos = (t, at))
a_t.plot(pos = (t, a_tot))
t += dt
```
:::spoiler **學生作業(上課活動)**
1. 試求落地時間t為何?
2. 試求水平拋射的水平位移為何?
3. 試問法線加速度大小變化?
4. 試問切線加速度大小變化?
:::
:::spoiler 學生作業
1. 1. Homework:設置==三顆不同顏色的球,分別高度為5m, 20m, 80m==,並畫出 ==$v_x$和$v_y$速度箭頭視覺化==
Requirements要求:
(1)需畫出球體移動
(2)需畫出三個球體搭配球體顏色(1)y-t圖(包含x, y方向) (2)v~y~-t圖(包含x, y方向)
(3)需畫出各自球的速度視覺化箭頭
2. 請將==程式code以及瀏覽器結果截圖== 至google classroom繳交作業。
3. 完成今日協作平台更新
4. 將code上傳至雲端硬碟中(Lesson12 vpython水平拋射)
:::
## :memo:參考網址
1. vpython arrow箭頭語法:https://www.glowscript.org/docs/VPythonDocs/arrow.html