Currently, I have some Python code to obtain equidistant points on the surface of a sphere. Now, I want to edit this code to obtain equidistant points on the surface of a hemisphere. I assume that there is some simple parameter I need to change, but I am still a Python novice.
My code:
from numpy import pi, cos, sin, arccos, arange
import mpl_toolkits.mplot3d
import matplotlib.pyplot as plt
num_pts = 10000
indices = arange(0, num_pts, dtype=float) + 0.5
phi = arccos(1 - 2*indices/num_pts)
theta = pi * (1 + 5**0.5) * indices
x, y, z = cos(theta) * sin(phi), sin(theta) * sin(phi), cos(phi);
fig_size = plt.rcParams["figure.figsize"]
fig_size[0] = 75
fig_size[1] = 75
plt.rcParams["figure.figsize"] = fig_size
plt.figure().add_subplot(111, projection='3d').scatter(x, y, z, s=1);
plt.show()
#saves the coordinates
import numpy as np
import sys
points = np.transpose(np.array([x,y,z]))
#np.savetxt(sys.stdout, points, fmt="%.6f")
np.savetxt('data.txt', points, fmt="%.6f")
Thank you for your help!