I'm working on a 2D game project where I am expecting users to draw 2D polygons (closed path) such as:
Possible Solutions:
1 - Draw by Points and Calculate Border Lines.
1 Problem - Calculation of Border Lines.
2 - Start with an ellipse and let the user reshape it by moving vertices.
2 Problem - When ellipse enlarges, it creates gaps between vertices where you can't reshape.
3 - Add and Move Vertices
3 Problem - Ear Clipping Triangulation stucks at somepoint (53th line while
loop @ http://pastebin.com/Ug337mH2, goes into infinite loop)
**After some thinking, I decided I better work on the infinite loop (in method 3) problem rather than abandoning the add and move vertex method. What causes the infinite loop in the while
loop at 53. line (see http://pastebin.com/Ug337mH2)?
My guess: ear clipping triangulation fails to attach some vertex to any triangle and keeps retrying.**
How I can easily implement polygon drawing in my game?