A solution of
A cos θ + B sin θ = C
is
θ = asin(C/sqrt(A2+B2))-atan2(x=B,y=A).  #maths