# how can i find the angle of a reflecting line?

i am trying to make the game pong ( my math is really bad and i am working on it) and trying to do the bouncing ball part.

I am trying to calculate the out going(reflecting) angel of the ball after hitting the walls or pedals (the walls are always horizontal and the pedals are always vertical)

Here is an image to demonstrate it better :

here is what i tried so far:

m = (y2-y1) / (x2-x1)

angle = atan(-m);

How ever this does not seem to work.

-

## 1 Answer

For a reflecting line, $$B = A$$ For the game of pong though, the position of the paddle changes the angle.

-
B = A ? what you mean ? –  Neta Meta Jan 31 '14 at 23:54
@NetaMeta - if it hits' at $30^\circ$, it will bounce back at $180\circ - 30^\circ$. In your diagram, this means $A=B$. –  nbubis Jan 31 '14 at 23:56
So basically i should do 180 minus 30 ? by peddle changes the angle you mean their movement ? or the fact that if you hit the pedal not in middle the angle changes ? –  Neta Meta Jan 31 '14 at 23:59
@NetaMeta - I think both. Note that this is not a math issue, but rather how the game designers decide to make the game more interesting. –  nbubis Feb 1 '14 at 0:04
well, for now I'll skip those features for now as i think those are a alot more advanced. –  Neta Meta Feb 1 '14 at 0:05