简体   繁体   English

如何弹跳点以一定角度击中线

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

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. 我有一条直线和一个点,直线具有一个角度{ angle } point具有一个速度{ x, y } ,一点移动到直线上并命中它。 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.) (注意:我不知道相对于a是什么-垂直或水平,也不知道哪个方向。并且可能还有其他问题。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何找到某一点的角度 - how to find the angle of the certain point 如何绘制从角度派生的点的线? - How do I draw a line to point derived from angle? 如何测试一条线是否与特定点相撞 - How to test is a line is colliding with a certain point 如何计算鼠标指针存在于某个点的角度? - How do I calculate the angle at which mouse pointer is present to a certain point? 所以我有一个三角形,点(100,90)距离(11)和线的角度(45°)我可以找到该线的另一个点吗? 怎么样? - So I have a triangle with the point (100, 90) the distance (11) and the angle of the line (45º) Can I find the other point of the line? How? 给定 3D 空间中的一条线,我如何找到从它到点的角度? - Given a line in 3D space, how do I find the angle from it to a point? 如何在Google地图上找到某个点和一条线之间的最近坐标? - How to find the nearest coordinate between a certain point and a line on Google Maps? Chart.js:如何将线下的区域填充到特定点? - Chart.js : How to fill the area under the line to a certain point? 如何计算射击子弹以击中移动目标的角度? - How to calculate the angle to shoot a bullet in order to hit a moving target? 如何为射弹获得一个角度,使其在分解重力的同时击中矢量2目标 - How to get an angle for a projectile such that it will hit a vector 2 target while factoring in gravity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM