diff --git a/src/painter.py b/src/painter.py index 3f502fe..264165e 100644 --- a/src/painter.py +++ b/src/painter.py @@ -176,39 +176,42 @@ class Painter(Widget): while self.pos_tocoord_x(xx)0: - if self.is_in_voronoi(xx,yy,particle): - self.draw_voronoi_site(xx,yy,particle.color) + self.draw_voronoi_site(xx,yy,particle.color,self.is_in_voronoi(xx,yy,particle)) yy-=self.lattice.spacing xx+=self.lattice.spacing xx=pos.x-self.lattice.spacing while self.pos_tocoord_x(xx)>0: yy=pos.y while self.pos_tocoord_y(yy)0: - if self.is_in_voronoi(xx,yy,particle): - self.draw_voronoi_site(xx,yy,particle.color) + self.draw_voronoi_site(xx,yy,particle.color,self.is_in_voronoi(xx,yy,particle)) yy-=self.lattice.spacing xx-=self.lattice.spacing # check whether a site is in the Voronoi cell of a particle def is_in_voronoi(self,x,y,particle): d_to_particle=self.lattice.distance_to_particle(x,y,particle) + # count how many are in voronoi cell + count=1 # TODO: start with a particle that is close to x,y for q in self.particles: - if q!=particle and self.lattice.distance_to_particle(x,y,q)