the program crashes (on Mac OS X). I know why - the program stops recursing when the shapes grow to small. My second example grows bigger and bigger, thus the size limit is never hit.
Are there some general programming rules for avoiding such mistakes, such as "Never scale up when recursing"?
An even better solution would be to throw a warning or stop rendering when a certain recursion limit is reached. Don't know if this is possible.
I admit that it is poor form to crash on this type of cfdg files. The general rule is that a recursive shape should always shrink the area of the shape. If you truly wish to grow recursively then you need to have a 'stopping' rule to terminate the recursion. Otherwise, as you saw, the recursion does not terminate and the program crashes.
No we don't stop when an already drawn shape shrinks below the drawing threshold. That seems like a good way to bail out on an ever-expanding cfdg file, but even ordinary cfdg files will have shapes that are drawn but later culled. We have thought about bailing out when the smallest drawn shape gets really small, well below the drawing threshold.