[OpenSCAD] Barnsley Fern recursive
doug at moens.org
Wed Sep 12 12:49:52 EDT 2018
Ronaldo said: " Anyway, as this fractal may be generated without recursion
be a preferable path to go."
Yes, but how do you code it without recursion in OpenSCAD?
The Barnsley Fern is an Iterated Function System, where the result at
depends on the result of iteration i.
The only language feature that supports this kind of iteration, without
is the C-style for loop, which is only available in list comprehensions,
not in modules.
For this, you need a development snapshot with the "C-style for" option
So, I would try generating all of the coordinates into a list, using a
C-style for loop
inside a list comprehension. And I'd use a simpler polygon for each point,
reduce resource consumption: like a triangle, square, or hexagon.
On 12 September 2018 at 11:42, Ronaldo <rcmpersiano at gmail.com> wrote:
> The probabilities in your code does not agree with the definition found in
> Wikipedia <https://en.wikipedia.org/wiki/Barnsley_fern> . Besides, a full
> recursion stop rule is missing in the recursive module so regardless the
> memory allocation size you will always get a stack overflow with
> one. Anyway, as this fractal may be generated without recursion that would
> be a preferable path to go. Finally, you would need a very large number of
> circles to get a reasonable picture of the fractal and this may surpass the
> limits of the OpenSCAD node tree.
> Sent from: http://forum.openscad.org/
> OpenSCAD mailing list
> Discuss at lists.openscad.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss