I wrote a script to generate mesh with different distribution, so when I created the class of a hexagonal distribution, I can get a differents spacing in our cube. the distance e must be equal. here is the part of the distribution script haxagonal.
class hexDistribute(distributeAlgorithm) :
def __init__(self, mesh, domain, collDomain) :
self.mesh = mesh
self.domain = domain
self.collDomain = collDomain
def search(self) :
bound = round(self.domain.getBound(), 4)*2
size = round(self.mesh.getOutsideRadius(), 4)
self.locList = ()
k = 0
while 1 :
z = (2/3)*(6**(1/2))*k*size
if z > bound-size*2*self.collDomain :
break
j = 0
while 1 :
y = (3**(1/2))*((j+((k%2/3)%2)))*size
if y > bound-size*2*self.collDomain :
break
i = 0
while 1 :
x = (2*i + ((j+(k%2))%2))*size
if x > bound-size*2*self.collDomain :
break
loc = Vector((x, y, z)) + Vector((self.collDomain*size - bound/2,self.collDomain*size - bound/2,self.collDomain*size - bound/2))
self.locList += (loc,)
i += 1
j += 1
k += 1
return self.locList
How to modify this class to fix my problem.