points = [p1, p3, p2, p4] f = Form([ Point(random.randint(-10, 10), random.randint(-10, 10)) for i in range(10) ]) #f.show(window) f2 = f.getSparse() p1.show(window) p2.show(window) v1 = Vector(p2[0] - p1[0], p2[1] - p1[1], color=(255, 0, 0)) 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)
from myabstract import Form, Segment, Line, Vector, Point from mysurface import Surface surface = Surface(name="Test") #line=Line.random() #segment=Segment.random() #print(line|segment) import mycolors import math vector = Vector(1, 0) point = Point(0, 0) while surface.open: surface.check() surface.control() surface.clear() surface.show() vector.rotate(0.1) a = vector.angle wl = mycolors.bijection(a, [-math.pi, math.pi], [380, 780]) c = mycolors.setFromWavelength(wl) vector.show(surface, point, color=c) surface.console("angle: ", str(a), nmax=20) #surface.print('something',(10,10),size=100,conversion=False) surface.flip()