#print(line|segment) import mycolors import math ps = [Point(-1, -1), Point(1, -1), Point(1, 1), Point(-1, 1)] f = Form(ps) while surface.open: surface.check() surface.control() surface.clear() surface.show() position = tuple(surface.point()) p = Point(*position) h = HalfLine(p, 0) ps = f.crossHalfLine(h) print(ps) f.color = mycolors.WHITE if p in f: f.color = mycolors.RED if len(ps) % 2 == 1: f.color = mycolors.ORANGE h.show(surface) f.show(surface) surface.flip()
while window.open: window.check() window.clear() window.draw.control() v1.rotate(0.1) v2 = v1 % (pi / 2) v2.color = GREEN v2.rotate(0.1) f2.rotate(0.1) center = f2.center() center.color = BLUE #center.radius=0.1 A = v1(center) window.draw.show() center.show(window) v1.show(center, window) v2.show(A, window) f2.show(window) window.flip() #Segment(f[0],f[1],color=(255,0,0)).center().show(window) #print(p4 in f) #window.clear() #p4.show(window) #a=Line(p4,p2,color=(255,0,0)) #b=Segment(p1,p3,color=(255,255,0)) #a.show(window) #b.show(window) #p=b|a #window() #a=Vector(1,5)