def mouse_ctrlclick(start, mouse_pos): """ #create line with random angle #use unit vector with scalar and a starting point #u = v/||v|| random angle could maby be found with using formula for angle of vectors with dotproducts where one of the vectors could be the x axis |v|*|w|*cos(theta) #will need an angle in gradients to be able to paint """ color = (0, 0, 0) direction_vector = mouse_pos - start length = math.sqrt(direction_vector.x**2 + direction_vector.y**2) Entities.spawn_line(start, direction_vector, length, Physics.Vec2(0, 0), Physics.Vec2(0, 0), 10, color, direction_vector.angle())
def mouse_ctrlclick(self, mouse_pos): """ #create line with random angle #use unit vector with scalar and a starting point #u = v/||v|| random angle could maby be found with using formula for angle of vectors with dotproducts where one of the vectors could be the x axis |v|*|w|*cos(theta) #will need an angle in gradients to be able to paint """ length = random.randint(1, 200) color = (0, 0, 0) angle = random.randint(0, 180) direction_vector = Physics.Vec2(math.sin(angle)*length, math.cos(angle)*length) start = Physics.Vec2(mouse_pos[0], mouse_pos[1]) Entities.spawn_line(start, direction_vector, length, Physics.Vec2(0, 0), Physics.Vec2(0, 0), 10, color, angle)
def init(): start = Physics.Vec2(0, (window.height/5)*4) stop = Physics.Vec2(window.width, (window.height/5)*4) dir = stop - start Entities.spawn_line(start, dir, dir.length(), Physics.Vec2(0, 0), Physics.Vec2(0, 0), 10, None, dir.angle(), mod=Entities.Object.FIXED)