-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholdUsefulCode
More file actions
22 lines (22 loc) · 910 Bytes
/
oldUsefulCode
File metadata and controls
22 lines (22 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def loadMap(self, obj):
print("loading Map...")
global sand, ptdraw, pts
self.painter.canvas.clear()
sand = np.zeros((longueur,largeur))
ptdraw = ((np.loadtxt('sandMap.txt')).astype(int)).tolist()
pnts = ptdraw
pnts = np.array(pnts).reshape(int(len(pnts)/2), 2).tolist()
#pnts = ((1,1), (5,5), (3,3) , (8,8), (4,4))
sorted_list = dl.sort_pt(pnts)
ptlinedraw = np.array(sorted_list).ravel().tolist()
count = len(ptdraw) # 3 rows in your example
with self.painter.canvas:
Color(0.8,0.0,0.2)
Line(points = ptlinedraw)
for i in range(0,count,2):
pts = Point()
sand[ptdraw[i]][ptdraw[i+1]]=1
Color(0.8,0.7,0)
pts.add_point(ptdraw[i],ptdraw[i+1])
#pts.pointsize=1
#pts.flag_update()