Saturday, January 15, 2011

Mapping the World with Hexes

****** Warning this post contains mathematics and computer science ******
Working on my old world maps has raised some interesting questions once again, long neglected by real world cartographers like:
How wide are the Rocky Mountains?
How many real world cities fit in a 5 mile hex?
The first step to answering these questions is to lay out the real world on a hex grid. Since the world is really big we need hex which really small, which is the first step.

Pixelating the Hex
After scanning my current 10 hex to inch hex paper into the computer and wasting two hours trying to clean the smudges by repainting the image pixel by pixel I concluded there had to be a better way. I started to work on laying out the smallest pixel pattern I could create which would preserve a hex shape. The hex shape can be build from a 30 60 right triangle. The geometry of this triangle such that if longest side is 1 the shortest side is 0.5 which is quite nice. However, the other side is the square root of 3 over 2 an inconvenient irrational number about 0.866 to three decimal places. All computer scientist know an irrational number is very hard to draw in pixels because one can only use an integral number of pixels per drawing Luckily for me I discovered that the ratio 6/7 (0.857 to three decimal places) is very close (99% of 0.866). I therefore proceeded to lay out a pixel patten for a grid based on the 6/7 ratio. Here is the result
 A  pixel pattern 12 squares high by 20 squares wide. Note: the bottom line is part of the next pattern I just left it in so I could see the hex. A little jagged you may say but take a look at in the next picture (Original is at 140 ppi, your ppi may vary depending on your screen). It really looks like hexes.

Here's an 8.5" by 11" sheet gridded at 20 hexes to the inch. Use with caution! To quote She-Who-Must-be-Obeyed "I wanted to look, but I wish I hadn't". Perhaps it is less headache inducing in a different color. Feel free to experiment yourselves. I am going to use it mostly as a digital overlay for other things. 

Finally as the penultimate goal of our project, here the grid superimposed over a nice Dymaxion world map in public domain. I like Dymaxion maps because they are based on mapping the world to a d20 and are composed of equilateral triangles which fit nicely with hexes. You can read more about them here and here. The map is 2008 pixels wide which for a d20 is half the circumference of the earth or roughly 12,450 miles. This works out to 6.2 per pixel, or at our 12 pixels per hex, 74 miles per hex. Enjoy!

P.S. Future projects may include reworking the map to 50 miles per hex; getting height and vegetation maps to more accurately find mountains, forests, and deserts; scaling portions up to a 5 mile per hex resolution. However this is about all the math I take for now.
Errata: When I posted this morning I had claimed 7 pixels per hex or 43 miles, My pixel grid is actually 7 pixels per side and 12 pixels across or 74 miles per hex.

1 comment:

Related Posts Plugin for WordPress, Blogger...