# N points in a circle around a point on a sphere.

Consider a 3D sphere:

• $(x_{c}, y_{c}, z_{c})$ : cartesian coordinates of the center
• $r$ : the radius

Consider a random point on the surface of this sphere of coordinates :

• $(x_{0}, y_{0}, z_{0})$

And finally consider the (right circular) cone :

• $(x_{c}, y_{c}, z_{c})$ : its vertex
• $(x_{0}, y_{0}, z_{0})$ : the center of its base
• $\alpha$ : the half angle at the vertex

The intersection of this cone with the surface of the sphere will be a circle around the random point.

The question is : what are the coordinates ${(x_{1}, y_{1}, z_{1}), (x_{2}, y_{2}, z_{2}), ..., (x_{N}, y_{N}, z_{N})}$ of $N$ points evenly distributed on this circle ?

Illustration:

In this figure, it would correspond to find the coordinates of $N$ evenly spaced points on the circle (on the perimeter) around the point $A$.

## 3 Answers

Use spherical coordinates to place the points evenly $(cos\theta\cos\phi, sin\theta\cos\phi,\sin\phi)$. In your case, you'll use $\theta_k=\frac{2k\pi}{N}$, and $\phi=\alpha$. Then, use a 3D rotation to bring the pole $(0, 0, 1)$ to the desired direction and translate to the desired center.

• Can you detail the second part ? (Then, use a 3D rotation...) May 22, 2014 at 18:21
• One way is to use the Gram-Schmidt process to build an orthogonal matrix (rotation) having $(x_0, y_0, z_0)$ as the first vector. en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
– user65203
May 22, 2014 at 18:36

Let $$\theta$$ be the polar angle of a point on the sphere's surface ($$\theta=0$$ at the north pole, $$\theta=\pi/2$$ at the equator) and $$\phi$$ an azimuth (longitude) measured along the equator. Points on the sphere have Cartesian coordinates $$\left(\begin{array}{c}x_c\\y_c\\z_c\end{array}\right) +r\left(\begin{array}{c}\sin\theta \cos\phi \\ \sin\theta \sin\phi\\ \cos\theta\end{array}\right),\quad 0\le \theta \le \pi, 0\le \phi \le 2\pi.$$ Because the cone axis contains the sphere center, the intersection of the cone hull with the sphere surface is a circle. The apex of the cone base has distance $$r_0\equiv \sqrt{(x_0-x_c)^2+(y_0-y_c)^2+(z_0-z_c)^2}$$ to the center and has Cartesian coordinates $$\left(\begin{array}{c}x_0\\y_0\\z_0\end{array}\right) = \left(\begin{array}{c}x_c\\y_c\\z_c\end{array}\right) +r_0\left(\begin{array}{c}\sin\theta_0 \cos\phi_0 \\ \sin\theta_0 \sin\phi_0\\ \cos\theta_0\end{array}\right).$$ Obviously these angles $$\theta_0,\phi_0$$ are known by taking artcan and arccos function of the difference vector from $$(x_c,y_c,z_c)$$ to $$(x_0,y_0,z_0)$$. $$\cos\theta_0 = \frac{z_0-z_c}{r_0}.$$ The points on the circle have coordinates $$\left(\begin{array}{c}x_i\\y_i\\z_i\end{array}\right) = \left(\begin{array}{c}x_c\\y_c\\z_c\end{array}\right) +r\left(\begin{array}{c}\sin\theta_i \cos\phi_i \\ \sin\theta_i \sin\phi_i\\ \cos\theta_i\end{array}\right),\quad i=1\ldots N.$$ The condition on the angles $$\theta_i,\phi_i$$ is that the angle between circle rim and cone axis observed from the sphere center is $$\alpha$$. The dot product of two vectors is the product of their lengths by the cosine of the angle between the directions: $$r\left(\begin{array}{c}\sin\theta_i \cos\phi_i \\ \sin\theta_i \sin\phi_i\\ \cos\theta_i\end{array}\right) \cdot r_0\left(\begin{array}{c}\sin\theta_0 \cos\phi_0 \\ \sin\theta_0 \sin\phi_0\\ \cos\theta_0\end{array}\right) =r r_0\cos\alpha.$$ $$\therefore \sin\theta_i\sin\theta_0 \cos(\phi_i-\phi_0) +\cos(\theta_i)\cos(\theta_0) =\cos\alpha.$$ The simplest way to construct such $$\theta_i,\phi_i$$ is to start with an arrangement where the cone axis points to the North pole, with cartesian coordinates $$r\left(\begin{array}{c}\sin\alpha \cos \bar \phi_i \\ \sin\alpha \sin \bar \phi_i\\ \cos\alpha\end{array}\right), \bar\phi_i = c+ i\frac{2\pi}{N}$$ on the circle, with some TBD offset angle $$c$$, then to tilt that coordinate system and the intermediate points by the angle $$\theta_0$$ to reach the intended position.

The orthogonal matrix $$\Omega$$ that rotates by an angle $$\omega$$ around a rotation axis with axis vector $$(r_x,r_y,r_z)$$, $$r_x^2+r_y^2+r_z^2=1$$ has the well-known form $$\left(\begin{array}{ccc} (1-\cos\omega)r_x^2+\cos\omega & (1-\cos\omega)r_xr_y-\sin\omega r_z & (1-\cos\omega)r_xr_z+\sin\omega r_y \\ (1-\cos\omega)r_xr_y+\sin\omega r_z & (1-\cos\omega)r_y^2+\cos\omega & (1-\cos\omega)r_yr_z-\sin\omega r_x \\ (1-\cos\omega)r_xr_z-\sin\omega r_y & (1-\cos\omega)r_yr_z+\sin\omega r_x& (1-\cos\omega)r_z^2+\cos\omega \\ \end{array}\right)$$ see https://www.ias.ac.in/describe/article/reso/004/10/0061-0068 and https://dx.doi.org/10.1007/978-3-662-09156-2 and https://dx.doi.org/10.1119/1.10600 and https://dx.doi.org/10.1119/1.10264 . In our case $$\omega=\theta_0$$ and we may take the eigenvector/axis along the equatorial plane with azimuth $$90^\circ$$ away from the projection of the base: $$(r_x,r_y,r_z) = (\cos(\phi_0+\pi/2),\sin(\phi_0+\pi/2),0)$$. So here $$\Omega = \left(\begin{array}{ccc} 1-\cos^2(\phi_0)(1-\cos\theta_0) & -(1-\cos\theta_0)\sin\phi_0\cos\phi_0 & \sin\theta_0 \cos\phi_0 \\ -(1-\cos\theta_0)\sin\phi_0\cos\phi_0 & \cos\theta_0+\cos^2(\phi_0)(1-\cos\theta_0) & \sin\theta_0\sin\phi_0 \\ -\sin\theta_0\cos\phi_0 & -\sin\theta_0\sin\phi_0 & \cos\theta_0 \end{array}\right).$$ [Because it must map the north pole $$(0,0,1)$$ to the point related to the base center, the final column of that matrix is the normalized coordinate vector of the cone base.]

In summary, the Cartesian coordinates of the points are given by the matrix-vector-product $$\left( \begin{array}{c} x_i \\ y_i \\ z_i \end{array} \right) = \left( \begin{array}{c} x_c \\ y_c \\ z_c \end{array} \right) +r \left(\begin{array}{ccc} 1-\cos^2(\phi_0)(1-\cos\theta_0) & -(1-\cos\theta_0)\sin\phi_0\cos\phi_0 & \sin\theta_0 \cos\phi_0 \\ -(1-\cos\theta_0)\sin\phi_0\cos\phi_0 & \cos\theta_0+\cos^2(\phi_0)(1-\cos\theta_0) & \sin\theta_0\sin\phi_0 \\ -\sin\theta_0\cos\phi_0 & -\sin\theta_0\sin\phi_0 & \cos\theta_0 \end{array}\right) \cdot \left( \begin{array}{c} \sin\alpha\cos\bar \phi_i\\ \sin\alpha\sin\bar \phi_i\\ \cos\alpha \end{array} \right)$$

Using spherical coordinates, the sphere is parameterized as follows

$$x = x_c + r \sin \theta \cos \phi$$

$$y = y_c + r \sin \theta \sin \phi$$

$$z = z_c + r \cos \theta$$

Setting the above coordinates to $$(x_0, y_0, z_0)$$, we can solve for $$theta$$ and $$\phi$$, as follows

$$\theta_0 = \cos^{-1} \left( \dfrac{z_0 - z_c}{r} \right)$$

$$\phi_0 = \operatorname{atan2}( x_0 - x_c, y_0 - y_c )$$

Now, define the orthonormal basis $$[ u_1, u_2, u_3 ]$$ with

$$\mathbf{u_1} = ( \cos \theta_0 \cos \phi_0, \cos \theta_0 \sin \phi_0, -\sin \theta_0 )$$

$$\mathbf{u_2} = ( - \sin \phi_0 , \cos \phi_0 , 0)$$

$$\mathbf{u_3} = ( \sin \theta_0 \cos \phi_0 , \sin \theta_0 \sin \phi_0, \cos \theta_0 )$$

Then the circle of intersection between the cone and the sphere as described in the problem are given by the parametric equation,

$$Q(t) = h \ \mathbf{u_3} + R ( \cos t \ \mathbf{u_1} + \sin t \ \mathbf{u_2} )$$

where $$h = r \sin \alpha$$ and $$R = r \cos \alpha$$

To generate the $$N$$ equally-spaced points on this circle, take

$$t_k = \dfrac{2 \pi k}{N} , \ k = 0, 1, 2, \dots, N-1$$

Then the $$N$$ points are

$$Q(t_k) = h \ \mathbf{u_3} + R ( \cos t_k \ \mathbf{u_1} + \sin t_k \ \mathbf{u_2} )$$