2
$\begingroup$

I just can't see what's wrong, this should be relatively simple...

I have a vector which has length 1. Then, I have two angles. The first ($\gamma$) is the angle between the projection of the vector in the $xz$ plane and the $z$ axis. The second ($\beta$) is the angle between the projection of the vector in the $yz$ plane and the $z$ axis.

All I need now are the (cartesian) vector components $(x,y,z)$.

How do I calculate them?

I got: $x = \sin(\gamma)\\ y = \sin(\beta)\\ z = \cos(\gamma) \cdot \cos(\beta)$

But this can't be correct, because the length of this vector is not always 1. Can you help me and find the error, please?

1 Answers 1

4

I think you got $x=\sin\gamma$ by saying that you have a right triangle in the $xz$-plane with side $x$ opposite angle $\gamma$, but then you are also assuming the length of the hypotenuse is $1$. It isn't. The hypotenuse is a projection of a vector of length $1$, but (unless the $y$-coordinate turns out to be zero) it is itself a vector of length strictly less than $1$.

Perhaps a more fruitful approach begins with $\tan\gamma=x/z$.

  • 0
    Yes! I think this would lead much more quickly to the solution than the dot product approach I used in my answer. +1.2012-11-22
  • 0
    $x = z\tan\gamma$ and $y=z\tan\beta$ and $x^2+y^2+z^2=1$ so $z=\pm1/\sqrt{1+\tan^2\gamma+\tan^2\beta}$, huzzah!2012-11-22
  • 0
    This is indeed much quicker, but I liked coffeemath's answer, too. And there is one more good about it: actually, I do have the tangens values of both angles.2012-11-22