Create polygon curves from a curve ramp parameter by looping over its positions, values, and interpolation parameters.
Creates a linear curve from a linear ramp.
float shape = chramp('shape', 0.0);
int num = chi('shape');
int pts[] = {};
for(int i = 1; i <= num; i++){
string name = 'shape' + itoa(i);
float x = chf(name + 'pos');
float y = chf(name + 'value');
int pt = addpoint(0, set(x, y, 0.0));
append(pts, pt);
}
addprim(0, 'polyline', pts);
Shapes an existing line with many segments according to the ramp.
float u = vertexcurveparam(0, i@vtxnum);
float shape = chramp('shape', u);
int num = chi('shape');
vector p[];
resize(p, num);
string basis[];
resize(basis, num);
for(int i = 0; i < num; i++){
string name = 'shape' + itoa(i + 1);
float x = chf(name + 'pos');
float y = chf(name + 'value');
p[i] = set(x, y, 0.0);
basis[i] = chs(name + 'interp');
}
v@P = spline(basis, u, p);