1
$\begingroup$

I have spherical coordinates $w = (\theta, \phi)$ such that $\theta$ is the angle between $w$ and the polar axis (let's assume $z$ is up).

Assuming $w$ is a unit vector, the conversion to cartesian coordinates is: $$ \left\{ \begin{align} x &= \cos(\phi) \sin(\theta) \\ y &= \sin(\phi) \sin(\theta) \\ z &= \cos(\theta) \end{align} \right. $$

I'd like to transform $w$ such that its polar axis lies on an arbitrary vector $n$, and then convert to cartesian coordinates. The end goal is to generate a hemisphere point cloud about the normal vector $n$, but when generating random variables, it is most convenient to initialize them in $z$-up space.

Rodriguez's formulation via Rotating one 3d-vector to another makes sense if we are going from Cartesian->Cartesian but is there a more efficient way to do it, maybe rotating the Spherical coordinates directly before converting to cartesian coords?

Thanks.

$\endgroup$
  • $\begingroup$ Standard names for your spherical coordinates: $\theta$ is colatitude and $\phi$ is longitude. $\endgroup$ – Sammy Black Dec 13 '13 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.