# Algorithm to generate small tree-like branches?

I'd like to seed a void map with "branches" of sine waves or any other waveform. Something like:

Know of any algorithm? Has to be one to generate trees or something like that.

-
If you're looking for an actual tree rather than a non-uniform branching structure then you might like to look at L-Systems. Otherwise, you'll need to consider whether or not your tree structure is balanced, its depth and breadth limits, and whether or not branches can overlap. Does your root have to be in the center or at the bottom? Do branches have to follow some direction relative to their parent (i.e. always ending above the parent, or can they go anywhere)? – Martin Foot Dec 13 '11 at 20:44
Are you looking for a 2D or 3D algorithm? What do you mean by "small branches"? Why not just to use the approach you suggested with sinus functions spawned at certain random distances from each other? – Alexander Galkin Dec 13 '11 at 21:30

What is the ultimate purpose of this algorithm supposed to be? Do you want to generate random roads? Branches for a tree? In 2D or 3D space?

The best approach might be to put a bunch of random points on the map, then do a minimum spanning tree. You can then use quadratic or cubic interpolation to make the lines curve into eachother.

Alternately, if you want to generate a tree-like structure in 3-space, you should investigate quaternion rotations, and rotating points about an abitrary axis.

-
2D, seed a map to generate a continent with MPD algorithm. This "tree" would be a mountain/s range. – Gabriel A. Zorrilla Dec 13 '11 at 22:57
By MPD you mean Mid Point Displacement? Is this for the purpose of constructing and efficient mesh? You might also want to look at: codeflow.org/entries/2011/nov/10/… - the source is on github – Gavan Woolery Dec 15 '11 at 0:12

If the your usage is creating landscape (or trees themselves) you can also look into fractal generating algorithms for example:

-