voronoi cells for disks
This commit is contained in:
parent
fd61a4620f
commit
7e44418829
@ -282,3 +282,16 @@ class Element_circle(Element):
|
|||||||
def move_along(self,delta,element):
|
def move_along(self,delta,element):
|
||||||
x=element.pos-self.pos+delta
|
x=element.pos-self.pos+delta
|
||||||
return x/l_2(x)*(element.size+self.size)/2+self.pos-element.pos
|
return x/l_2(x)*(element.size+self.size)/2+self.pos-element.pos
|
||||||
|
|
||||||
|
# for use with lattices
|
||||||
|
# list of lattice points covered by square
|
||||||
|
def lattice_points(self,lattice):
|
||||||
|
out=[]
|
||||||
|
dx=math.floor(0.5*self.size/lattice.spacing)
|
||||||
|
for i in range(-dx,dx+1):
|
||||||
|
for j in range(-dx,dx+1):
|
||||||
|
if i*i+j*j<=2*dx*dx:
|
||||||
|
out.append(Point(self.pos.x+i*lattice.spacing,self.pos.y+j*lattice.spacing))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user