Fibonacci Spiral

calendar_today

18.04.2022

label

VEX, Modeling

mouse

Houdini 18.0

1 Fibonacci spiral

Here is a simple example of the famous fibonacci sequence which is commonly found in plants. The provided HIP file takes the essential VEX code below a little further.

// DETAIL WRANGLE
int num = chi('points');

float ratio = (sqrt(5) + 1) / 2.0;
float angle = 360 / (ratio * ratio);

for(int i = 2; i < num; i++){
    float radius = sqrt(i);
    float theta = angle * i;
    float pos_x = radius * cos(theta);
    float pos_z = radius * sin(theta);
    vector pos = set(pos_x, 0.0, pos_z);
    int pt_add = addpoint(0, pos);
}

2 Vogel model

Take a line and resample it to 100 points. The radius is defined by the square root of the point number (index). The angle is defined by the index multiplied by the golden angle 137.508°.

float s = chf('scale');

int index = i@ptnum + 1;
float radius = s / 10.0 * sqrt(index);
float angle = index * 137.508;

matrix m = ident();
rotate(m, angle, {0,1,0});
scale(m, radius);

v@P = {1,0,0} * m;

3 Mesh integration

By using nearest points/polygons with the circle from edges node we can integrate the spiral into a subdivision disc.

download

Downloads