Pregunta

I was wondering how to create spheres in a cuboid. This cuboid (50,50,50) is enclosed with lots of points and all I wanted is to get the points position and its value inside the sphere (radius = 2).

Any idea/advise/code/info greatly appreciated..

¿Fue útil?

Solución

Create a sphere with its center (i,j,k) and cuboid (x0,y0,z0):

points_in_sphere = (x0 - i)**2 + (y0 - j)**2 + (z0 - k)**2 <= (radius)**2

Extract the coordinates of the points:

x1,y1,z1 = np.argwhere(points_sphere)[:,0], np.argwhere(points_sphere)[:,1], np.argwhere(points_sphere)[:,2]

Print the point values:

print cubiod[x1,y1,z1] 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top