#include <voplib.h>
// Create variables
int divisions = int(ch("divisions"));
float numturns = ch("numturns");
float rInitial = ch("rInitial");
float rGrowth = ch("rGrowth");
float yInitial = ch("yInitial");
float yGrowth = ch("yGrowth");
float sInitial = ch("sInitial");
float sGrowth = ch("sGrowth");
int pts[];
int npts = int(divisions * numturns);
float theta;
float radius, yy, scale;
for (int i=0; i < npts; ++i)
{
// Define theta
theta = 2.0 * M_PI * i / float(divisions);
// Set growing algorithm
radius = rInitial * pow(rGrowth, theta);
scale = sInitial * pow(sGrowth, theta);
yy = yInitial - yInitial * pow( yGrowth, theta);
// Create points and normals
v@loc = set( radius * cos(theta), yy, radius * sin(theta));
pts[i] = addpoint(geoself(),v@loc);
v@Norm = set( -radius * sin(theta), 0, radius * cos(theta));
setpointattrib(geoself(),"N",i,v@Norm);
setpointattrib(geoself(),"pscale",i,scale);
}
Seashell generation algorithm referencing from here:
http://deborahrfowler.com/MathForVSFX/Seashells.html