Say we have a scenario, where a ball is moving towards a wall, if the ball hits a wall then it will reflect off of it. If the wall is parallel to an axis then this is fairly simple, we just invert the velocity of the ball in the axis perpendicular to the walls axis. For example, if the wall is on the x axis we would invert the velocity of the ball in the y axis. However, its not that simple should the wall not be parallel.
The formula to solve this is: Vi = Vo - 2n(Vo * n)
where Vi is the final velocity after the ball has been reflected, Vo is the initial velocity before the ball has been reflected and n is the normal of the wall that the ball will reflect on. All of which are vectors.
How this formula is derived
At the start of the problem we know two variables, the inital velocity and the normal of the wall, which is a unit vector. If we had a vector that started at the tail of the inital velocity and ended at the head of the final velocity, then we could use vector subtraction to figure out what the final velocity is. The parallel vector that shows the distance the ball will travel from its inital point to the wall is s and we can presume that it will travel the same after the bounce therefore our vector we need for the subtraction is 2s. This means we need to find s.
So currently Vi = 2s - Vo
To find s we would need to extend n so that it would reach the head of the s vector. This can be achieved by using vector projection and inverting the inital velocity to find the distance. Doing so gives us -Vo * n. As n is a unit vector we can multiply n by the scalar distance we just found. This gives us extended n = n * (-Vo * n). Then by using vector addition we can find s, so s = Vo + n * (-Vo * n).
Now that we have the value of s we can subsitute that value into our original equation and then simplfy.
Vi = 2(Vo + n * (-Vo * n)) - Vo
Vi = 2Vo + 2n * (-Vo * n) - V0
Vi = Vo + 2n * (-Vo * n)
Vi = Vo - 2n * (Vo * n)
Below are diagrams to help explain the process.
No comments:
Post a Comment