def pattern_circle(
        scale=1,
        n_points=100,
        color=(1, 1, 1, 1),
):
    p = []
    for i in range(n_points):
        a = 2 * math.pi / n_points * i
        p.append(make_point(scale * math.cos(a), scale * math.sin(a), *color))
    return Helios.Frame(*p)
Exemplo n.º 2
0
            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.
        mat = matrix.keystone(cfg.keystonex / 4095, cfg.keystoney / 4095, 2047,
                              2047) * mat  # 7. apply keystone correction
        square = transform(square, mat)

        square = interpolate(square, cfg.interpolation, close=True)
        square = barrel_distort(
            square, cfg.barrel, 2047, 2047
        )  # use this on interpolated points, this transform doesn't preserve straight lines
        frame = Helios.Frame(*square)
        # frame = Helios.Frame( make_point(1, 1) )
        if 'fps' in cfg and cfg.fps > 0: pps = len(frame) * cfg.fps
        else: pps = cfg.pps
        pps = min(pps, 24000)  # limit this
        new_info = {
            'points': len(frame),
            'pps': pps,
            'fps': int(pps / len(frame))
        }
        if new_info != info:
            info = new_info
            print(
                f'points: {info["points"]}, pps: {info["pps"]}, fps: {info["fps"]}'
            )
        Helios.WriteFrame(0, pps, Helios.FLAGS_DEFAULT, frame, len(frame))
Exemplo n.º 3
0
        bri = cfg.brightness
        
        art = test_pattern1()
        art = interpolate_linestrips( art, cfg.interpolation, color=scale_color(cfg.color,bri), color_off=scale_color(cfg.color_off,bri) )
        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.
        mat = matrix.keystone(cfg.keystonex/4095, cfg.keystoney/4095, 2047, 2047) * mat # 7. apply keystone correction
        art = transform( art, mat )
        art = barrel_distort(art, cfg.barrel, 2047, 2047) # use this on interpolated points, this transform doesn't preserve straight lines
        frame = Helios.Frame(*art)
        
        if 'fps' in cfg and cfg.fps > 0: pps = len(frame) * cfg.fps
        else: pps = cfg.pps
        pps = min(pps, 24000) # limit this
        color_shift = int(pps/10000*cfg.color_shift)
        new_info = { 'points':len(frame), 'pps':pps, 'fps':int(pps/len(frame)), 'color_shift':color_shift }
        if new_info != info:
            info = new_info
            print(f'points: {info["points"]}, pps: {info["pps"]}, fps: {info["fps"]}, color_shift: {info["color_shift"]}')
            
        frame = color_shift_frame(frame, color_shift)
        Helios.WriteFrame(0, pps, Helios.FLAGS_DEFAULT, frame, len(frame))
        
        config.update(1)
except KeyboardInterrupt: