Enhance curve shape (VEX)
Example:
Calculates vector pointing “outwards” from the shape on each point. Then moves the point along this vector. Can be used to enhance noises etc. I found that it got painfully slow with higher densities, so I wouldn’t use it in procedural setups that need interactivity.
Logic around the script:
Run over primitives
Loop over all the points on the primitive except the root point
Get point position from the previous and next point and calculate these points average position. Then calculate the vector from the iterated point position to this averaged point position to get the direction vector pointing “outwards” from the shape.
Add value to the point position multiplied by the calculated direction vector to move the point along the vector.
int pts[] = primpoints(0,@primnum); for ( int i=1; i<(len(pts)); i++ ){ vector pos1 = point(0,"P",pts[i-1]); vector pos2 = point(0,"P",pts[i+1]); vector pos = point(0,"P",pts[i]); vector origin = avg(pos1,pos2); vector dir = normalize(pos-origin); vector newpos = pos + chf("amount")*dir; setpointattrib(0,"P",pts[i],newpos); }