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 + +