Reflection or vector rotation how to?

Hi all, im new to c++.
My task is to make function that will rotate radius vector of incident photon when he interact with surface. Its total reflection problem, no transmision (so no refraction, just reflection).
Inputs are components “Ex” and “Ey” or radius vector “r”. And outputs are new radius vector "r’ " with new components "Ex’ " and "Ey’ ". Acctually its problem of rotating vector “r” around vector “n”. Vector “n” is surface normal vector, since its surface along X axis (its horisontal) its components are (0,1).
I drow little picture of this problem. So inputs are components Ex and Ey of radius vector of photons, next surface normal vector n(0,1), and result should be components Ex’ and Ey’ of radius vector after reflection. in this case components along X axis will remain same, but Ey components will change.

And I have to do this for one more surface that is verical, with components n2(1,0)
Best regards, Nikola

many sites suggest solutions for this issue which is not really ROOT specific. See for example … tions.html

can you help me for inputs for function reflection?
inputs are components ex and ey or radius vector of moving particle (photon in this case), ex is one input parameter, ey is second input parameter, and third input is surface normal vector:
float reflection( const float ex , const float ey , const float TVector2 n(0,1) )

but i cant use for input TVector2 n(0,1)…
what shall I put instead?

Also problem is that im working with TVector2, Root doesn’t have defined Dot for TVector2, later i’ll work with TVector3, now im just making necessary function for reflection.

Use a TVector3 and set Ez = z = 0.

how I define TVector3 n(x,y,z) as input for function?