# 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)

Edited by Krion

##### Share on other sites
On 15/11/2022 at 4:01 PM, konstantin magnus said:

Great, tested and worked.

Any idea maybe on how to get an uniform distribution?

Resample VEX.v1.hiplc

##### 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 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});
}```

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

Edited by Librarian

## Create an account

Register a new account