hexagonal-tiles

Drawing a hex grid in Flash?

自闭症网瘾萝莉.ら 提交于 2019-12-04 09:53:17
What's the easiest way to draw a hex grid algorithmically? How should I present them in data? For example, in a square grid, I could just save x-y coordinates.. So hexagon is a neat library for AS3 games, it has some hexagon classes that might be handy in your research. This article has some very nice details about hexagon tiles in Flash. There are several ways to manage hex map coordinates and most of them unintuitively insist on mapping them to x-y coordinates which is only important for rendering. Some form of polar coordinates is usually best. I have a perl library for managing most vector

Covering Earth with Hexagonal Map Tiles

痞子三分冷 提交于 2019-12-04 07:24:07
问题 Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with the traditional geographic system (longitude/latitude). I think it would be interesting to cover a globe with hexagonal tiles and be able to map a geographic coordinate to a tile. Has anyone seen anything remotely close to this before? UPDATE I'm

Hexagon grid on sphere without pentagon

主宰稳场 提交于 2019-12-04 01:33:19
I wanted to make a tile-based world on a sphere. I would like to use hexagon-shaped tiles, though as far as I can figure out you need to have pentagons in there too to make it fit. So, my question is, is it possible to make a hexagon grid on a sphere, without using pentagons? The hexagons don't have to be regular hexagons, if they are all close to regular that's more than enough. Any help here? Thanks a lot! Suzan Cioc Impossible. This is mathemetical theorem. Only imprecise ways exist I guess. http://en.wikipedia.org/wiki/Platonic_solid http://en.wikipedia.org/wiki/Semiregular_polyhedron

Distance between 2 hexagons on hexagon grid

为君一笑 提交于 2019-12-03 09:32:15
问题 I have a hexagon grid: with template type coordinates T. How I can calculate distance between two hexagons? For example: dist((3,3), (5,5)) = 3 dist((1,2), (1,4)) = 2 回答1: First apply the transform (y, x) |-> (u, v) = (x, y + floor(x / 2)). Now the facial adjacency looks like 0 1 2 3 0*-*-*-* |\|\|\| 1*-*-*-* |\|\|\| 2*-*-*-* Let the points be (u1, v1) and (u2, v2). Let du = u2 - u1 and dv = v2 - v1. The distance is if du and dv have the same sign: max(|du|, |dv|), by using the diagonals if

Finding adjacent neighbors on a hexagonal grid

百般思念 提交于 2019-12-03 06:20:09
EDIT: Wrapped the example map in a code block so the formatting is correct. Ok, I'm trying to write an extremely simple A* algorithm over a hexagonal grid. I understand, and can do the A* portion. In fact, my A* works for square grids. What I can't wrap my brain around is finding neighbors with hexagons. Here's the layout for the heagonal grid 0101 0301 0201 0401 0102 0302 0202 0402 etc, etc So, what I need help with is writing a Hexagon class that, given it's hex coordinates, can generate a list of neighbors. It needs to be able to generate neighbors which would 'fall off' the grid (like 0000

Distance between 2 hexagons on hexagon grid

本小妞迷上赌 提交于 2019-12-03 01:05:31
I have a hexagon grid: with template type coordinates T. How I can calculate distance between two hexagons? For example: dist((3,3), (5,5)) = 3 dist((1,2), (1,4)) = 2 First apply the transform (y, x) |-> (u, v) = (x, y + floor(x / 2)). Now the facial adjacency looks like 0 1 2 3 0*-*-*-* |\|\|\| 1*-*-*-* |\|\|\| 2*-*-*-* Let the points be (u1, v1) and (u2, v2). Let du = u2 - u1 and dv = v2 - v1. The distance is if du and dv have the same sign: max(|du|, |dv|), by using the diagonals if du and dv have different signs: |du| + |dv|, because the diagonals are unproductive In Python: def dist(p1,

Hexagonal Grid Coordinates To Pixel Coordinates

隐身守侯 提交于 2019-12-03 00:10:42
问题 I am working with a hexagonal grid. I have chosen to use this coordinate system because it is quite elegant. This question talks about generating the coordinates themselves, and is quite useful. My issue now is in converting these coordinates to and from actual pixel coordinates. I am looking for a simple way to find the center of a hexagon with coordinates x,y,z. Assume (0,0) in pixel coordinates is at (0,0,0) in hex coords, and that each hexagon has an edge of length s. It seems to me like

Covering Earth with Hexagonal Map Tiles

▼魔方 西西 提交于 2019-12-02 13:56:45
Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with the traditional geographic system (longitude/latitude). I think it would be interesting to cover a globe with hexagonal tiles and be able to map a geographic coordinate to a tile. Has anyone seen anything remotely close to this before? UPDATE I'm looking for a way to subdivide the surface of a sphere so that each division has the same surface area.

Hexagonal Grid Coordinates To Pixel Coordinates

这一生的挚爱 提交于 2019-12-02 13:54:28
I am working with a hexagonal grid. I have chosen to use this coordinate system because it is quite elegant. This question talks about generating the coordinates themselves, and is quite useful. My issue now is in converting these coordinates to and from actual pixel coordinates. I am looking for a simple way to find the center of a hexagon with coordinates x,y,z. Assume (0,0) in pixel coordinates is at (0,0,0) in hex coords, and that each hexagon has an edge of length s. It seems to me like x,y, and z should each move my coordinate a certain distance along an axis, but they are interrelated

Hexagonal tilling of hemi-sphere

不问归期 提交于 2019-12-02 04:05:07
I need to have hexagonal grid on a spherical surface. like shown here. Right now I am doing a hexagonal flattened grid. and the projecting it onto the surface of a hemisphere. Like here, But as you can see, the funny artifact is hexagons on the edge are disproportionately large. There should be a better way to do this so that all the hexagons are near equal in their size. I had tried the solution like @spektre had suggested but my code was producing following plot. i was using the a=sqrt(x*x+y*y)/r * (pi/2) because i wanted to scale a that goes from [0,r] to z [0,r] so angle a has bounds of [0