Page 1 of 1

Little problem with stopping recursion

Posted: Mon Jan 30, 2006 5:55 am
by Alexander
Hey,

I'm really new to fractals, so forgive me if this is obvious.


I have made this fractal and it goes on and on.

Code: Select all

startshape TREE

rule TREE {
	SQUARE { }
}

rule SQUARE {
	CIRCLE { }
	SQUARE { y .95 s .99 }
}

rule SQUARE 0.03 {
	CIRCLE { }
	SQUARE { r 30}
	SQUARE { r -6 }
	SQUARE { r 6 }
}
Any way to stop this from continuing ?

Thanks,

Alexander

Posted: Mon Jan 30, 2006 6:56 am
by momo
you can try setting a size to your SQUARE rules or using a stop rule like this:

Code: Select all

rule SQUARE 0.07 { }
Anyway, setting the size for your SQUARE makes it look better.

Posted: Mon Jan 30, 2006 7:08 am
by Alexander
hey thx alot momo,

This is what I came up with as my own solution.

Code: Select all

startshape TREE

rule TREE {
	SQUARE { hue 100 sat 1  b 0.3 }
}

rule SQUARE {
	CIRCLE { }
	SQUARE { y .95 s .99 hue 0.2 sat 1  b 0.3  }
}



rule SQUARE 0.0185 {
	CIRCLE { }
	SQUARE { r 30 }
	SQUARE { r -30 }
}

I'll give yours a try in a sec, it's appreciated ;) !

Posted: Mon Jan 30, 2006 10:57 am
by MtnViewJohn
Your first cfdg file is too "branchy": Your second SQUARE rule was generating new SQUAREs faster than your first SQUARE rule was getting rid of them. You can fix this either by reducing the "branchiness" of the second SQUARE rule or make the first SQUARE rule shrink faster.

Your second cfdg file decreased the branchiness of the second rule by decreasing the rule weight and decreasing the number of SQUARE shapes in it. Or you could have left the second SQUARE rule as it was and tweak the first one slightly:

Code: Select all

rule SQUARE {
   CIRCLE { }
   SQUARE { y .95 s .975 }
}

Posted: Thu Feb 02, 2006 3:24 pm
by Alexander
ofc.. never noticed, thanks !