So many people could solve that problem, but not me.
![:oops:](./images/smilies/icon_redface.gif)
My algo is to test all edges and all vertices.
When I fix a candidate symmetric line, I check each vertex one by one that lies on different side of that line.
Here is some test data I made
Code: Select all
4
-1000 0 0 1000 1000 0 0 -1000
8
0 0 0 1000 100 1000 100 500 200 500 200 1000 300 1000 300 0
7
-1 0 -1 1 0 1 1 1 1 0 1 -1 -1 -1
5
0 0 0 2 1 1 2 2 2 0
6
0 0 0 2 1 1 2 2 2 0 1 1
5
0 -1 0 2 3 1 4 2 4 -1
7
-1 -1 -1 1 0 2 1 1 1 0 1 -1 0 -2
0
Code: Select all
Polygon #1 has 4 symmetry line(s).
Polygon #2 has 1 symmetry line(s).
Polygon #3 has 4 symmetry line(s).
Polygon #4 has 1 symmetry line(s).
Polygon #5 has 2 symmetry line(s).
Polygon #6 has 0 symmetry line(s).
Polygon #7 has 2 symmetry line(s).