5

I'm looking for recommendations for an application or library to calculate good fits of regular hexagonal grids to an irregular area or group of areas.

Minimally, I'd like to be able to supply an image and maximum number of hexagons and retrieve the image that rotates/shifts/scales a hexagonal grid to fill each hexagon with one color with minimal error. An advanced feature might be to perform deformations of the underlying image (within specified limits) to achieve a better fit. I have some ideas of how I'd do this myself, but it seems likely to be a solved problem.

Thanks for any suggestions.

EDIT: The use-case I'm thinking of would be to generate reasonably faithful hex maps of real geography for use in board (or virtual board) games.

Dan Percival
  • 293
  • 2
  • 8
  • 1
    An example would help. You mention that the hexagon count is given but you aslo say that you want to scale them - this will certainly change the number of hexagons... – Adi Shavit May 23 '13 at 18:00
  • 1
    @AdiShavit thanks for the comment! I've edited the question to include a use-case. The reason I mention a _maximum_ hexagon count is that, of course, an infinite number of hexagons would obtain a perfect fit. – Dan Percival May 24 '13 at 18:11
  • I don't know of a library, but you can treat a hex grid as a grid of squares where alternating rows (or columns if you prefer) are offset by 1/2 square. I bet you could get close (maybe close enough?) by downscaling the image twice, offset by 1/2 the second time, and striping the results. (Possibly this is the idea you already had. `:)`) – David Moles Sep 20 '13 at 16:18
  • Ah, yes, bricklayer's hexagons! That would be pretty elegant if I wasn't also wanting to search for fit improvements from rotation and translation. – Dan Percival Sep 20 '13 at 19:52

1 Answers1

0

My general idea is to do the following:

  • you should to approximate your irregular Curve shape to a minimal linear segments
  • then, you may calculate the angle a between each couple of sements 90 < a <180.

There are few methods to approximate curves into lines: explained here

Y.AL
  • 1,808
  • 13
  • 27