int num = chi("num");
float height_ratio = chf("height_ratio");
float radius_ratio = chf("radius_ratio");
float scale_ratio = chf("scale_ratio");

float phi = radians(26.5);//(1 +sqrt(5)) / 300.0;
float ang = 2 * $PI * (phi - 1) / phi;
int step = chi("step");

for(int i=0; i<step; i++){
    int pt = addpoint(0, set(0,0,0));
    setpointattrib(0, "connect", pt, i);
}

for(int i=0; i<num; i++){
    float rad = pow(i, radius_ratio) / pow(num-1, radius_ratio) * i;
    vector pos = set(cos(ang * i) * rad, ((num-i))*height_ratio, sin(ang * i) * rad);
    int pt = addpoint(0, pos);
    
    setpointattrib(0, "connect", pt, i % step);
    setpointattrib(geoself(), "N", pt, normalize(-pos));
    setpointattrib(geoself(), "up", pt, set(0,1,0));
    setpointattrib(geoself(), "src_id", pt, i);
    setpointattrib(0, "pscale", pt, i / float(num) * scale_ratio + 0.015);
}

Leave a Reply

Your email address will not be published. Required fields are marked *