A regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).
Your job is to find out if a given polygon is regular or not.
Specs
- You will be given a list of Cartesian coordinate 2-tuples which describe the polygon's vertices.
- The points will always make a valid polygon.
- You have to return a truthy / falsey for whether or not the polygon is regular.
- Assume vertices are rounded to the nearest int.
- They might or might not be in order.
- This is code-golf so shortest code in bytes wins!
Test Cases
Most test cases generated by this site.
[(1,2), (3, 2), (1, 0), (3, 0)] -> True
[(1, 1), (5, 3), (7, 7), (3, 5)] -> False
[(550,450), (455,519), (491,631), (609,631), (645,519)] -> True
[(106,81), (94,81), (84,88), (80,100), (84,112), (94,119), (106,119), (116,112), (120,100), (116,88)] -> True