bugfix: works for all cuboids, not just cubes

This commit is contained in:
Martin Diehl 2020-03-29 23:09:43 +02:00
parent 7eeb5db15f
commit 396d428af7
2 changed files with 3 additions and 3 deletions

View File

@ -44,8 +44,8 @@ def Laguerre_tessellation(grid, size, seeds, weights, origin = np.zeros(3), peri
closest_seed= np.array([findClosestSeed(seeds_p,weights_p,coord) for coord in coords])
if periodic:
closest_seed = closest_seed.reshape(grid[2]*3,grid[1]*3,grid[0]*3)
return closest_seed[grid[2]:grid[2]*2,grid[1]:grid[1]*2,grid[0]:grid[0]*2]%seeds.shape[0]
closest_seed = closest_seed.reshape(grid*3)
return closest_seed[grid[0]:grid[0]*2,grid[1]:grid[1]*2,grid[2]:grid[2]*2]%seeds.shape[0]
else:
return closest_seed

View File

@ -370,7 +370,7 @@ class Geom:
microstructure = np.array(result.get())
if periodic:
microstructure = microstructure.reshape(grid[0]*3,grid[1]*3,grid[2]*3)
microstructure = microstructure.reshape(grid*3)
microstructure = microstructure[grid[0]:grid[0]*2,grid[1]:grid[1]*2,grid[2]:grid[2]*2]%seeds.shape[0]
else:
microstructure = microstructure.reshape(grid)