# Fill an arbitrary number of points between two positions

Hello,
I am new here and a very new user of vvvv. I’m coming from XSI’s ICE, which I used from 2011. In this respect I find vvvv super cool. But I ran in a couple of problems that I can’t figure out by myself. For instance, I want to build my own spread of points. What I want to achieve is a linear interpolation between any two positions. I know I could do it with the factory linear spread, but I’m not happy with the flexibility of that node- and also for the sake of the exercise. I tried the resample node, but that one bugs.
So, I figured out how to generate two custom positions and how to manually add an arbitrary point between them, but I would like to know how to generate any number of points automatically.
Any help greatly appreciated!

To be more clear, here is the node tree in XSI.

And the base I have in vvvv.

Actually Resample (3d Vector) should do what you describe. Whats the bug? Did you check out the help patch? Maybe its just the mode pin not set to linear?

yes, there is a 3d verson for it, see patch:

ResamplePoints.v4p (11.0 KB)

Ok so I approach something like a solution, but it is buggy. Take a look at the attached pic.
What happens is that the points in array/spread don’t sit where they should- on the white line connecting the original two points. Increasing the number of points ( the construct in fig.1) somehow makes the approximation of their position better, but that’s a symptom, not a workaround.
First I thought that the construct in the F.1 returns an array of integer values, but it’s not the case. I checked, the values there are all doubles. So it’s not a rounding error in that part. I presume that the morph node is buggy´- it seems that there are some rounding errors inside that node. Also note the out-of-range point (id8) which I can’t eliminate no matter what. I tried the delete slice node, but to no good result. Btw. whis is the behavior that you can also notice in the factory linear spread node.
Any ideas how to correct this?

Oh,

thank you for the patch, I didn’t see your reply as I was writing the post above.
Works like a charm. Thank you!

just a note, you can use a linear spread for the InputMorph, instead of the I spread and the math. your problem in the patch is that you have 3d vectors as inputs for the targets but only one slice as morph value, so you have to repeat the morph values 3 times to work for 3d vectors. e.g. with a Select node set to 3. like so:

however, you should have a look at VL, it doesn’t have this kind of index/slice problems, since it got proper data types like Vector3 and Float32.

Oh, now I got it. That’s the reason why also the number of elements one inputs is 3 times the number of elements you see in the renderer. Ok, I wasn’t aware of that. Good to know, I was banging my head figuring out how to isolate one vector in a sequence. Now it makes perfect sense.

@tgd
Hey tgd, thank you for your reply. I can show you the bug, it just happened again. Can I PM you?

hey just post. lets see

Ok, sure. Here it is: https://we.tl/t-uLdIJe4sHQ
Take a look at the second resample noe, the one that reads the two indexes on the function curve.
Also, I have another question: how can I generate an array of indices? What I would like to achieve is the following: in the given function curve (generated by n elements) I would like to be able to generate an array of positions between pos§ and pos(p+i), p<n, i is an interval. Like between index 0 and index 22, index 1 and index 23 and so on. In ICE i would build an index array x[n] and I would interpolate between x[n] and x[n+1] and eliminate the last element which would be out of bounds. In vvvv I don’t yet know how to do it…

hey you have unlocked your first vvvv achievement: “the spread in a pin trap” :)

have a look at the getslice nodes. there is a spread of 900 values on the index pins.
just alt right click the pin to reset. welcome to vvvv :)

when you connect a spread of values to a pin and later disconnect, the spread will stay in the pin.

LOL :D hehe. Well, we all learn, isn’t it?
Btw, I edited the above post with an extra question, just in case!

yes i still trap into this sometimes:)not sure about your edit quest. you may need i(Spreads): " to generate an array of positions " ? what i guess.

I thought so as well, but strangely it does something else, namely it fills the gaps ON the curve between i and i+1. :/ which is kinda cool but not what I want lol

Here is a screenshot of the effect

So, my idea was in array of integers int[n] and int[n+1] since the get slice node index pin accepts arrays. Bin size of 1, because I want every index in the array. Resample between those two and voila. But it fails.
I Am Jack’s Inflamed Sense of Rejection

Also, this idea works- strangely- with lines. Is there any way to convert lines to points?

I think you might be looking for an integral node
Second thing, if you want help faster post your patch with progress

Lines usually have bin size, it’s amount of points per line