33 lines
744 B
Python
33 lines
744 B
Python
|
|
class Disque():
|
||
|
|
def __init__(self,centre,diam):
|
||
|
|
self.c = centre
|
||
|
|
self.d = diam
|
||
|
|
self.nbPart = 900
|
||
|
|
|
||
|
|
def display(self):
|
||
|
|
noStroke()
|
||
|
|
ellipse(self.c.x,
|
||
|
|
self.c.y,
|
||
|
|
self.d,self.d)
|
||
|
|
|
||
|
|
for i in range(0,self.nbPart):
|
||
|
|
pos = self.posInCir()
|
||
|
|
fill(110)
|
||
|
|
stroke(255)
|
||
|
|
ellipse(pos.x, pos.y, 10,10)
|
||
|
|
|
||
|
|
def populate(self):
|
||
|
|
return
|
||
|
|
|
||
|
|
def posInCir(self):
|
||
|
|
posX = random(width)
|
||
|
|
posY = random(height)
|
||
|
|
|
||
|
|
pos = PVector(posX, posY)
|
||
|
|
dist = self.c.dist(pos)
|
||
|
|
if(dist > self.d/2):
|
||
|
|
return self.posInCir()
|
||
|
|
|
||
|
|
else:
|
||
|
|
return pos
|