# Calculate coordinates of the a point in space with hypotenuse and two angles given

I have a cylinder with a length of $2$, and two angles for rotation around two of the axes. Functions for that are named $\text{RotX}$ (rotation around X axis) and $\text{RotZ}$ (rotation around Z axis). I also know that the "bottom" of my cylinder is at $(0,0,0)$ (the center of the circle forming the "bottom").

What I need is to calculate the "top" point (the center of the circle at the other end) having the data exposed in the upper lines.

In my second image, point $A$ is calculated as follows $(\sin{\text{zAngle}},\cos{\text{zAngle}},\sin{\text{xAngle}})$ with $\text{zAngle}=\pi/4$ (alpha angle) and $\text{xAngle}=0$.

Point $B$ is calculated as $(\sin{\text{xAngle}},\cos{\text{xAngle}},\sin{\text{zAngle}})$ with $\text{xAngle}=\pi/4$ (beta angle) and $\text{zAngle}=0$.

Point $C$ is the "top" of a cylinder with $\text{xAngle}=\pi/4$ and $\text{zAngle}=\pi/4$.

I need to find an algorithm to determine the "top" point for any given $\text{xAngle}$ and $\text{zAngle}$.

I'd be extremely thankful if anyone could help me.

Rotation around the axis:

Image actually showing my problem:

Note: $\text{xAngle}$ is angle used in $\text{RotX}$ and $\text{zAngle}$ is angle used in $\text{RotZ}$.

-
Why don't you use Rotation Matrices? – Pragabhava Nov 3 '12 at 17:38
Thank you, it took some time to understand, but works. – Bujanca Mihai Nov 4 '12 at 12:16