I was hoping someone could point me in the right direction in getting a spline drawn using VEX.
In the code below I have no problem making a zigzag line from within a point wrangler, but I cannot get the spline function to draw a spline.
In the docs it says the second argument of the spline function is a float and is the position along the spline.
http://www.sidefx.com/docs/houdini15.5/vex/functions/spline [sidefx.com]
Now what I don't understand is what is that float position? I mean it can't be a vector position of x,y,z because it's only a float.
Am I to understand that it's like an equadistant position along that spline defined by the number of vectors arguments given?
eg. say I give the function 4 vectors and define the second float argument as 3.5. Does this mean I am going to get the returned value ( height according to docs ) of that second argument that lies mid-point between the 3rd and 4th vectors given on the calculated spline?
Then if this is so…what it seems to me what I have to do is use the addprim and addvertex functions to actually draw the line? Getting better resolution with more values with the second argument of the spline function?
eg create a function that runs through many values to smooth out the curve. ( Use each returned value of the spline function as a vertex point in the function addvertex. )
I could probably have tested this idea by working at it, but if I am off track I was hoping someone could help by providing a comment and possibly save me some time researching this.
Thank you.
// Vex code in point wrangler set to 'Detail'
vector vpt0, vpt1, vpt2, vpt3;
int ipt0, ipt1, ipt2, ipt3;
vpt0 = {0,0,0};
vpt1 = {2,3,0};
vpt2 = {4,-1,0};
vpt3 = {8,2,0};
ipt0 = addpoint(0, vpt0);
ipt1 = addpoint(0, vpt1);
ipt2 = addpoint(0, vpt2);
ipt3 = addpoint(0, vpt3);
int Tprim = addprim(0, "polyline" );
addvertex( 0, Tprim, ipt0 );
addvertex( 0, Tprim, ipt1 );
addvertex( 0, Tprim, ipt2 );
addvertex( 0, Tprim, ipt3 );
// The above code works, giving a zig zag line but the code below doesn't give anything
float T_pos = 2;
vector T_height;
T_height = spline("catrom", T_pos, vpt0, vpt1, vpt2, vpt3);