Multiply curve (VEX)

For the script to work, the curves need the vector attributes created by the Create vectors for braid (VEX) script.

With the right vector attributes in place, this setup will multiply the curve around its shape. Run the script in a primitive wrangle. The script has parameters for the number of copies, amplitude, and twist.

int pts[] = primpoints(0,@primnum);

vector positions[];
vector pos;

for ( int i=0; i<len(pts); i++ ){
    pos = point(0,"P", pts[i]);
    append(positions,pos);
}

int iteration = chi("num_of_copies");
float amp_z = chf("amplitude_z");
float amp_x = chf("amplitude_x");

float freq_1 = chf("twist");

for (int a=0; a<iteration; a++) {
 
    int prim = addprim(0,"polyline");
    
    for ( int i=0; i<len(pts); i++ ){
    
        vector og_pos = positions[i];
        vector tangentv = point(0,"tangentv",pts[i]);
        vector cross = point(0,"cross",pts[i]);
        float curveid = i;
        float curveu = point(0,"curveu",pts[i]);
        curveu = chramp("curveu_ramp",curveu);
        
        float offset = (2*PI/iteration) * a + (curveid*freq_1);
        
        pos = og_pos + sin(offset) * amp_z * tangentv * curveu;
        pos = pos + cos(offset) * amp_x * cross * curveu;
        
        vector newpos = pos;
        int pnt = addpoint(0,newpos);
        addvertex(0,prim,pnt);
    }
}
removeprim(0,@primnum,1); //remove original primitive
Previous
Previous

Braid from curve (VEX)

Next
Next

Create vectors for braid (VEX)