How to draw/manage a hexagon grid?

Posted by W.N. on Stack Overflow See other posts from Stack Overflow or by W.N.
Published on 2011-08-22T03:40:13Z Indexed on 2012/09/01 3:38 UTC
Read the original article Hit count: 250

I've read this article: generating/creating hexagon grid in C . But look like both the author and answerer have already abandoned it.

v(hexagonSide - hexagonWidth * hexagonWidth): What's hexagonSide and hexagonWidth? Isn't it will < 0 (so square root can't be calculated).

And, can I put a hexagon into a rectangle? I need to create a grid like this:

Source:Wikipedia

One more thing, how can I arrange my array to store data, as well as get which cells are next to one cell?

I have never been taught about hexagon, so I know nothing about it, but I can easily learn new thing, so if you can explain or give me a clue, I may do it myself.

© Stack Overflow or respective owner

Related posts about java

Related posts about algorithm