Maybe it’s because it’s Sunday afternoon and after coding all week at my day job my brain is pretty much spent by the time I get to my hobby coding. Maybe it was that omelette from IHOP this morning. I don’t know what it was, but for the life of me, this took me at least half an hour to figure out.

I’m a bright guy. I took a number of senior level math courses in college. I got an 800 on the GRE math section. Yet this simple problem stumped me.

I’m not even going to go into details, I’m just going to give you the solution. The only reason I’m posting this is because I couldn’t find the answer on Google, and when there’s something basic like this that I think would be important for the public to know and it **isn’t the first hit on Google, **I post it.

Here it is:

The red lines indicate how the hexagon is split into triangles.

For the unit hexagon (edge length 1) centered around (0,0), the vertex coordinates are:

0: (-0.5, -*y)*

1: (-1,0)

2: (-0.5, *y*)

3: (0.5, *y*)

4: (1,0)

5: (0.5, -*y*)

where *y = *0.5 * sqrt(3)

To turn this into a triangle strip, assuming CCW culling (in other words, verts are specified in clockwise order), the verts are:

{ 1, 2, 0, 3, 5, 4}

**Note that if you are trying to draw a hexagonal grid then you don’t want to do it this way.**

If you’re doing a grid, then the most efficient way is going to be to draw rows of strips, where each row is only a portion of each hexagon. You’re on your own for that. There’s a lot more google on that problem than this one.

Enjoy your f’ing hexagon.

### Like this:

Like Loading...