Ex Nihilo

A Processing Sketch Blog

Posts Tagged ‘Bezier’

Recursive Trees

Friday, July 31st, 2009

I spent the better part of this past week trying my hand at creating a decent-looking recursive tree, in between all the sweating this heat wave is causing.


Maybe it’s the heat but I think I’m ready to throw in the towel. I got the recursion working reasonably well, but the branch curves look terrible, and most of the logical adjustments I wanted to make ended up in division by zero for some reason I couldn’t track down.

Like, a for loop starting from zero and incrementing i on each iteration; I get that for the first iteration i = 0 so you’d think this equation should work, right?

    variation = multiplier / (i + 1);

But no such luck. “Division by zero” error. My actual code is more complicated of course, but that’s the essence of it; the loop is just not behaving as I’d have expected.

So I think for now it’s time to put this sketch to bed and move on to something else. Shame, I had some interesting things I wanted to do with the trees eventually.

Tags: , ,
Posted in Bezier, Recursion | 4 Comments »

Bezier Stalks

Friday, July 24th, 2009

So after yesterday’s Bezier celebration I thought I’d try a more structured approach and see if I couldn’t capture some interesting movement. Reducing the number of objects down to 3600 and plotting them along a grid as a start, I got the end points and curves moving along Perlin-assisted paths in kind of a wind-blown look.

Still all in 3D space of course, so I saved out a quick capture with some viewpoint shifts and generated palettes. (With the latter you can pretty clearly see that not everything that’s generated is usable since I have to cycle through a few different palettes before I get something decent).

Tags: , , ,
Posted in Bezier | No Comments »

Bezier Blossoms

Thursday, July 23rd, 2009

Bezier curves are hard enough to get the hang of in a graphics program with visual handles, but plotting the handles in 3D space is a whole new ball of wax.

I played around a bit tonight with about 80,000 of them by rotating from the origin and randomizing both the endpoint and the end handle of each curve with Perlin noise. The results are neat:


By keeping track of the coordinates of each line I can manipulate the entire blossom in 3D space, though at 80,000 lines it’s a pretty slow refresh. I added an animation loop too, to get each line swaying a little; it works well with a few thousand, but not when the numbers get this high.

I’m also sticking with this photo-generated palette idea; it’s a great way to get a bunch of interesting colours in a hurry that don’t clash too badly. I’ve upped the photo pool to 10, and one is selected randomly each time the palette is generated. Each of the above examples only uses 5 colours, but I can change that number to whatever; the previous example used something like 25.

Tags: , , , ,
Posted in Uncategorized | 2 Comments »