Fix lattice_points for disk

This commit is contained in:
Ian Jauslin 2024-02-22 17:08:42 -05:00
parent a48457de29
commit 1cd4e0fdc6
2 changed files with 2 additions and 2 deletions

View File

@ -290,7 +290,7 @@ class Element_circle(Element):
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:
if lattice.spacing*lattice.spacing*(i*i+j*j)<=self.size*self.size/4:
out.append(Point(self.pos.x+i*lattice.spacing,self.pos.y+j*lattice.spacing))
return out

View File

@ -212,7 +212,7 @@ class Painter(Widget):
if count==0:
return
Color(color[0],color[1],color[2],1-count*0.1)
Rectangle(pos=(self.pos_tocoord_x(x-0.5),self.pos_tocoord_y(y-0.5)),size=(self.base_size,self.base_size))
Rectangle(pos=(self.pos_tocoord_x(x-0.5*self.lattice.spacing),self.pos_tocoord_y(y-0.5*self.lattice.spacing)),size=(self.base_size*self.lattice.spacing,self.base_size*self.lattice.spacing))