I'm not sure if the title is very descriptive of what I'm trying to do. Let's say I have a sphere with radius $r$ and let's say I'm standing on the surface of that sphere (this is actually Earth but let's use $r$ for the radius for simplicity). If I'm given two angles, $\theta$ and $\phi$, I want to be able to point in the direction given by the angles where $0\le\theta\le360$ and where 0 degrees is pointing north, and $0\le\phi\le90$, which gives the angle I point above the horizon, in other words, I need a vector that represents the direction in which I'm pointing. The difficulty here is that I need to work relative to the xyz-axis where $(0,0,0)$ is the center of the sphere. Here are a couple examples that will hopefully make things clear:
- Let's say I have any $\theta$ and $\phi=90$, no matter where I stand on the sphere and no matter what $\theta$ is, I should be pointing straight up, i.e. normal to the surface. So, in this case, the vector I would get is $\vec{n}$, the normal vector to the surface.
- Let's say I'm anywhere on the surface of the sphere where $z=0$ on the xyz-axis, i.e. somewhere on the equator. If $\theta=0$ and $\phi=0$, I should be pointing tangential to the surface of the sphere, towards $+z$. Here my vector would be $(0,0,c)$, where c is any positive real number.
- Let's say I'm at the point $(0,\frac{r}{\sqrt{2}},\frac{r}{\sqrt{2}})$ and have $\theta=90$ and $\phi=0$, my vector would be $(-a,0,0)$ where $a$ is any positive real number.
- Again, let's say I'm at the point $(0,\frac{r}{\sqrt{2}},\frac{r}{\sqrt{2}})$ but have $\theta=0$ and $\phi=0$. The vector I would need is $(0,-b,b)$ where $b$ is any positive real number.
I hope this makes sense, I'm having difficulty coming up with a good way of describing what I would like to do. Any help would be greatly appreciated and feel free to ask any clarifying questions.
I've tried various things including projections of the normal vector onto the xy-plane to get the angle between the xy-plane and the normal vector at a point.
Thank you very much for any assistance.