So I have a curve on the y-axis. That I want to bend for example towards the x-axis (see picture 1).
Each point has a weight attrib, the sum of all those weight attribs should be 1, meaning that the end of the curve is exactly aiming like the aim/goal vector. I do that by using this script (the aim vector is the goal I want it to aim like):
vector aim = set(1,0,0); int npts = npoints(0); //Create empty lists vector new_p[]; vector new_n[]; //Store all current values in list for(int pt = 0; pt < npts; pt++){ new_p[pt] = point(0, "P", pt); new_n[pt] = point(0, "N", pt); } //Transform points for(int pt = 0; pt < npts; pt++){ vector p = new_p[pt]; vector n = new_n[pt]; float weight = point(0, "weight", pt); matrix m = dihedral(n, aim); //Blend transformation by weight m = slerp(ident(), m, weight); for(int cpt = pt; cpt < npts; cpt++){ vector cp = new_p[cpt]; vector cn = new_n[cpt]; cp = (cp - p) * m + p; cn *= m; setpointattrib(0, "P", cpt, cp, "set"); setpointattrib(0, "N", cpt, cn, "set"); new_p[cpt] = cp; new_n[cpt] = cn; } }
The problem is that if I use a linear weight ramp (so point 0 has the lowest weight and point 9 the highest, still summed up being 1) the curve is bend somewhere half-way it is supposed to be (picture 2 goal_vector_bend).
But when I remap the weight to just one point being 1 (pt 4) and all the other points being 0 it does work. See picture 3 (goal_vector_correct).
Does anyone know how to get this working correctly? Like as long as the sum of the weight attribs is 1 it should be aligned with the aim vector and if the sum would be lower than 1 it should ofcourse not be fully aligned.
I added the scene file in the attachments.

