Sunday, October 7, 2012

DSDN 142: Plant Designs

I'm having massive difficulties with creating a tree growth code, so I'm thinking I'll look into other peoples code, since there is some simply fantastic stuff out there in terms of what people come up with.

The way that a lot of trees are coded I've found has to do with fractals. However, I want a much less uniform plant, so looking at fractal trees really won't be the best option. The way that I see trees growing is relatively random, with some fractal-based elements.

I found this code here, which I find is so simply beautiful.  When you click on the screen, a tree grows from where you click, before fading away after about 6 seconds. It's actually really really fascinating and I'm very intrigued by how the code functions.

The creator of the code built the code into many classes, with a class controlling the branch point creation, a plant controlling the growth, a class controlling the branches themselves, and then a final class that ties all of the other classes together into a coherent whole.

I've decided to splice some of the elements of this code in with my sun creation, because the way to actually create the trees and write that code is a little beyond me at present. What I'll take from this code is the bare tree growth, but I want to slow down the way the tree grows. I want it to be a very slow, more visible and controllable growth.

One of the things I have to create however is the code that will make the plants grow towards the suns in an aesthetically pleasing way. It shouldn't feel too contrived, nor should it feel way out of control. I might need help from the tutors for that part.

You can find the original code here.

No comments:

Post a Comment