PDA

View Full Version : little math /xpresso issue


mm149047
05-15-2008, 11:29 AM
hi eveyone!

i would like to play with the "verhulst graph" (a simulation of biological growth) in c4d.
the graph looks something like this: http://images.google.de/imgres?imgurl=http://originoflife.net/bright_light/edge_of_chaos/graphics/bifurcation.png&imgrefurl=http://originoflife.net/bright_light/edge_of_chaos/index.html&h=499&w=496&sz=16&hl=de&start=7&sig2=8efRZM6JzRZwgG34gJxxXw&um=1&tbnid=0UojsF7Ml6Y6kM:&tbnh=130&tbnw=129&ei=chwsSLyPCYTGeu2P-bMK&prev=/images%3Fq%3Dbifurcation%26um%3D1%26hl%3Dde

now, can someone point me in the right direction as to how i can produce this graph in c4d?
i think i could be an easy xpresso task (not for me) ...
all the graph needs would be the following pseudo code:

for(r0=0 to rmax=4 // r=r+0.001)
n(0)=0.5
repeat n=r*n*(1-n)
draw(r,n)

hoping for help

thanx
markus

www.humanchaos.net

JamesMK
05-15-2008, 11:38 AM
The main question is what you would be plotting the graph with - cubes or something like that? Or vertices on an initially empty polygon object?

That said, it's unlikely to be possible to do with Xpresso. Even if it was, it would be a lot more painful than writing a Coffee script for it.

But the main issue remains: how to represent the plot points. After that's decided it should be fairly straight forward.

Srek
05-15-2008, 12:06 PM
I would use TP to generate an object of your choice at the given coordinates using PBorn and PSetData.
Cheers
Björn

mm149047
05-15-2008, 12:32 PM
The main question is what you would be plotting the graph with - cubes or something like that? Or vertices on an initially empty polygon object?

That said, it's unlikely to be possible to do with Xpresso. Even if it was, it would be a lot more painful than writing a Coffee script for it.

But the main issue remains: how to represent the plot points. After that's decided it should be fairly straight forward.

james! thank you for your quick reply. in fact i would like to work with splines if possible. the results (dots) should alltogether form thin tubes. the entire graph would look like a flat tree.
does that make sense?

markus

mm149047
05-15-2008, 12:33 PM
I would use TP to generate an object of your choice at the given coordinates using PBorn and PSetData.
Cheers
Björn

well, the coordinates need to be calculated first ... where would you do this?

Srek
05-15-2008, 12:48 PM
Calculations are usualy a bit faster in a COFFEE node or plugin than in Xpresso, so if you already plan to use some COFFEE i would att it there.
Cheers
Björn

mm149047
05-15-2008, 02:03 PM
dear c.o.f.f.e.e gurus ....
could someone point me in the right direction with this project? maybe some code lines ....??? i could desperately need some help here :)

thank you
markus

Darter
05-15-2008, 02:41 PM
Here's a COFFEE verson of your pseudocode:

main(doc,op)
{
var r, n = 500;

for(r = 0; r < 4000; r++)
{
n = r * n * (1000 - n);
}
}

All numbers have been multiplied by 1000 so that the for loop has integers for incrementation.

EDIT: This is assuming that you want n to be cumulative. Otherwise you'd have:

main(doc,op)
{
var r;

for(r = 0; r < 4000; r++)
{
var n = 500;
n = r * n * (1000 - n);
}
}

mm149047
05-15-2008, 08:58 PM
hurrayyy - :))
thanks david!
i managed to tweak and enhance the code. now - how do i get it to draw the results?
sorry for being noob ;)
markus

Darter
05-16-2008, 03:26 AM
Here's a solution using Srek's TP approach and your original formula.

The formula output is multiplied by 1000 for visibility. Things start to get exciting at around frame 1700.

Spline connections between the particles can be created with Mograph using a Tracer object. Tracing Mode is set to Connect Elements. Once splitting occurs, high and low values alternate between frames, causing zig-zagged connections. It should be possible to create a smooth branching pattern using 2 particle groups, one for each alternating set of frames.

mm149047
05-17-2008, 01:54 PM
Here's a solution using Srek's TP approach and your original formula.

The formula output is multiplied by 1000 for visibility. Things start to get exciting at around frame 1700.

Spline connections between the particles can be created with Mograph using a Tracer object. Tracing Mode is set to Connect Elements. Once splitting occurs, high and low values alternate between frames, causing zig-zagged connections. It should be possible to create a smooth branching pattern using 2 particle groups, one for each alternating set of frames.

darter!
that IS useful! thank you very, very much. the graph is coming alive :)
as to the tracer object: are you sure you'd set the mode to "connect elemtents"?
here's my setup:

sphere object follows coordinates
tracer (target = sphere)
tracer mode -> connect elemtents

is that what you meant?

markus

Darter
05-18-2008, 12:17 AM
The steps are:
Create a Tracer Object;
Drag particle groups into the Trace Link field;
Set Tracing Mode to Connect Elements.

Be sure to stop the animation before the last frame or the path will evaporate.

The Tracer object can be used directly in a Sweep NURBS or converted to a spline.

CGTalk Moderation
05-18-2008, 12:17 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.