149047
YaBB Newbies
Offline
Posts: 7
newbie code issues
May 13th , 2008, 10:22pm
hi everyone! a couple of very simple questions if i may: 1)the below code is my very first processing experiment and it renders a bifurcation graph. now, where is the trick to make it look a little less "DOS"-like and mabye a little more like this: http://images.google.at/imgres?imgurl=http://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/LogisticMap_BifurcationDiagram.png/512px-LogisticMap_BifurcationDiagram.png&imgrefurl=http://en.wikipedia.org/wiki/Logistic_map&h=362&w=512&sz=53&hl=de&start=25&um=1&tbnid=oH5Gn_N4X35L5M:&tbnh=93&tbnw=131&prev=/images%3Fq%3Dbifurcation%26start%3D18%26ndsp%3D18%26um%3D1%26hl%3Dde%26client%3Dfirefox-a%26rls%3Dorg.mozilla:de:official%26sa%3DN or this: http://ccrma.stanford.edu/~blackrse/LogisticMap_BifurcationDiagram.png both appear beautifully smooth and show no "pixels" like my version does. anyone have an idea here? 2) the OPENGL mode does weird things with my code. it shows only the outlines of the graph .... weird .... / any clues? thanx for your time markus www.humanchaos.net import processing.opengl.*; float rotX; float rotY; float r0=1; float rmax=4; float n=.5; float detail=.0001; float x,y; void setup(){ //OPENGL does not really seem to work with this setup ...??? size(800,600,P3D); //OPENGL); //frameRate(120); } void draw(){ background(0); translate(width/2,height/2, mouseY); //rotation //rotateX(rotX+=.05); //rotateY(rotY+=.01); stroke(255); noFill(); //box(r0*100); point(0,0); stroke(100); line(0,height/2, 0, 0-height/2); line(width/2,0,0-height/2,0); //bifurcation stroke(255); for(float r=r0; r<rmax; r=r+detail){ n=r*n*(1-n); //println( " n " + n); if(n<0){ stroke(90); point(-(mouseX/7-(1-mouseX/(mouseX+1)))-10*r*(1-r),mouseY/10-n*80); } else{ stroke(255); point(-(mouseX/7-(1-mouseX/(mouseX+1)))-10*r*(1-r),mouseY/10-n*80); } } } if (mousePressed){ detail=detail/2; } }