Challenge 2: Hexagons

Now that we've done triangles, and more specifically equilateral triangles, let's try hexagons.

Challenges:

  1. First, try making a hexagon out of six equilateral triangles. Make them any size you want, anywhere on the screen. You can even hard code the numbers if you want.
  2. Now try it with variables: start with just two variables: a Point that will be the center of your hexagon, and a number (integer) that will be the radius of your hexagon. Generate all the other vertices programmatically. So if you change nothing but the radius variable, for instance, your hexagon will adjust accordingly.
  3. Good so far? Ok, now try dropping the triangles and drawing it as a single Polygon, using only the vertices as points.
  4. Read up (again) on Python functions, and put your code inside a "hexagon()" function that takes two parameters: center and radius.
  5. New Question: Can you tesselate the window with hexagons?
  6. Can you generate any other polygons without using trigonometry?