n = int(d / step_size ) # number of interpolated points (including start and end) if n < 2: n = 2 # include at least start and end for j in range(n): a = j / (n - 1) # interpolation parameter [0, 1] attrs = interp_attrs(['x', 'y', 'r', 'g', 'b', 'i'], p0, p1, a) out.append(Helios.Point(*attrs)) # print(a, attrs) # print(i, d, n) return out try: info = {'points': 0, 'pps': 0, 'fps': 0} while True: while Helios.GetStatus(0) is not 1: time.sleep(1 / 1000) # wait 1 ms bri = cfg.brightness # square = make_square(cfg.size, (cfg.r*bri, cfg.g*bri, cfg.b*bri, 1)) square = p mat = ( matrix.translate(cfg.translatex * 2047, cfg.translatey * 2047) * # 3. apply translation matrix.rotate(cfg.rotate, 2047, 2047) * # 2. apply rotatioin matrix.scale(cfg.scalex, cfg.scaley, 2047, 2047) # 1. apply scaling ) if cfg.swapxy: mat = matrix.swapxy() * mat # 4. if cfg.flipx: mat = matrix.flipx(2047) * mat # 5. if cfg.flipy: mat = matrix.flipy(2047) * mat # 6.
POINTS = 300 SCALE = 0.2 COLOR_SHIFT = 2 patterns = [ pattern_orientation(SCALE, POINTS), pattern_measure_sq(SCALE, POINTS), pattern_measure_x(SCALE, POINTS), pattern_measure(SCALE, POINTS), pattern_colors(SCALE, POINTS), ] try: current = 0 print('press enter to switch patterns. press Ctrl-C to exit.') while True: pattern = patterns[current] pattern = color_shift_frame(pattern, COLOR_SHIFT) while Helios.GetStatus(0) != 1: time.sleep(1 / 1000) # wait 1 ms Helios.WriteFrame(0, PPS, Helios.FLAGS_DEFAULT, pattern, len(pattern)) input() current += 1 current = current % len(patterns) except KeyboardInterrupt: Helios.Stop(0) Helios.SetShutter(0, 0) Helios.CloseDevices() exit()