int numStrands = chi("strand_number");
int time_step = chi("divisions");
float length = chf("Length");
float F = chf("Frequency");
float A = chf("thickness");
float B = chf("width");
float phasex = chf("phase_X");
float phasey = chf("phase_Y");
float timeDomain = chf("time_domain");
int exponent = chi("alpha_order");
vector S_t;
float delta_time = 1.0/time_step;
float alpha;
float beta;
int prev_pt;
int firstPoint = -1;
int newPt = -1;
for(int N_strand = 0; N_strand < numStrands; N_strand++)
{
float strandRatio = (float)N_strand/numStrands;
prev_pt = -1;
for(float i=0;i<timeDomain; i+=delta_time)
{
float thicknessRamp = chramp("thickness_ramp", i);
float widthRamp = chramp("width_ramp", i);
alpha = pow(i,exponent); // let alpha be any function of i like alpha = i*i; or alpha = sqrt(i) etc...
beta = 0.5*alpha;
S_t.x = thicknessRamp*A*sin(2*PI*(F*alpha+strandRatio)+phasex*N_strand);
S_t.y = widthRamp*B*sin(2*PI*(F*beta-strandRatio)+phasey*N_strand);
S_t.z = i*length;
newPt = addpoint(0, S_t);
if(prev_pt == -1)
{
prev_pt = newPt;
firstPoint = newPt;
}
else
{
int new_prim = addprim(0,"polyline");
addvertex(0, new_prim, prev_pt);
addvertex(0, new_prim, newPt);
prev_pt = newPt;
}
//pscale for polywire
float radius = i;
if(ch("adaptiveRadius")==1){
radius = i/timeDomain;
}
float pscale = chf("radius_scale")*chramp("wire_radius", radius);
setpointattrib(0,"pscale",newPt, pscale);
}
}