Beispiel #1
0
def setup():
    size(100, 100)
    background(255)
    fill(0)
    stroke(0)
    stroke_weight(10)
    frame_rate(60)
def setup():
	p.size(800,200)
	p.smooth()
	p.frameRate(30)

	global w
	w = Walker()
def setup():
	p.size(800,200)
	p.smooth()
	p.background(255)

	global location, velocity
	location = p.PVector(100,100)
	velocity = p.PVector(2.5,5)
Beispiel #4
0
def setup():
    '''
    Invoked exactly once by pyprocessing.run().
    '''
    p.size(600,600,caption="Smart Home Multi-Modal Input")
    p.ellipseMode(p.CENTER)
    p.noStroke()

    start_thread(recognition, ('gesture',animation_q,))
    start_thread(speech_recognition, (animation_q,))
def setup():
    pyp.size(width, height)
    pyp.ellipseMode(pyp.CENTER)
    pyp.rectMode(pyp.CENTER)
    indicator_spacing = np.linspace(xcenter-indicator_width*num_actions/2, xcenter+indicator_width*num_actions/2,num_actions)
    print indicator_spacing
    for i in range(num_actions):
        indicators.append(Indicator(indicator_spacing[i], height-50))
    print indicators
    step_counter = 0
Beispiel #6
0
def setup():
    size(1000, 1000)
    show_grid()
    global actors
    actors = []

    urist = Dwarf()
    p_liner = Liner(pretty_lines)

    actors.append(urist)
    actors.append(p_liner)
Beispiel #7
0
def setup():
	p.size(400, 400)
	p.stroke(255)
Beispiel #8
0
def draw_screen(points, slopes, line_segments, arc_segments):
    # Setup processing
    import pyprocessing as proc

    proc.size(VIEW_WIDTH, VIEW_HEIGHT)
    proc.smooth()
    proc.background(255, 255, 255)
    proc.ellipseMode(proc.RADIUS)

    # Prepare camera
    bbox = BoundingBox(points)
    eye_x = bbox.min_x + bbox.width / 2.0
    eye_y = bbox.min_y + bbox.height / 2.0
    eye_z = (1.5 * max(bbox.width, bbox.height) / 2.0) / sin(radians(50))
    center_x = bbox.min_x + bbox.width / 2.0
    center_y = bbox.min_y + bbox.height / 2.0
    proc.camera(
        eye_x,
        eye_y,
        eye_z,
        center_x,
        center_y,
        0,
        0,
        1,
        0)

    if RENDER_CIRCLES:
        proc.noFill()
        proc.stroke(232, 232, 232)
        for arc in arc_segments:
            proc.ellipse(arc.c[0], arc.c[1], arc.r, arc.r)

    if RENDER_SLOPES:
        proc.stroke(127, 127, 127)
        for k in range(len(points)):
            if slopes[k]:
                p = points[k]
                s = slopes[k].vector / norm(slopes[k].vector)  # normalize
                x0 = p.x() - s[0] * SLOPE_LENGTH
                y0 = p.y() - s[1] * SLOPE_LENGTH
                x1 = p.x() + s[0] * SLOPE_LENGTH
                y1 = p.y() + s[1] * SLOPE_LENGTH
                proc.line(x0, y0, x1, y1)

    # line_segments
    proc.stroke(0, 0, 0, 255)
    for line in line_segments:
        proc.line(line.a.x(), line.a.y(), line.b.x(), line.b.y())

    # arc_segments
    proc.noFill()
    proc.stroke(255, 0, 0, 255)
    for arc in arc_segments:
        proc.arc(arc.c[0], arc.c[1], arc.r, arc.r, arc.alfa, arc.beta)

    # Points
    proc.fill(255, 0, 0)
    proc.stroke(0, 0, 0)
    for p in points:
        proc.rect(p.x() - BOX_WIDTH / 2.0, p.y() - BOX_WIDTH / 2.0, BOX_WIDTH, BOX_WIDTH)

    # Execute! :-)
    proc.run()
Beispiel #9
0
def setup():
	p.size(400, 400)
	p.rectMode(p.CENTER)
	p.noStroke()
Beispiel #10
0
def setup():
    size(640, 360)
    stroke(255)
    frame_rate(60)
    background(0)
Beispiel #11
0
#!/usr/bin/evn python
# coding=utf-8
"""
Composition. Square Limit.

"""
import math
import pyprocessing as p

p.size(800, 800)
p.background(255)
p.translate(300, 300)

img = p.loadImage("fish.png")

def fish():
	p.image(img, -80, -80)

def transform(t, *args):
	def wrapper(*args):
		def wrapped_f():
			p.pushMatrix()
			t(*args)  # perform transformation t
			args[-1]()  # call function f
			p.popMatrix()
		return wrapped_f
	return wrapper

@transform
def rotate(f):
	p.translate(0, 240)
def setup():
	p.size(800,200)
	p.smooth()
	p.frameRate(60)
def setup():
	p.size(400,400)
	p.smooth()
Beispiel #14
0
def setup():
	p.size(400, 400)
	p.colorMode(p.HSB, 360, 100, 100)
	p.fill(30, 100, 100)
	p.noStroke()
	p.noLoop()
Beispiel #15
0
def setup():
    pp.size(600, 600)
    global arcball
    arcball = ArcBall(width/2.0, height/2.0, min(width - 20, height - 20) * 0.5)
    arcball.axis = -1
Beispiel #16
0
def setup():
    global width, height
    pyp.size(width, height)
Beispiel #17
0
def setup():
	p.size(SIZE, SIZE)
	p.background(0)
def setup():
    p.size(600, 600)
    p.smooth()
    global movers
    movers = [Mover() for i in range(0, 20)]
Beispiel #19
0
def setup():
	p.size(SIZE, SIZE)
	p.noFill()
	p.stroke(255)
Beispiel #20
0
#!/usr/bin/evn python
# coding=utf-8
"""
Rings.

"""
import math
import random
import pyprocessing as p

COLOURS = [(45,25,100), (345,50,65), (10,60,90), (30,50,100)]

p.size (600, 200)
p.colorMode(p.HSB, 360, 100, 100)
p.noStroke()

def rings():
	p.background(292, 40, 30)

	for i in range(30):
		x = random.randint(0, 600)
		y = random.randint(0, 200)
		n = random.randint(3, 30)
		radius = random.randint(10, 100)
		size = random.randint(3, 15)
		colour = random.choice(COLOURS)

		p.fill(*colour)
		for i in range(n):
			angle = i * 2*math.pi / n
			new_x = x + math.cos(angle) * radius
def setup():
	p.size(800,200)
	p.smooth()
	global movers, a
	movers = [Mover(uniform(0.1,2), uniform(0,width), uniform(0,height)) for i in range(0,10)]
	a = Attractor()
def setup():
    p.size(800, 200)
    p.smooth()
    global movers, liquid
    reset()
    liquid = Liquid(0, height / 2, width, height / 2, 0.1)
def setup():
	p.size(800,200)
	p.smooth()
	global movers
	movers = [Mover(uniform(1,4), uniform(0,width), 0) for i in range(0,5)]
Beispiel #24
0
#!/usr/bin/evn python
# coding=utf-8
"""
Shapes.

"""
import pyprocessing as p

p.size(400, 500)  # screen width and height

# body
p.triangle(100, 410, 200, 200, 300, 410)  # 3 points (x,y)

# hands
p.ellipse(100, 300, 40, 40)  # centre point (x,y)
p.ellipse(300, 300, 40, 40)  # and size (width,height)

# face
p.ellipse(200, 180, 190, 200)

# mouth
p.line(183, 246, 245, 230)  # 2 points (x,y)

# frames
p.line(107, 163, 295, 163)

# lenses
p.rect(132, 150, 50, 40)  # top left corner (x,y)
p.rect(215, 150, 50, 40)  # and size (width,height)

p.run()
Beispiel #25
0
def setup():
    size(640, 360)
    stroke(255)
    frame_rate(30)
def setup():
	p.size(600,600)
	p.smooth()
	global movers
	movers = [Mover(uniform(0.1,2), uniform(0,width), uniform(0,height)) for i in range(0,10)]
def setup():
	p.size(800,200)
	p.smooth()
Beispiel #28
0
def setup():
    size(600, 500)
def setup():		
	p.size(800,200)
	p.background(255)
	p.smooth()
def setup():
	p.size(800,200)
	p.smooth()
	global m, a
	m = Mover()
	a = Attractor()
Beispiel #31
0
def setup():
    p.size(600, 200)
    p.colorMode(p.HSB, 360, 100, 100)
    p.noStroke()
    add(random.randint(0, 600), random.randint(0, 200))
def setup():
	p.size(800,200)
	p.smooth()
	global m
	m = Mover()
Beispiel #33
0
def setup():
	p.size(SIZE, SIZE)
	p.background(0)
	p.colorMode(p.HSB, 360, 100, 100)
def setup():
    p.size(400, 400)
    p.smooth()
    global mover
    mover = Mover()
Beispiel #35
0
#!/usr/bin/evn python
# coding=utf-8
"""
Recursion.

"""
import pyprocessing as p

p.size(400, 400)
p.noStroke()

def circle(x, radius, level):
	p.fill(126 * level / 4)
	p.ellipse(x, 200, radius * 2, radius * 2)

	if level > 1:
		circle(x - 0.5 * radius, 0.5 * radius, level - 1)
		circle(x + 0.5 * radius, 0.5 * radius, level - 1)

# TODO: try more/less levels
circle(200, 200, 6)

p.run()
Beispiel #36
0
from scipy.io import wavfile
from scipy.signal import blackman

import numpy as np
import math
from collections import defaultdict

from OSC import OSCServer, OSCClient, OSCMessage

import os

from time import time

N = 1024

p5.size(1024, 512)

client = OSCClient()
client.connect(('127.0.0.1', 9999))

recent = []
window = blackman(N)
vectors = []
labels = []

def getAmplitude(data):
	freq = sfft.fft(data * window)
	nyquist = len(freq)/2
	return np.absolute(freq[:nyquist])

clf = SVC(probability=True, kernel = 'rbf')
Beispiel #37
0
def setup():
	p.size(400, 400)
	p.strokeWeight(10)
	p.stroke(255, 200)