I have a line and a point, line has an angle { angle }
point has a velocity { x, y }
, point moves to the line and hits it. At this point I want to change the velocity of the point, as if the point bounces from the line with regard to the line angle. How do I calculate the new velocity of the point based on line angle?
No 'gravity'? Perfect elasticity?
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}
(Caveat: I don't know what a
is relative to - vertical or horizontal, nor which direction. And there may be other issues.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.