views:

458

answers:

5

Hey,

I am working on nesting of sheet metal parts and am implementing Minkowski Sums to find No Fit Polygons for nesting. The problem is I can give only convex sets as input to the code which calculates Minkowski sums for me. Hence I need to break a concave polygon, with holes into Convex sets. I am open to triangulation also, but I am looking for a working code on VC++ (6.0). I am slightly running short on time as my whole code is ready and just waiting for input in the form of convex sets.

I would really appreciate if somebody with prior experience can help me in this. I have gone through other posts but did not find anything matching to this. I am a student of mechanical engineering and really dun have much idea about computer languages. All I can handle is compiling a code on VC++ and incorporate it with my existing code.

Looking forward to responses!! Thanks Warm regards Saurabh India

A: 

@ Dmitriy: I had gone through this website earlier and the problem is:

"// ** THIS IS A CODE SNIPPET WHICH WILL EFFICIEINTLY TRIANGULATE ANY // ** POLYGON/CONTOUR (without holes) AS A STATIC CLASS" It works on polygons without holes. In my case I need it to work for concave polygons with holes. I tried google also and am working on implementing GPC(General Polygon Clipper). Though I am not sure if I will be able to implement it successfully to triangulate polygons with holes.

Regards Saurabh India

You should have added a _comment_ to Dmitriy's answer, not a new answer to the question.
Daniel Daranas
It's not much help, but I researched tessellation of polygons with holes many years ago and found it was quite difficult to solve. The solutions were very math-heavy and required different methods depending on the shapes you were working with (e.g. single hole then use this method, for stranger cut-outs use other methods etc.).
Just to add, one solution was to tessellate the surface as if it had no holes, then just drag the verticies away where you want the hole to be. Kind of like walking through a large spiderweb. The result is a lot more verticies than needed but if performance is not a priority give it a try.
What do u think about GPC(http://www.cs.man.ac.uk/~toby/alan/software/#Links)?? It says it supports holes and triangulates. For now I can work with traingulation rather than going about decompoosing into minimal convex polygons
A: 

This paper (Decomposition of a polygon with holes into convex polygons) is dedicated to solving the problem that you face.

Note that it only explains the algorithm, it does not give you any implementation. It seems to be well explained using pseudo code, which shouldn't be too hard to translate to any language.

You are dealing with a very specific problem, in those cases, you often have to implement the algorithm yourself.

GuiSim
+1  A: 

You could try to search ready code with Google Code Search.

Kirill V. Lyadvinsky
A: 

If you have access to OpenGL, you can take advantage of GLU's tessellation. You don't have to actually use OpenGL to use the tessellator, but I leave that as an exercise to the reader.

Eric