Fastest way to check if two square 2D arrays are rotationally and reflectively distinct
- by kustrle
The best idea I have so far is to rotate first array by {0, 90, 180, 270} degrees and reflect it horizontally or/and vertically. We basically get 16 variations [1] of first array and compare them with second array. if none of them matches the two arrays are rotationally and reflectively distinct.
I am wondering if there is more optimal solution than this brute-force approach?
[1]
0deg, no reflection
0deg, reflect over x
0deg, reflect over y
0deg, reflect over x and y
90deg, no reflection
...