Original Post
a ball hits a wall the reflecting vector is given by using this formula R = 2N(N dot I) - I
vec2D B ={-(ball.p1.x - ball.p0.x), -(ball.p1.y - ball.p0.y)};
// not sure why extra negatives are there
vec2D I = Normal(B);
R.x = 2 * wall.N.x * Dot(wall.N,I) - I.x;
R.y = 2 * wall.N.y * Dot(wall.N,I) - I.y;
this is what i think it is:
dot gives you the angle of ball hitting the wall.
N is where the ball will hit the wall
I is where position where the ball came from