Wednesday 16 May 2012

TRIALS WITH HARDER FILTER AND RANDOM IN CIRCLE

I stepped one more step to more complicated codes like random in circle and more advanced filtered random.

 Comment : The outcome is great, so random and fulfill. More interesting with these codes.
CODE :
------------------------------------------------------------------------------------------------------------------
import math

XRES = 600
YRES = 400
centerX = XRES/2
centerY = YRES/2
npts = 400

def setup():
    size(XRES, YRES)
    background(255)
    stroke(0)
    smooth()
   
randata = []
for i in range(XRES):
    randata = randata + [random(-100.,100.)]
   
def plot(data, yoff):
    for i in range(1, XRES):
        angle = PI*2
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        line(x,y,i,yoff+data[i])
       
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.9*(data[i-1] + data[i+1])
                           
       
def draw():
    filter(randata)
    if (40*frameCount)<(YRES+200):
        plot(randata, 40*frameCount)
------------------------------------------------------------------------------------------------------------------

Then I tried smaller amount on filtering like (0.5-0.6) the multiply the frameCount with 50.
 Comment : The outcome is much crazier. The lines are filling all the blank on the sketch, and making really crazy net.
CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 600
YRES = 400
centerX = XRES/2
centerY = YRES/2
npts = 400

def setup():
    size(XRES, YRES)
    background(255)
    stroke(0)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-100.,100.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        line(centerX+x,centerY+y,i/250,yoff+data[i])
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                      
      
def draw():
    filter(randata)
    if (50*frameCount)<(YRES+200):
        plot(randata, 50*frameCount)
------------------------------------------------------------------------------------------------------------------

The previous trial was crazy, but that with lines I wonder why not using ellipse shapes?
 Comment : This is an amazing outcome. Circles by circles, somehow I felt like I was 10k feet under the water where lots of bubbles surrounding me.
CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 600
YRES = 400
centerX = XRES/2
centerY = YRES/2
npts = 400

def setup():
    size(XRES, YRES)
    background(255)
    stroke(0)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-100.,100.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        ellipse(centerX+x,centerY+y,data[i],data[i])
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                      
      
def draw():
    filter(randata)
    if (50*frameCount)<(YRES+200):
        plot(randata, 50*frameCount)
------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment