This is useful when you want to connect two bunches of points together.. You'd think it'd be easy right?
Scatter, say 50, points on a grid. Then another 50 on another grid (or any shape..it doesn't really matter). Move them about a bit, then plug them both into a point wrangle (first two inputs).
This code will draw a single primitive edge between the points, paired by @ptnum (so you could do some sort of sorting beforehand, I guess):
int npnt=addpoint(0, @opinput1_P);
int nprim=addprim(0,"polyline");
addvertex(0,nprim,@ptnum);
addvertex(0,nprim,npnt);
Lets tackle each line.
int npnt=addpoint(0,@opinput1_P);
First we make a new point. Point wrangles only ever consider the first input's points. So we need to add the other input's points into the mix. I think the 0 corresponds to the @ptnum attribute.. So it looks up the relevant point in input1 and then puts it at the position specified by "@opinput1_P". That's a handy bit of VEX shortcutting there.
int nprim=addprim(0,"polyline");
Here we are creating a new primitive, of polyline type. Nothing is there yet...
addvertex(0,nprim,@ptnum);
Now we add a vertex to the primitive we just created. Firstly, we add the point we're currently processing.
addvertex(0,nprim,npnt);
Next we add the vertex we added at the beginning (our currently processed point's counterpart in the other group).
That's it!