TITLE: Calculate 3D Vector out of two angles and vector length
QUESTION [5 upvotes]: What is the easiest way to calculate vector coordinates in 3D given 2 angles vector length?
Input:

Angle between X and Y axis: $$\alpha \in [0, 360).$$
Angle between Y and Z axis: $$\beta\in [0, 360).$$
Scalar length.

Expected output:
X, Y, Z coordinates of the vector

REPLY [5 votes]: You have presented a point in spherical coordinate system, which needs to be converted to Cartesian. The line joining the origin to the point will be the vector. Let the scalar length be $r$. If the $\beta$ angle is measured from $Y$ axis towards $Z$ axis and $\alpha$ from $X$ axis towards $Y$:
$$x = r \cos \beta sin \alpha$$
$$y = r \cos \beta cos \alpha$$
$$z = r \sin \beta$$
The vector is: $x \hat{i} + y\hat{j} + z\hat{k}$.