# True anomaly of binary orbit

I have a real doosy that has got me stumped.
I need to solve the following equation for v:
tan(v + ω) = tan(θ + Ω)sec(i)

The symbols stand for the following values in an elliptical orbit of one point source around another (on the celestial sphere):
where v = true anomaly; ω = argument of periastron; θ = position angle; Ω = position angle of the ascending node; i = orbital inclination (to line of sight)

The following obvious solutions don't actually work (at least not for every case):
v = atan(tan(θ + Ω)sec(i)) - ω
v = atan2(sin(θ + Ω)sec(i), cos(θ + Ω)) - ω

I think the reason the first one doesn't work is to do with quadrant issues when taking the arctangent.
I think the reason the second one doesn't work has something to do with the direction of orbital motion. I've tried:
v = atan2(± sin(θ + Ω)sec(i), cos(θ + Ω)) - ω, but that doesn't work either in every case.

There is a convoluted solution on page 643 of:
http://ajbasweb.com/old/ajbas/2014/November/640-648.pdf
but try as I might I cannot make this work (in Octave/Matlab) and it does seem unnecessarily complicated.

Either way I've been working on this for weeks and just can't get it. Any help would be hugely appreciated.

Rod

tony873004