I want to make a project that you put in a amount of sides and it generates a shape that has that amount of sides.
Printable View
I want to make a project that you put in a amount of sides and it generates a shape that has that amount of sides.
Great. What do you think you should do? What data do you think you would require to be able to draw such a shape? If you have no idea then you haven't spent enough time considering the problem. Here's a clue: if a shape has N sides then it also has N vertices.
And here's a couple more clues:
1. Each vertex can be represented by a point
2. Sum of the interior angles is a constant. That constant depends on the number of vertices and can be calculated by
3. With a regular polygon, all the interior angles are the same. Thus each angle = sum / NCode:sum = 180 * (N - 2) 'where N is the number of vertices