We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionGeneral Discussion,  Status › First Impressions
Page Index Toggle Pages: 1
First Impressions (Read 681 times)
First Impressions
Dec 3rd, 2008, 5:45am
 
About two hours ago, I installed Processing on my Mac. I figured you guys might want some input from a new user.

Install: Easy and standard.

IDE: Simple, took only a few seconds to understand.

Help: I tried the menu, I got what I wanted.

Syntax etc.: Reference seemed good enough, though something a tad more advanced than getting started up front would be nice (Throw a block of code with some variables, ifs and a loop at the end?). It took me a bit to relaize how to to do if statements and loops; and that was found by scanning the referance. I did not read much so it may be there, but a not on the aparent case sensitivity would be good if missing.

Results: I implimented a fractal generator with some user input. Heres my code: (Just click 3 points in a triangle to get started)

void setup() {
 //import processing.opengl.*;
 size(400, 400, P2D);
 background(0, 0, 0);
 stroke(50,50,50);
}

float[] px = new float[0];
float[] py = new float[0];
float v = 0;

float x = 0;
float y = 0;

boolean done=false;

void draw() {
 if (!done && px.length>0){  
   for (int i = 0; i < 5000 && !done; i = i+1) {
     int p = round (random(0,px.length-1));
     //print ("x");
     x=(x-px[p])/2+px[p];
     y=(y-py[p])/2+py[p];
     color c=get(round(x),round(y));
     v=red(c)+1;
     //print (nf(v,3,3));
     if (v>255){
       done=true;
       v=255;
     }
     set(round(x),round(y),color(v,v,v));
   }
 }
 
}

void mousePressed() {
 background(0, 0, 0);
 px=append (px,mouseX);
 py=append (py,mouseY);
 x=mouseX;
 y=mouseY;
 done=false;
}

void keyPressed() {
 if (key == 'c') {
   px = new float[0];
   py = new float[0];
   background(0, 0, 0);
 } else if (key == '0') {
   background(0, 0, 0);
   done=false;
 }
}


The similar native app builds I made with RealBasic are over on my site at:
http://www.spincraftsoftware.com/FractalChaos.html


I'll be improving. I just need to add some GUI controlls for adjusting stuff, and maybe even comment my code...

Thanks, looks like processing is a great and easy to use and free tool.


Edit, about 4 hours in now with much better code (below). Use "c" to clear, and numbers for other stuff. Dragging on the bottom bar also works. Makes fractals via modified chaos game algorithm, enjoy.


Edit2: Code removed (its long), applet hosted at: http://fg.98115.net:4520/~max/processing/applet/
Re: First Impressions
Reply #1 - Dec 4th, 2008, 1:22am
 
hey! nice Sierpinski's triangle.  glad to hear you are liking Processing.
Re: First Impressions
Reply #2 - Dec 4th, 2008, 4:48am
 
Thanks. New version is up at:
http://fg.98115.net:4520/~max/processing/applet2/

It works pretty well I think, but I'm having an issue. The web version is different from the jar version ( compare above to http://fg.98115.net:4520/~max/processing/applet2/Chaos_Game3.jar )

The jar has my bottom controls bar, but when viewed with the index.html file in a browser ( I tried safari and Firefox on mac) the bar is gone!

Thanks!
Re: First Impressions
Reply #3 - Dec 5th, 2008, 12:25pm
 
Your line:
size(800, 800+guiHeight, P2D);

size() reference: "The size() function must be the first line in setup(). [...] Do not use variables as the parameters to size() command, because it will cause problems when exporting your sketch."

I did the same error in lot of my early sketches, using constants for width and height of sketch, instead of using the corresponding built-in variables.

The processor tries to see the size of your sketch, to put it in the index.html file. If you have only constants, like in my code, it cannot see it so it just uses the default of 100x100 (rather small!). In your case, it sees numbers, not the additional height, so it just use these numbers. A more subtle bug... Smiley
Re: First Impressions
Reply #4 - Dec 5th, 2008, 11:46pm
 
Excellent, now I know my bug, and it is easy to fix. Thanks!
Page Index Toggle Pages: 1