X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Ftests%2Foa%2Fgraph.py;h=b7e5853bb663f4b4731b9536f85b476b5c4a4054;hp=0b304bc2cc9cc402dfa1885d6350cd0c5c3729f1;hb=57c8774dea2b516aec344a046f562aeac979d24e;hpb=49fd019c8bd61d623accbd9eca62d88470370a3f diff --git a/projects/microb2010/tests/oa/graph.py b/projects/microb2010/tests/oa/graph.py index 0b304bc..b7e5853 100644 --- a/projects/microb2010/tests/oa/graph.py +++ b/projects/microb2010/tests/oa/graph.py @@ -170,7 +170,7 @@ def build_area(ax): # 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-') @@ -179,16 +179,38 @@ def build_area(ax): 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-') + # 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 = [] @@ -205,7 +227,7 @@ def build_area(ax): 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: @@ -246,11 +268,11 @@ def build_area(ax): 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_title('spline paths')