I have a list of spheres with some known characteristics (i.e. radii and positions) inside some big spherical volume with known center and radius. I would like to randomly place these tiny spheres throughout the volume within the big sphere while keeping their individual characteristics intact meaning only their positions need to be shuffled subject to the constraint that their centers falls inside the big sphere.
Here is what I can think of for pandas but I am not sure how to add the constraint that the tiny sphere be inside the big volume.
df['position'] = df['position'].sample(frac=1).values
What is the fastest and shortest way to do that inside a python script?
Aucun commentaire:
Enregistrer un commentaire