FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Automated Systems
(Moderator: REAS)
   simple gravity sketches
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: simple gravity sketches  (Read 3587 times)
Andrew

WWW
simple gravity sketches
« on: Dec 14th, 2003, 8:54am »

http://www.andrewchilds.com/p5/6/
 
these are all thanks to the ideas found in the OOP tutorial by Ariel Malka.  my code is certainly nothing worth looking at, but I feel forced to put it up, so here it is!
 
andrew
 
-----
 
http://www.andrewchilds.com/p5/6/lines_4.pde
 
http://www.andrewchilds.com/p5/6/lines_5.pde
 
http://www.andrewchilds.com/p5/6/lines_6b.pde
 
http://www.andrewchilds.com/p5/6/lines_7.pde
 
http://www.andrewchilds.com/p5/6/lines_7b.pde
 
arielm

WWW
Re: simple gravity sketches
« Reply #1 on: Dec 14th, 2003, 9:31pm »

nice!
 
concerning my oop tutorial: i didn't talk about the "constructor" concept, which can be quite useful,
 
here's how it can be applied to your "lines_7b.pde" example:
 
when you initialize your object-instances, it goes like:
Code:
 for (int i = 0; i < count; i++) {
    myThings[i] = new Thing();
    myThings[i].x = random(0, width);
    myThings[i].y = random(0, height);
    myThings[i].init_x = myThings[i].x;
    myThings[i].init_y = myThings[i].y;
    myThings[i].x2 = myThings[i].x;
    myThings[i].y2 = myThings[i].y;
    myThings[i].x3 = myThings[i].x;
    myThings[i].y3 = myThings[i].y;
    myThings[i].make_color();
    myThings[i].this_thing = i;
  }

 
instead, you could have a "constructor", placed inside your class declaration, as follow:
Code:
Thing(float myX, float myY, int myI)
{
  x = init_x = x2 = x3 = myX;
  y = init_y = y2 = y3 = myY;
  make_color();
  this_thing = myI;
}

 
then, in order to initialize your object instances, it would go as follow:
Code:
for (int i = 0; i < count; i++) {
  myThings[i] = new Thing(random(0, width), random(0, height), i);
}

useful no?
 

Ariel Malka | www.chronotext.org
REAS


WWW
Re: simple gravity sketches
« Reply #2 on: Dec 16th, 2003, 7:12pm »

I'm a fan of #3.
 
Andrew

WWW
Re: simple gravity sketches
« Reply #3 on: Dec 17th, 2003, 11:08am »

really?  I thought that was the worst one.  I guess I've always preferred things that (at least try to) disguise what's actually happening and that one sort of just lets it all hang out there... some latent programming-confidence-issues maybe. hah!
 
hey, thanks so much for your help (again) ariel.  that really does clean things up,
 
andrew
 
mflux

fluxhavoc WWW
Re: simple gravity sketches
« Reply #4 on: Dec 19th, 2003, 3:09pm »

I like 7.
 
Questor


Re: simple gravity sketches
« Reply #5 on: Dec 28th, 2003, 3:34am »

I liked 3 very much as well, very modern art-esque.
 
The dark ones are also eerily cool.
 
Awesome!
 
Pages: 1 

« Previous topic | Next topic »