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)
def setup():
    p.size(400, 400)
    p.smooth()
    global mover
    mover = Mover()
Beispiel #4
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()
def setup():
	p.size(800,200)
	p.smooth()
	global m
	m = Mover()
def setup():
	p.size(800,200)
	p.smooth()
	global m, a
	m = Mover()
	a = Attractor()
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()
	p.frameRate(60)
def setup():
	p.size(400,400)
	p.smooth()
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.background(255)
	p.smooth()
def setup():
	p.size(800,200)
	p.smooth()
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)]
def setup():
    p.size(600, 600)
    p.smooth()
    global movers
    movers = [Mover() for i in range(0, 20)]
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
	movers = [Mover(uniform(0.1,4),0,0) for i in range(0,20)]