I have an array of coordinates. And that coordinates occur dynamicly. So for some possibilities, it does not draw convex. Please check the example.
<div style="width : 700 , height : 700">
<svg width ="700px" height = '700px'>
<polygon points="203.21954686687195,209.09106845446956 103.21846501684684,30.73408772834725 98.7205079235916,110.89560444878055 213.4424487588524,32.1353347676166 " fill="lime" stroke="black" fillRule= 'nonzero' />
</svg>
</div>
Here is link :https://jsfiddle.net/zcj4qwpz/7/
So my question is simple : How can i make it convex for every time ? Should i generate new array for this? If so, how can i do that.
Or is there any solution by changing something on html-canvas props?
Note: I checked many questions but they didn't help me. For example this (the closest question to mine): How to determine if a list of polygon points are in clockwise order?