X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Ftests%2Foa%2Fgraph.py;fp=projects%2Fmicrob2010%2Ftests%2Foa%2Fgraph.py;h=48e9cc3a5c658a7d1d3f10d77b4875b512258d91;hp=49d3649f1487667223028cac42a5a86734ae913a;hb=17aadc4c8c3e60c2b5e6bbba91c8542849addbd7;hpb=f1b54a67a3317295704f25e2a802e5f86646f4d5 diff --git a/projects/microb2010/tests/oa/graph.py b/projects/microb2010/tests/oa/graph.py index 49d3649..48e9cc3 100644 --- a/projects/microb2010/tests/oa/graph.py +++ b/projects/microb2010/tests/oa/graph.py @@ -166,6 +166,40 @@ def build_path(ptlist): x, y = zip(*poly.vertices) return x,y +def nearest_corn(x, y): + OFFX=150 + OFFY=222 + STEPX=450 + STEPY=500 + + x -= OFFX + x += STEPX/2 + x /= STEPX + + y -= OFFY + y += STEPY/2 + if (x & 1) == 1: + y -= STEPY/2 + y /= STEPY + + i = (x * 2) + j = (y * 2) + (x & 1) + if i >= WAYPOINTS_NBX: + return None + if j >= WAYPOINTS_NBY: + return None + + if (i & 1) == 0: + y = OFFSET_CORN_Y + else: + y = OFFSET_CORN_Y + STEP_CORN_Y/2 + y += (j * STEP_CORN_Y) + + x = OFFSET_CORN_X + (i * STEP_CORN_X) + + return x, y + + def build_area(ax): # area x,y = build_poly([(0,0), (3000,0), (3000,2100), (0,2100)]) @@ -180,6 +214,8 @@ def build_area(ax): x,y = build_poly([(740,0), (740,500), (2260,500), (2260,0)]) ax.plot(x, y, 'g--') + """ + # courbes a 2 balles x,y = build_path([(375,0), (375,2050)]) ax.plot(x, y, 'r-') @@ -202,6 +238,21 @@ def build_area(ax): alpha=0.5, facecolor=(1.,0.,0.)) ax.add_collection(p) + """ + + """ + #courbes a 2 balles 50 + for xx in range(0, 3000, 100): + print xx + for yy in range(0, 2100, 100): + pouet = nearest_corn(xx, yy) + if pouet == None: + continue + xxx, yyy = pouet + x,y = build_path([(xx,yy), (xxx,yyy)]) + ax.plot(x, y, 'r-') + """ + # limit #x,y = build_poly([(250,250), (2750,250), (2750,1850), (250,1850)]) #ax.plot(x, y, 'g--')