Plot hex tiles with different length sides?
Posted
by
Phil
on Stack Overflow
See other posts from Stack Overflow
or by Phil
Published on 2012-07-09T15:11:53Z
Indexed on
2012/07/09
15:15 UTC
Read the original article
Hit count: 336
hextiles
I'm trying to create a basic grid of hex tiles. I found some code...
s=h/Math.cos(30*Math.PI/180)/2;
tile._x=x*s*1.5;
tile._y=y*h+(x%2)*h/2;
That does just that, but I think it's setup for hex's that have same length sides. However my hex has different length sides. It's width is 140 and it's height is 80. I could completely change the code to work with my side lengths, but I was wondering if there's a better way of doing it with the code above.
© Stack Overflow or respective owner