Clipping ears plugin

Hi.

We are trying to develop a plugin that performs triangulation based on the clipping ears algorithm. The plugin is supposed to output several submeshes and is meant to be used with the contour plugin.

Vux created another plugin, Polygon (EX9.Geometry 2d) that behaves more or less exactly the same, except that the clipping ears algorithm is able to always triangulate concave shapes correctly.

We are a bit shaky on the internals of vvvv and completely unfamiliar with SlimDX, which has made the development time get a little out of hand. We are kind of running out of time now, and we would be very thankful for some help on this.

We would imagine that others would also like to have such a plugin, perhaps even someone with the knowledge to implement the algorithm into a plugin outputting multiple subsets of meshes. Alternatively, you could change our first try on a plugin to output multiple submeshes.

The current unfinished version of the plugin is here:

https://vvvv.svn.sourceforge.net/svnroot/vvvv/plugins/c%23/Mesh/ClippingEarTriangulation/

Specifically, the clipping ears algorithm can be found in this class:

https://vvvv.svn.sourceforge.net/svnroot/vvvv/plugins/c%23/Mesh/ClippingEarTriangulation/branches/Experimental/EarClipping.cs

The algorithm is still buggy, but we should be able to fix it, if only we could get the vvvv-specifics to work.

The perfect solution would be if someone with enough knowledge of the whole vvvv / SlimDX-thing could insert EarClipping.cs into a working plugin that outputs submeshes. That would enable us to finish debugging the algorithm.

Using the algorithm should be straightforward:

{CODE(ln=>1)}List polygonVerticesInClockwiseOrder = new List();

// ^ Clockwise … or is it anticlockwise?
// Anyways, the same order as the output from the Contour node.

List indices = new List();

// add some vertices in clockwise order

EarClipping earClipper = new EarClipping();

indices = earClipper.clippingEarTriangulation(polygonVerticesInClockwiseOrder);

// create index buffer from indices^

This should be done for each contour and uploaded to the GPU as separate submeshes.

Thank you in advance.

Hello,

the 2d meshes are now commited, you can see how i’ve worked on it.

Basically i got an abstract class to which you provide the list of vertices/indices, and it does pretty mush the rest of the job for you :)

Feel free to check out the code and use it as you need.

If you got any question, let me know.

moments later…

here is a simple plugin that triangulates convex and concave polygons.
all credits go to: https://polygontriangulation.codeplex.com (the plugin is merely wrapping that code).

here is another one in case someone wants to compare the two: http://www.codeproject.com/Articles/8238/Polygon-Triangulation-in-C

and the next step would be: http://www.dgp.toronto.edu/~rms/software/Deform2D/index.html

ClippingEars.zip (11.7 kB)

Cool joreg

Hi guys

is there some clipping ears around that accepts overlapping ?