From 7e444188292297674ffaf413984f40f586415372 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Thu, 22 Feb 2024 16:31:10 -0500 Subject: [PATCH] voronoi cells for disks --- src/element.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/element.py b/src/element.py index 816e907..87b4211 100644 --- a/src/element.py +++ b/src/element.py @@ -282,3 +282,16 @@ class Element_circle(Element): def move_along(self,delta,element): x=element.pos-self.pos+delta 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 + +