vrate = 0.8
p = 0.7
coteCarre = 50
-distanceEmmissionMax = 30
+distanceEmmissionMax = 20
nbiter = 1000
POS = 1
POS_NUL = 2
img = cv.CreateImage ((tx, ty), 32, 3)
cv.Rectangle(img, (0,0),(tx,ty), cv.Scalar(255,255,255), thickness=-1)
def px((x,y)):
- return(int(tx*x/coteCarre),ty-int(ty*y/coteCarre))
+ u = float(tx)/(coteCarre + 2*distanceEmmissionMax)
+ return(int(distanceEmmissionMax*u + x * u),int(distanceEmmissionMax*u + y * u))
for i in set(range(len(l)))-set([sink]):
(x,y) = l[i]
pix,piy = px((x,y))
- demx = distanceEmmissionMax*tx/coteCarre
+ demx = distanceEmmissionMax*tx/(coteCarre+2*distanceEmmissionMax)
cv.Circle(img, (pix,piy),demx, cv.Scalar(125,125,125))
for i in set(range(len(l)))-set([sink]):
#nx.draw(G)
#pb.show()
-#(G,l) = genereGraph()
+(G,l) = genereGraph()
N = G.nodes()
#V = list(set(sample(N,int(len(N)*vrate)))-set([sink]))
V = list(set(N)-set([sink]))
source = V
print "source",source
-#afficheGraph(G,l,500,500,sink)
+afficheGraph(G,l,500,500,sink)
#nx.draw(G)
#pb.show()
-
-
+exit()
#print G.edges(data=True)
#TODO afficher le graphe et etre sur qu'il est connexe