I generate $N=1000$ points in spherical cap $\{\rho = 10, 0 \deg<\theta<30 \deg, 0<\phi<2pi\}$.
And now I want to rotate these points together such that the center of the cap goes to the specific theta and phi with the distances to other points unchanged.
I first try to add the specific theta and phi to the positions of all points, but with the spherical coordinates, it doesn't work. (It becomes a ring T_T)
Any one can help me to rotate all points together to such that the center of the cap goes to the specific theta and phi with the distances to other points unchanged. Or please give me some advice. Thanks in advance.
Here's my code in python.
from math import *
import numpy as np
def polarToxyz(polar_cord): # theta, phi radian
r = polar_cord[0]
theta = polar_cord[1]
phi = polar_cord[2]
return [r * sin(theta) * cos(phi), r * sin(theta) * sin(phi), r * cos(theta)]
theta_prime_deg = 30
theta_prime_rad = theta_prime_deg * np.pi / 180
delta_theta_deg = 0
delta_theta_rad = delta_theta_deg * np.pi / 180
delta_phi_deg = 0
delta_phi_rad = delta_phi_deg * np.pi / 180
list_x = []
list_y = []
list_z = []
for i in range(numbPoints):
rho = 10
phi = 2 * np.pi * np.random.uniform(0,1)
theta = acos(1 - np.random.uniform(0,1)*(1-cos(theta_prime_rad)))
theta += delta_theta_rad
phi += delta_phi_rad
[x,y,z] = polarToxyz([rho, theta, phi])
list_x.append(x)
list_y.append(y)
list_z.append(z)
drawFig3D(list_x, list_y, list_z)