簡體   English   中英

如何彈跳點以一定角度擊中線

[英]How to bounce a point to hit a line with a certain angle

我有一條直線和一個點,直線具有一個角度{ angle } point具有一個速度{ x, y } ,一點移動到直線上並命中它。 在這一點上,我想更改點的速度,就好像該點相對於線角度從線中反彈一樣。 如何根據線角計算點的新速度?

沒有“重力”? 完美的彈性?

a = angle
b = atan(y/x)  -- angle of 'velocity'
c = 2a-b       -- angle of new velocity
r = sqrt(x*x + y*y)  --  scaling of x,y
v = r * cos(c)
w = r * sin(c)
new velocity = {v, w}

(注意:我不知道相對於a是什么-垂直或水平,也不知道哪個方向。並且可能還有其他問題。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM