diff --git a/script/test/MultiplePlot.py b/script/test/MultiplePlot.py index 1ce9c93..a397ced 100644 --- a/script/test/MultiplePlot.py +++ b/script/test/MultiplePlot.py @@ -26,18 +26,22 @@ def add_plot(x,y, name=None, clear = False): s.setLinesVisible(False) s.setPointSize(3) s.setData(x, y) - - #Bounding box - x1,x2,y1,y2 = min(x), max(x), min(y), max(y) + + #Convex Hull #In the first time the plot shows, it takes some time for the color to be assigned while s.color is None: time.sleep(0.001) - bb = LinePlotSeries(name + " BBox", s.color) - p.addSeries(bb) - bb.setLineWidth(2) - bb.setData([x1,x2, x2, x1, x1], [y1, y1, y2, y2, y1]) - - + hull = LinePlotSeries(name + " Hull", s.color) + p.addSeries(hull) + #Bounding box + #x1,x2,y1,y2 = min(x), max(x), min(y), max(y) + #(hx,hy) = ([x1,x2, x2, x1, x1], [y1, y1, y2, y2, y1]) + (hx,hy) = convex_hull(x=x, y=y) + hx.append(hx[0]); hy.append(hy[0]) + hull.setLineWidth(2) + hull.setData(hx,hy) + hull.setColor(s.color) + clear_plot() x=[]