Forum

Contour -> Mesh

The problem is simple. In order to build multiple shapes from different groups of vertexes I need to give each triangle a list of indexes. In order to do this, I’ve built all the vertexes in to a spread.

example: [0,0,0, 1,0,0, 1,1,0, 0,1,0](0,0,0, 1,0,0, 1,1,0, 0,1,0) (a square)

Then, to fill the arbitrary shape I take the mean of the x and y of each bin (thankfully mean has a bin input) and attach those center points on to the end of the spread

example: [0,0,0, 1,0,0, 1,1,0, 0,1,0, 0.5,0.5,0](0,0,0, 1,0,0, 1,1,0, 0,1,0, 0.5,0.5,0)

If this is spread number zero, then I need to be able to index the triangles like so…

[this bin’s number + the length of the bin,
this point,
the next point OR the first point if this point is the last point]

put in to yet another example:
4,0,1
4,1,2
4,2,3
4,3,0

My problem right now is I can’t figure out how to make a spread that converts the count of vertexes in each bin in to that ID number repeated as many times as it is used. So as you can see above, the fifth point (4) got used four times meaning the count of the original bin 4 needs to get converted to 0,0,0,0 and then added to each of those the number of points used to make 4,4,4,4 so it can be restructured in to indexes.

I would write out another complex example, but I’ll just attach my v file and hope someone saves me from any more sleepless nights…

multiple fans.v4p (30.9 kB)

It’s also good to note that in the example attached, I hard-coded the indexes in to the mesh node. If you look in the inspektor, you’ll see how it all comes together while you play with the sliders.

I’m trying really hard to finish this by tomorrow. If I come up with an answer, i’ll be sure to let everyone know. Seems like one of those things I would have found by now, but alas, not yet.

http://vvvv.org/tiki-download_file.php?fileId=1681

does this helps?