Jump to content
Krion

Resample in VEX? (imitate Resample SOP | resample vector array)

Recommended Posts

Hi guys!

Is it possible to have imitate the Resample SOP in VEX?
I basically want to do the last step of this tutorial (see 07:20) entirely in VEX, so that it generates the array of proper vector positions from the 5 'control point' vectors.

(so I could potentially make a polyline from there as well with addpoint and addprim then if I wanted to)

Thanks in advance

 

Edited by Krion

Share this post


Link to post
Share on other sites
v[]@pos;                                        

vector posStart = point(1,"P",0);               
append(v[]@pos,posStart);                       

for(int i = 16; i < npoints(1)-16; i++){      
    vector tempP = point(1,"P",i);                 
    append(v[]@pos,tempP);                      
}                                              

vector posEnd = point(1,"P",npoints(1)-1);     
append(v[]@pos,posEnd);                        


//create spline                                                       

int its = chi("iterations");                                         

for(int i = 0; i <= its; i++){                                       
    vector tempP = spline("linear",(float)i/(float)its,v[]@pos);        
    int newPt = addpoint(0,tempP);  
}                                    
int val = 20;

for (int i = 0; i<= val; i++){
        vector temP = spline('linear',(float)i/(float)val,{0,0,0},{0,0,5},{0,0,10});
        int newPt = addpoint(0,temP);
}

+ you have here FeELib-for-Houdini just search on Google (something Like Q-lib for Houdini endless ex and Files


 

res.jpg

Edited by Librarian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×