Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from processing import *
- def setup():
- size(400,400)
- background(0)
- def f(x,y,w,h,l):
- def q(p):
- return y+(p-a)/(b-a)*h
- a,b = 1.0* min(l) ,1.0* max(l)
- x0 ,y0 = x,q(l[0])
- def draw():
- for i in range (1,len(l)):
- x1 = [x,x+w][i%2]
- y1 = q(l[i])
- line (x0 ,y0 ,x1 ,y1)
- x0 ,y0 = x1 ,y1
- for p in l:
- ellipse(x,q(p) ,10 ,10)
- ellipse(x+w,q(p) ,10 ,10)
- f(50 ,50 ,400 ,400 ,[3 ,1 ,0 ,2 ,4 ,3 ,5])
Add Comment
Please, Sign In to add comment