Ejemplo n.º 1
0
class TouchVisualisation(Visualisation):
	def __init__(self, **kwargs):
		super(TouchVisualisation, self).__init__(**kwargs)
		self.touch = TouchStream()
		self.touch.start()
		
	def visualise(self, ticks):
		graphx.colors.set_color(0.0,0.0,0.0)
		graphx.draw.drawRectangle((self.x,self.y), (self.width, self.height))
		self.fg_color = (1.0, 1.0, 1.0)
		graphx.colors.set_color(*self.fg_color)
		val = 100
		
		touches = self.touch.isTouch()
		
		if (len(touches) > 0):
			for each in touches:
				draw_line(each)
				
		int_points = []		
				
		for each1 in touches:
			for each2 in touches:
				ret =  gareth.line_intersection(each1[0][0], each1[0][1], each1[1][0], each1[1][1], each2[0][0], each2[0][1], each2[1][0], each2[1][1])
				if (len(ret) > 1):
					int_points.append((ret[0], ret[1]))
				
		for each in int_points:
			graphx.draw.drawCircle((each[0], each[1] + 200), 5)
Ejemplo n.º 2
0
	def __init__(self, **kwargs):
		super(TouchVisualisation, self).__init__(**kwargs)
		self.touch = TouchStream()
		self.touch.start()