Im not good at math, I could find everything so far, but not this one.
And I just cant figure it out. I think Im just not seeing it.
Im calculating directions, two circles collide, one has an incoming direction,
and needs to get an outgoing direction.
So far I know how to get the collision point and I can calculate the incoming/outgoing angle alfa. (Calculating the angle between two lines without having to calculate the slope? (Java))
Im stuck on constructing the outgoing line and retrieving the m or a ( y = ax + b ).

So, from the picture, I know y, i, alfa and the point where all lines intersect (not marked, sorry).
Could anyone help me out? Im programming in Java.
If momentum is conserved during a collision with a horizontal boundary, the collision will just flip the sign of m. That is the m value afterward is -1 times the m value before.
Suppose the equation of the original line is y=mx+c and the equation of the line after the collision is y=-mx+b. At the intersection point, the x and y values are the same.
To avoid confusion later, we’ll call the x and y-values of the collision point (X,Y) not (x,y)
At the intersection the line equations for both lines hold (for x=X, y=Y). So,
So the intercept of the second line (which you referred to as “m or a” in your question) is 2mX+c, where X is the x-position at which the collision occurs. Hence the equation of the second line is: