Worf
Well-known Member
- Joined
- Oct 30, 2011
- Messages
- 4,252
Worf submitted a new Excel article:
A ricocheting ball with VBA - This article calculates the path of a ricocheting object inside a closed 2D area.
Read more about this Excel article...
A ricocheting ball with VBA - This article calculates the path of a ricocheting object inside a closed 2D area.
Using trigonometry, it is possible to calculate the path an object will follow when hitting the inside walls of a closed rectangular area. Here are the relevant points of the code:
- The input variables are the starting position and angle, between 1 and 89 degrees. The values are hardcoded but this is easily modifiable.
- Basically, the code finds the point where two lines intersect, the object path and one of the four reference lines that form the rectangle.
- A chart is...
Read more about this Excel article...