ssapy_toolkit.Compute.generate_sphere_of_vectors
Functions
|
Generate N three-dimensional vectors with identical magnitude whose directions are area-uniform on the unit sphere. |
- ssapy_toolkit.Compute.generate_sphere_of_vectors.generate_sphere_vectors(n, magnitude, seed=None, distribution='uniform')[source]
Generate N three-dimensional vectors with identical magnitude whose directions are area-uniform on the unit sphere.
- Parameters:
n (int) – Number of vectors to generate. If n <= 0, returns an empty (0, 3) array.
magnitude (float) – Desired magnitude for every vector.
seed (int or None) – Optional seed for reproducibility.
distribution ({"uniform", "random"}) –
“uniform”: normalize i.i.d. Gaussian vectors (isotropic -> area-uniform). “random” : area-uniform using spherical coordinates with
z ~ U[-1, 1], phi ~ U[0, 2*pi).
- Returns:
Array of shape (n, 3). Each row has norm approximately equal to magnitude.
- Return type: