Recently I have found an exercise for algorithmics students, in which I have to implement algorithm, which will calculate the ball route after hit and return specific destination pocket or word "None" if there isn't any. Physics occuring in the model is very simple, the angle of reflection is equal to the angle of incidence and there is no friction. Program should read following parameters (integers):
- $s_x, s_y$ - width and height of pool table
- $p_x, p_y$ - start position of ball
- $w_x, w_y$ - vector coordinates
Pockets are single points (as well as the ball) and their positions are:
- GP - (0, height)
- GS - (width/2, height)
- GP - (width, height)
- DL - (0, 0)
- DS - (width/2, 0)
- DP - (width, 0)
Is there any way to calculate function of the ball route and check which of the pockets is contained by this function?
Sample pool billard picture described by parameters $s_x=10, s_y=5, p_x= 7, p_y=4, w_x=1, w_y=2$:
