bugfix: works for all cuboids, not just cubes
This commit is contained in:
parent
7eeb5db15f
commit
396d428af7
|
@ -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])
|
closest_seed= np.array([findClosestSeed(seeds_p,weights_p,coord) for coord in coords])
|
||||||
|
|
||||||
if periodic:
|
if periodic:
|
||||||
closest_seed = closest_seed.reshape(grid[2]*3,grid[1]*3,grid[0]*3)
|
closest_seed = closest_seed.reshape(grid*3)
|
||||||
return closest_seed[grid[2]:grid[2]*2,grid[1]:grid[1]*2,grid[0]:grid[0]*2]%seeds.shape[0]
|
return closest_seed[grid[0]:grid[0]*2,grid[1]:grid[1]*2,grid[2]:grid[2]*2]%seeds.shape[0]
|
||||||
else:
|
else:
|
||||||
return closest_seed
|
return closest_seed
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ class Geom:
|
||||||
microstructure = np.array(result.get())
|
microstructure = np.array(result.get())
|
||||||
|
|
||||||
if periodic:
|
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]
|
microstructure = microstructure[grid[0]:grid[0]*2,grid[1]:grid[1]*2,grid[2]:grid[2]*2]%seeds.shape[0]
|
||||||
else:
|
else:
|
||||||
microstructure = microstructure.reshape(grid)
|
microstructure = microstructure.reshape(grid)
|
||||||
|
|
Loading…
Reference in New Issue