漂亮的包络面

陈海涛老师
2022-02-08 / 0 评论 / 517 阅读 / 正在检测是否收录...

经典物理情景

  当一个小物体被抛出去之后,其轨迹会形成特殊的形状。抛体运动分为:平抛运动、斜抛运动、竖直抛体运动。平抛和斜抛运动的轨迹会形成包络线和包络面。

程序演示


动图演示

斜抛包络线

1

斜上抛包络面

2

平抛包络面

3

斜下抛包络面

4

程序源码

g = 9.8; size =0.3; height = 0; m = 1; theta= 3*pi/180; v0=10           
scene = canvas(width=300, height=300,x=0, y=0, center = vector(0,0,0),
                background=vector(0.5,0.6,0.5),range=12) 
floor = box(pos=vector(0,size,0),length=24, height=0.07,
                                     width=3, color=color.cyan)      
ball = sphere(pos=vector(0,size,0),radius = size, color=color.yellow,
                     make_trail= True,trail_type="points", interval=10)     
Fg = vector(0, -m*g, 0) 
ball.a=Fg/m
ball.v = vector(v0*cos(theta), v0*sin(theta), 0)

gd1 = graph(title = "R-theta", width=300, height=300, xtitle="theta", ytitle="R")
f1 = gcurve(color=color.red)
gd2 = graph(title = "T-theta", width=300, height=300, xtitle="theta", ytitle="T")
f2 = gcurve(color=color.blue)

t=0.0; dt=0.0001
while True:
    rate(100000)
    t += dt
    ball.v += ball.a*dt
    ball.pos += ball.v*dt
    if ball.pos.y <= size:
        f1.plot(pos=(theta*180/pi,ball.pos.x))
        f2.plot(pos=(theta*180/pi,t))
        t=0
        theta += 3 * pi/180     
        if theta>pi:
            break
        ball.pos = vector(0, size, 0)  
        ball.v = vector(v0*cos(theta), v0*sin(theta), 0)
2

评论 (0)

取消