The following project explores the use of the Space Colonization Algorithm for tree generation and goes forward to use
The project follows some of the notions outlied in Modeling Trees with a Space Colonization Algorithm, 2007; Modeling the Mighty Mapple, 1985; Generating a 3D growing tree using a space colonization algorithm, 2019; and The Continuity of Splines, 2022.
In order to avoid repeated computation and accelerate the tree skeleton generation, on every iteration only those nodes that have been associated to one or more attractors will be visited when generating new nodes, instead of visiting all of the attractors. In cases were several attractors have been associated to a singular node, this reduces the amount of times a node is visited.
To accelerate the BSplines, as I am using a uniform BSplines, my basis functions stay the same accross the whole curve and thus I could build a matrix to represent the curve in its matrix form, that would stay consistent along the whole curve. In order for the curve to achieve
As the radiuses will be computed recursively, in order to avoid repeated computation, I use memoization, by saving each computed radius in its corresponings node inner data.
In order to add volume to our tree we will be using generalized cylinders. The cylinder will be made up of circles centered on each node and porjected on the plane whose normal vector is the vector tangent to the skeleton at the coordinates of the given node.
In order to do project each circle on its respective plane, we will be calculating two basis vectors in that plane. We will do so by rotating the vectors
We will use the following procedure to calculate the quaternion representing the rotation from un vector to another one:
In order to ensure that the application is still running and able to be closed if the tree generation algorithm runs into an infinite loop. To achieve this, the program calls on a "control thread" with the task of generating the tree skeleton and the tree cylinders.