def show(self,surface): """Show the branch to the surface.""" p=self.point() for c in self.children(): pc=c.point() s=Segment(p,pc) s.show(surface)
def show(self, context): """Show all the objects on screen.""" for object in self.objects: object.center.showMotion(context) object.show(context) l = len(self.objects) for i in range(l): for j in range(i + 1, l): points = self.objects[i].abstract | self.objects[j].abstract if points != []: self.objects[i].velocity *= 0 print(points) l1 = Segment(*points[:2]) l1.color = mycolors.GREEN l1.show(context) p = l1.center p.show(context, mode="cross", color=mycolors.RED) c1 = self.objects[i].center.abstract v = Vector.createFromTwoPoints(c1, p) v.color = mycolors.GREEN v.show(context, c1) v.norm = 1 v.color = mycolors.BLUE v.show(context, p) v.showText(context, p, 'up') v.rotate(math.pi / 2) v.show(context, p) v.showText(context, p, 'uo')
def show(self, surface, point): """Show the ray on the surface and stop at the given point.""" if point: object = Segment(self.point, point) else: object = HalfLine(self.point, self.angle) object.show(surface)
def showBar(self, context, t, l): """Show the bar.""" v = self.getVector() v *= l p = self(t) v.rotate(math.pi / 2) p1 = v(p) v.rotate(math.pi) p2 = v(p) s = Segment(p1, p2) s.color = self.color s.show(context)
def show(self, surface, points): """Show the angle between the points.""" p1, p2 = points #Need to be able to print arc of circles using pygame v1 = Vector.createFromTwoPoints(p1, p2) v1 = ~v1 v2 = v1 % self p3 = v2(p2) s1 = Segment(p1, p2) s2 = Segment(p2, p3) s1.show(surface) s2.show(surface)
s1.p2 = p if s1.crossSegment(s2): s1.color = mycolors.RED s2.color = mycolors.RED else: s1.color = mycolors.WHITE s2.color = mycolors.WHITE l1 = s1.getLine() l2 = s2.getLine() l1.color = mycolors.GREEN l1.width = 1 l2.color = mycolors.GREEN l2.width = 1 l1.show(surface) l2.show(surface) s1.show(surface) s2.show(surface) p1 = s1.center p1.show(surface, color=mycolors.RED) p.showText(surface, "p") p1.showText(surface, "p1") p2.showText(surface, "p2") p3.showText(surface, "p3") pl = l1.crossLine(l2) if pl: pl.show(surface, color=mycolors.RED, mode="cross", width=3) pl.showText(surface, "pl") print("in s1:", pl in s1) print("in s2:", pl in s2)