0

I was working on Scale game: Scale

For this purpose, I require to sort points as per clock wise direction and I implemented algorithm for this process. Here is algorithm reference link: Sort points in clockwise order?

But now this kind of situation occurred for me. I made proper sketch to represent my side error situation. enter image description here

Above figure I hope explaining my problem exactly. Basically using algorithm, points get sorted correctly but as per game requirements, I want some tweak in those.

So what to do in this case? Please give me some suggestion regarding this.

Siddharth
  • 4,142
  • 9
  • 44
  • 90
  • If you only have a bare list of points, there isn't much more you can do. You would need to add assumptions about the point connectivity. But your example looks like you might know exactly what point is connected to what. Is that the case? – Nico Schertler Nov 29 '17 at 19:59
  • No I don't know about which points get connected with which other point because polygon generation process is completely dynamic. Here is small game play video: https://www.youtube.com/watch?v=pL25qyJXhC0 – Siddharth Nov 30 '17 at 09:33
  • Well, actually, you do know. You know the connectivity of the existing polygon (which should be oriented) and you know the connectivity of your new lines. You just need to stitch them together and delete the part that should be removed. – Nico Schertler Nov 30 '17 at 11:30
  • If you still want to do it from scratch, take a look at [this question](https://stackoverflow.com/questions/17862162/sort-anticlockwise-the-points-of-rectilinear-polygon/17863840#17863840). – Nico Schertler Nov 30 '17 at 11:38
  • how to decide runtime which line segment I require to remove? – Siddharth Nov 30 '17 at 11:40
  • You have the two intersection points of your new lines. This forms two loops (that share the new line segments). Determine which loop contains the ball and remove the other one. – Nico Schertler Nov 30 '17 at 16:23

0 Answers0