## Angles between 2 points along a varied path

I am writing a program that uses Snell's Law for refraction of light through two interfaces and I've encountered a problem representing the geometry symbolically. I could determine the values numerically but I don't want the overhead as it would have to be called up to 1E7 times.

The generalized diagram below shows the known values in green and the unknown in red. These are the equations that I am working with:
[*]B=tan(d)*D + tan(e)*E + tan(f)*F
and from Snell's Law the relationship between angles d, e, and f.
• sin(f)*nF = sin(e)*nE
• sin(e)*nE = sin(f)*nD
where all the refraction indices nx's are known
In an attempt to solve for one of the angles f in this case I get the following:
f=-atan(1/F*(E*tan(asin(nF*sin(f)/nE))-A+D*tan(asin(nF*sin(f)/nD))))
I cannot solve for f explicitly. Is there something that I am missing in my analysis of the problem? Any help would be appreciated.

Thanks
Rob

High-Res Version of above

 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target

 Tags geometry refraction