# area
x,y = build_poly([(0,0), (3000,0), (3000,2100), (0,2100)])
ax.plot(x, y, 'g-')
-
+
x,y = build_poly([(0,0), (0,500), (500,500), (500,0)])
ax.plot(x, y, 'y-')
x,y = build_poly([(740,0), (740,500), (2260,500), (2260,0)])
ax.plot(x, y, 'g--')
-
+
+ x,y = build_path([(375,0), (375,2050)])
+ ax.plot(x, y, 'r-')
+
+ x,y = build_path([(150,1972), (2850,472)])
+ ax.plot(x, y, 'r-')
+
+ x,y = build_path([(0,1722), (3000,1722)])
+ ax.plot(x, y, 'r-')
+
+ x,y = build_path([(150,972), (1950,1972)])
+ ax.plot(x, y, 'r-')
+
+ acoef = (2850-150)/5.
+ bcoef = (472-1972)/5.
+ x,y = build_path([(600,1972), (600+bcoef, 1972-acoef)])
+ ax.plot(x, y, 'r-')
+
+ p = PatchCollection([Circle((2400,972), 225)],
+ cmap=matplotlib.cm.jet,
+ alpha=0.5, facecolor=(1.,0.,0.))
+ ax.add_collection(p)
+
# limit
#x,y = build_poly([(250,250), (2750,250), (2750,1850), (250,1850)])
#ax.plot(x, y, 'g--')
-
+
+ xtick = [i * STEP_CORN_X + OFFSET_CORN_X for i in range(WAYPOINTS_NBX)]
+ ax.set_xticks(xtick)
+ ytick = [(i-1) * STEP_CORN_Y/2 + OFFSET_CORN_Y for i in range(WAYPOINTS_NBY*2)]
+ ax.set_yticks(ytick)
+
init_corn_table(random.randint(0,8), random.randint(0,3))
waypoints = init_waypoints()
mark_all_neigh(5,6)
-
+
wcorn = []
bcorn = []
points = []
y = OFFSET_CORN_Y + STEP_CORN_Y/2
j = 0
while y < 2100:
-
+
if waypoints[i][j] == TYPE_WHITE_CORN:
wcorn.append(Circle((x, y), 25))
if waypoints[i][j] == TYPE_BLACK_CORN:
def graph(filename):
fig = plt.figure()
- ax = fig.add_subplot(111)
+ ax = fig.add_subplot(111, aspect='equal')
build_area(ax)
- ax.grid()
+ ax.grid(color = (0.3, 0.3, 0.3))
ax.set_xlim(-100, 3100)
ax.set_ylim(-100, 2200)
+ #ax.set_xlim(0, 825)
+ #ax.set_ylim(1472, 1972)
#ax.set_title('spline paths')
#plt.show()
fig.savefig(filename)