How can I implement this method:
private bool IsRegularPolygon(List<Point> seed)
The Point object is in 2 dimensions, with an X and Y coordinate.
And assuming it is regular, how can I find the length of a side?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just think back to high school geometry, and think about what makes a polygon “regular”.
Since this wouldn’t be much of an answer if that’s all I said, I’m going to cut to the chase and point out that it’s a polygon where all the interior angles are equal.
So this reduces the problem down to making sure that each angle between three points in the list is the same. So something like:
Now remembering that if it’s regular, all the sides are the same length, so finding the side length is a straightforward distance-between-two-points calculation.