1

I have this equation :

$$\theta = \arctan\left(\tfrac xd\right) + \arctan\left(\tfrac yd\right).$$

$\theta$ is an angle and I am trying to express $d$ as a function of $\theta$.

So is there a way to extract $d$ from the equation in the two $\arctan$s above ?

This is a pure math question this is why I don't post an image of the geometry.

Thank you.

  • $u=Teta, d = (-\sqrt{4 x y (i sin(2 u)+cos(2 u)-1)^2-(-i x sin(2 u)+x (-cos(2 u))-i y sin(2 u)-y cos(2 u)-x-y)^2}-x sin(2 u)+i x cos(2 u)-y sin(2 u)+i y cos(2 u)+i x+i y)/(2 (i sin(2 u)+cos(2 u)-1))$ or $d = (\sqrt{4 x y (i sin(2 u)+cos(2 u)-1)^2-(-i x sin(2 u)+x (-cos(2 u))-i y sin(2 u)-y cos(2 u)-x-y)^2}-x sin(2 u)+i x cos(2 u)-y sin(2 u)+i y cos(2 u)+i x+i y)/(2 (i sin(2 u)+cos(2 u)-1))$ I don't think it's gonna be easy. – UserX Sep 19 '14 at 19:04

1 Answers1

5

Note that $$ \theta = \arctan(x/d) + \arctan(y/d) \\ \tan(\theta) = \tan(\arctan(x/d) + \arctan(y/d)) \\ \tan \theta = \frac{x/d + y/d}{1 - (\frac{xy}{d^2})}\\ \tan \theta = d\frac{x+y}{d^2-xy}\\ \tan \theta(d^2 - xy) = d(x+y)\\ (\tan \theta)d^2 - (x+y)d -xy\tan \theta = 0 $$ From there, apply the quadratic formula: $$ d = \frac{x+y\pm \sqrt{(x+y)^2 + 4xy\tan^2 \theta}}{2\tan \theta} $$

Ben Grossmann
  • 225,327
  • 1
    Simple and beautiful, thanks :) I needed this for a camera model with a point of view and a projection screen (obviously). Teta is a the field of view, so it's the angle that "grasps" both edges of the projection screen (seen from above on a 2D X-Z graph). This said, both solutions to the equations should mirror themselves relative to the projection screen. – PinkTurtle Sep 19 '14 at 19:19
  • (X and Y and separate variables because the PoV isn't necessarily facing the center of the projection screen.) – PinkTurtle Sep 19 '14 at 19:28
  • 1
    Glad I could help. For the record: the English name for "$\theta$" is "theta", and you can type the symbol in posts/comments as $\theta$. – Ben Grossmann Sep 19 '14 at 19:29
  • Okay :) I just sent you an email for clarification. Please consider it :) – PinkTurtle Sep 19 '14 at 20:13
  • 1
    @Julien one of the solutions for $d$ is negative. I am fairly sure that if $\tan \theta > 0$, you can disregard the negative. solution and set $$ d = \frac{x+y+ \sqrt{(x+y)^2 + 4xy\tan^2 \theta}}{2\tan \theta} $$ I do not have a satisfactory explanation for the negative root, but I'll think about it. – Ben Grossmann Sep 19 '14 at 20:21
  • Note that $d$ being negative implies that you are on the wrong side of the screen, so of course it makes no sense. Also, keep in mind that $\tan \theta$ might be negative, which would mean that you should take the other root. – Ben Grossmann Sep 19 '14 at 20:27
  • Actually if $\theta$ satisfies d, then 360-$\theta$ satisfies -d. But it doesn't explain 2 different d's :p – PinkTurtle Sep 19 '14 at 20:28
  • Maybe I should try to draw with real values and see what I get. – PinkTurtle Sep 19 '14 at 20:33
  • That sounds like a good idea. Let me know if you figure it out – Ben Grossmann Sep 19 '14 at 20:40
  • Given the nature of the problem, I changed d in my question to -d. Could you reflect it in your answer ? I am sending you what I found via email. Thank you. – PinkTurtle Sep 19 '14 at 21:53