Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Building fractal tree with recursion

1. ## Building fractal tree with recursion

Hey guys,

i have the following question: I want to use StdDraw Library to draw a fractal tree using recursion like this:

fractal_tree.png.png

I think you understand the idea. But I need a hint, how I can grow the child-cubes recursively. My first idea : I calculate the left-top point of each cube and draw a new one. If the side-length lesser than e.g. 1, i return and to the right cube, doing the same. But then I have to recalculate the point to find the next branch - it's possible, but I'm afraid that's not the point of the exercise, because i have to do this 10000 times until the tree is done.

I understand the trigonometric calculations, i'm also able to build two branches recursively.... but how can I develop an algorithm who "knows" where the next branch starts? And knows that the cubes borns exponential??

Would be glad if somebody could give me a hint!

Best regards!

2. ## Re: Building fractal tree with recursion

Moved out of java coding section