Random life.

les's picture

VIVA LA KINEME!

My task is to create with assistance of ITERAROR necessary quantity of dots with random coordinates X, Y, Z where each dot has its own life cycle T.

When T life cycle expires for any of generated dots its get regenerated with new X, Y, Z, T parameters

If there is such possibility to create necessary quantity of objects with personalized parameters and regeneration I would appreciate you advise in this respect.

Thanks!

franz's picture
Re: Random life.

quote: When T life cycle expires for any of generated dots its get regenerated with new X, Y, Z, T parameters

to me it sounds like particles.

les's picture
Re: Random life.

Yes, sure. But what if I need to generate objects like 3D spheres or cubes?

franz's picture
Re: Random life.

use javascript to do your logic,life,forces... output a structure with all the needed values, render any primitive you want with an iterator.

gtoledo3's picture
Re: Random life.

You could "get vertices" of a collada model, and use those as your starting positions.

idlefon's picture
Re: Random life.

As Franz said what you want is a particle system but since it was not a complicated particle system, I managed to simulate it via Java script patch. (file attached)

This comp calculates the random T (it's possible to make the T pre-defined). The published parameters are maxdepth, maxtime and quantity.

Enjoy! Please let me know if you had any problems!

PreviewAttachmentSize
Decaying points.qtz7.84 KB

idlefon's picture
Re: Random life.

By the way I forgot to credit Toneburst since the idea of making points in the JS patch comes from this post of his.

http://machinesdontcare.wordpress.com/2009/06/05/random-walk-bezier-java...

Also as George mentioned in addition to T, X/Y/Z too can be pre-defined.

dust's picture
Re: Random life.

you could check out the boids thread as well for some artificial life type of stuff. you know if you want the dots to interact or react to each other. seeing your doing random things you might want to incorporate a what happens if two are a certain distance apart and still alive to reposition them selfs maybe ?

idlefon's picture
Re: Random life.

That's right, Boids are pretty cool, but I think if one wants the dots ro react/collide JS is not appropriate. Correct me if I'm wrong but from what I;ve seen only OpenCL can take the intensity and complexity of the calculations.

usefuldesign.au's picture
Re: Random life.

That all depends on number of particles and hardware thrown at the problem ;-). Certainly OpenCL when it works is magnitudes of 10 faster at iterative calculations.

Memo and I found placing the Javascript patch inside the iterator (and there-by not outputting an array just one particle instance per iteration) is faster in Snow Leopard (& slower in Leopard).

Also consider using Kineme's Structured Renderer patch part of GL Tools to generate multiples of whatever 3D primitive you want. It gets fed a structure with position, scale and rotation all as vec3.

If you do want to do per particle comparisons the array.sort(a,b) method may come in handy to speed things up. Being 3D points it may not be so helpful either, you could:

      // Pseudo code
   sort particle array "P" by X pos;
   limit = {x:0.01, y:0.04, z:0.1}
   for (i in P);
   {
      hit=false;
      step=1;
      unfinished=true;
      while unfinished
      {
         if abs(P[i].Xpos - P[i+step].Xpos) <limit.x 
         {   if abs(P[i].Ypos - P[i+step].Ypos <limit.y)
            {    if abs(P[i].Zpos - P[i+step].Zpos <limit.z)
               {   hit = avoidance_or_gravity_logic (i, i+step) } // always returns true
               }
            }
         if !hit {unfinished=false}
         }
      step++;
      }
   }

idlefon's picture
Re: Random life.

usefuldesign.au wrote:
Memo and I found placing the Javascript patch inside the iterator (and there-by not outputting an array just one particle instance per iteration) is faster in Snow Leopard (& slower in Leopard).

That's true. JS in iterators runs much more smoothly.

les's picture
Re: Random life.

Please accept my sincere apology for not being able to revert to you earlier due to daily routine. Many thanks for your recommendation and wishing you fast coding.

VIVA LA KINEME!