[Math] Determine angle of incidence/reflection off of slanted line

circlescollision detectiongeometry

I'm working on an air hockey game (for learning purposes) and I'm currently struggling with some geometry. I'm trying to determine the new slope of the velocity of the puck when it collides with one of the paddles, and, with the help of another stackexchange question, have determined the point of contact, as well as found a line to be used as the contact surface. The problem now, however, is finding the angle itself. All the examples I've found (admittedly I haven't looked incredibly hard) assume you already know the angle of incidence, which I don't. So, how do I find that angle?

diagram

(assuming $vX$ is the velocity of the puck on the $x$ plane, $vY$ is the velocity on the $y$ plane, point of contact is point $c$, and the slope of the contact surface is $cY/cX$)

Best Answer

The angle of incidence is the angle between the velocity and the tangent line you have drawn. You can get the angle of the velocity from Atan2(vX,vY), which will be measured with $0$ along the positive $x$ axis and increasing counterclockwise. Atan2(cX,cY) will give you the angle of the tangent. Now subtract them and worry about which sign and crossing $2 \pi$ and you are home.