# Genetic equation in 3D Update: please refer to this post for a detailed article

We can extend the Genetic Equation to higher dimensions. Remember that the two-dimensional exponential form of the Genetic Equation is: $C =\int_s D_{r} e^{i \int_s D _{varphi }}$

Or in trigonometric form: $C=\left\{\begin{matrix}x(s) \\ y(s)\end{matrix} \right\}=\left \{\begin{matrix} \int_s D_{r} {\sin}(\int_s D_{\varphi})\\\int_s D_{r}{\cos}(\int_s D_{\varphi})\end{matrix} \right\}$

Using the Spherical Coordinate system, we can write the Genetic Equation in the three dimensional form as shown below. We use a spherical coordinate system with radial distance r, azimuth $\varphi$ and inclination $\vartheta$. Refer to Wikipedia for a good description of this good but tricky coordinate system. $C= \left \{ \begin{matrix}x(s)\\ y(s)\\ z(s)\end{matrix} \right\}=\left \{ \begin{matrix}\int D_{r}\sin(\int_s D_{\varphi}ds)\sin(\int_s D_{\vartheta}ds)ds\\ \int ( D_{r}\cos(\int_s D_{\varphi}ds)\sin(\int_s D_{\vartheta}ds) ds\\ \int D_{r}\cos(\int_s D_{\vartheta}ds)ds\end{matrix} \right \}$

, where $D_{r}$ , $D_{\varphi}$ and $D_{\vartheta}$ are the driver functions. As before, don’t be too scared of the large number of integrals, they are essentially sums that allow is to “remember” where we are in the tree graph.

I haven’t found a neat presentation of the three-dimensional equation in exponential form but if I do, I will let you know. Suggestions welcome!

Now, I’m going to cut a few corners here. I have been working with 3D objects created using this method for several years. I have written code in PHP, Ruby and Python and have used different rendering software, though mostly POVRay. However, for practical purposes, I haven’t used directional driver functions in that form. Instead I have developed the notion of a “genetic fractal programming language” that describes these directional driver functions. So instead of filling an three arrays for $D_{r}$ , $D_{\varphi}$ and $D_{\vartheta}$  with a sequence of values to get a linear stretch that bends to the left with a slight torsion, I write: “increase 0.97, bend 0.176, twist, 0.04”. Obviously this is a lot more convenient.

I have also introduced the notion of mixing different sets of directional driver functions in a single object. For example, when a branch reaches a certain value for s, it stops “growing” or it switches to a different “growth material”. I also use the idea of basic cells, i.e. instead of drawing a line from one point to the next, I insert a sphere of a stick between those points.

With that in mind, here are some 3D genetic fractals created with the Genetic Equation. Some of these may surprise you in that one wouldn’t expect them to come from a mathematical equation, but they do. All of these genetic fractals are generated from directional driver functions using the Genetic Fractal Programming Language. In many cases the programs are short: 30 lines in the most complex case.       ## 5 thoughts on “Genetic equation in 3D”

1. john zande says:

I love the Steampunk last one.

Like

• john zande says:

I like. You know you can make a fortune with Steampunk these days. Not sure how, but it seems to be the flavour.

Like

• geneticfractals says:

It has eluded me sofar but mab hath faith.

Sent from Samsung Mobile

Like