문제

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..

도움이 되었습니까?

해결책

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] 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top