Closedown
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from plotutils import *
|
||||
|
||||
def plot_base_plate(title = None):
|
||||
def plot_base_plate(points = None, title = None):
|
||||
colors = (Color.RED, Color.BLUE, Color.MAGENTA, Color(128,0,128), Color(0,128,0), Color(255,128,0))
|
||||
p = plot(None, title=title)[0]
|
||||
plot_circle(p, 0, 0, PLATE_SIZE/2, width = 0, color = Color.GRAY, name = "Plate")
|
||||
plot_point(p, 0, 0, size = 10, color = Color.GRAY, name = "Center")
|
||||
#p.setLegendVisible(True)
|
||||
for block in get_blocks():
|
||||
@@ -26,30 +27,22 @@ def plot_base_plate(title = None):
|
||||
plot_circle(p, xm, ym, LED_TOLERANCE, width = 0, color = r.color, name = str(puck.number)+"mc")
|
||||
p.addText((xu+xm)/2, (yu+ym)/2, str(puck.number), r.color)
|
||||
plot_circle(p, xm, ym, PUCK_SIZE/2, width = 0, color = Color.GRAY, name = str(puck.number))
|
||||
|
||||
|
||||
def plot_cross(plot, x, y, size = 3, width = 1, color = None, name = "Cross"):
|
||||
s = LinePlotSeries(name, color)
|
||||
plot.addSeries(s)
|
||||
s.setLineWidth(width)
|
||||
s.setPointsVisible(False)
|
||||
s.appendData(x-size/2, y)
|
||||
s.appendData(x+size/2, y)
|
||||
s.appendData(float('nan'), float('nan'))
|
||||
s.appendData(x, y-size/2)
|
||||
s.appendData(x, y+size/2)
|
||||
return s
|
||||
|
||||
def plot_detected_leds(points):
|
||||
for point in points:
|
||||
plot_cross(p,point[0], point[1], size = 5, width = 1, color = Color.BLACK, name = "P"+ str(points().index(point)))
|
||||
#plot_point(p, xu, yu, size = 8, color = Color.BLACK, name = str(puck.number)+"u")
|
||||
if points is not None:
|
||||
for point in points:
|
||||
c = Color.GRAY
|
||||
for puck in get_pucks():
|
||||
if puck.match(point[0], point[1]) is not None:
|
||||
c = Color.BLACK
|
||||
|
||||
plot_cross(p,point[0], point[1], size = 10, width = 1, color = c, name = "P"+ str(points.index(point)))
|
||||
#plot_point(p,point[0], point[1], size = 5, color = Color.BLACK, name = "Pc"+ str(points.index(point)))
|
||||
|
||||
|
||||
plot_base_plate()
|
||||
|
||||
points = [(100, 140), (130, 77), (120, 130), (110, 100)]
|
||||
plot_base_plate(points)
|
||||
|
||||
|
||||
points = [(100, 140), (120, 77), (120, 130), (110, 100))]
|
||||
plot_detected_leds(points)
|
||||
|
||||
#plot_detected_leds(points)
|
||||
|
||||
Reference in New Issue
Block a user