Drawing an outline around an arbitrary group of hexagons

Posted by Perky on Game Development See other posts from Game Development or by Perky
Published on 2012-06-08T15:56:01Z Indexed on 2012/06/08 22:48 UTC
Read the original article Hit count: 310

Filed under:
|
|
|

Is there an algorithm for drawing an outline around around an arbitrary group of hexagons? The polygon outline drawn may be concave. See the images below, the green line is what I am trying to achieve. The hexagons are stored as vertices and drawn as polygons.

Edit:

I've uploaded images that should explain more. I want to favour convex hulls because it's conveys an area of control more quickly. Each hexagon is stored in a multidimensional array so they all have x and y coordinates, I can easily find adjacent hexagons and the opposite vertex, i.e. adjacentHexagon = getAdjacentHexagon( someHexagon, NORTHWEST ) if there isn't a hexagon immediately adjacent it will continue to search in that direction until it finds one or hits the map edges.

enter image description here enter image description here enter image description here enter image description here

© Game Development or respective owner

Related posts about algorithm

Related posts about rendering