Questions tagged [hexagonal-tiles]

Tessellating tiles for use as 2d-histogram bins, game boards, etc.

Hexagonal tiles are tessellating hexagons placed adjacently to each other.

The use of this tag is fairly broad, encompassing statistics, computer science and game design.

234 questions
5
votes
6 answers

Algorithm for creating cells by spiral on the hexagonal field

Help to find an algorithm for creating cells by spiral on the hexagonal field. Look at the image: Let's imagine an dimensionless 2d array. The X axis is the blue line, Y is horizontal, spiral is red. I need to add cells from the central point…
Coyod
  • 2,656
  • 2
  • 18
  • 13
5
votes
1 answer

Calculate grid distance between hexagons

I have a hexagonal grid like the one in the picture and Im trying to find the easiest way(a formula maybe) to calculate the distance between two hexagons inside this grid. Of course the size of my grid is bigger than this but Im trying to find a…
Drill
  • 169
  • 2
  • 3
  • 12
4
votes
1 answer

How to create regular hexagons on java to put on a map?

I'm trying to create regular hexagon polygons, but when visualized on a map they are stretched vertically. This is how I do it: List hexagons = new ArrayList<>(); CoordinateReferenceSystem sourceCRS = DefaultGeographicCRS.WGS84; …
Ante
  • 41
  • 3
4
votes
3 answers

How to properly draw hexagons with offset coordinates?

This is my code: import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon import numpy as np offCoord = [[-2,-2],[-1,-2],[0,-2],[1,-2],[2,-2]] fig, ax = plt.subplots(1) ax.set_aspect('equal') for c in offCoord: hex =…
Alex R
  • 83
  • 1
  • 8
4
votes
2 answers

Create hexagonal field with JavaFX

I have the goal to create a field of hexagonal tiles. I have come as far as having a matrix of cells, each high enough to fit the complete hexagon image: import javafx.application.Application; import javafx.scene.Scene; import…
Dennis
  • 1,061
  • 10
  • 21
4
votes
1 answer

How to Make Hexagonal JButtons

I have written a short game. In the existing implementation I have a GridBagLayout with buttons located as chess board. Each button occupies the whole grid. Game works fine. My next task is to change the board to be consist of hexagonal buttons, not…
SigGP
  • 716
  • 1
  • 11
  • 24
4
votes
1 answer

How to get rid of boundary lines in ggplot geom_hex

I really like the idea of a hexbin density plot in ggplot, and I try to use it (instead of a square-shaped bin as produced by stat_bin2d) whenever I can. However, the boundries of the hexagons are sometimes obvious. For example, d <-…
Ying Zhang
  • 171
  • 6
4
votes
2 answers

Drawing a hex grid in Flash?

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..
Timmy
  • 12,468
  • 20
  • 77
  • 107
4
votes
1 answer

Draw a hexagon tessellation animation in Python

Now I have a function called Hexagon(x,y,n) which will draw a hexagon centered on (x,y) and with side length of n in python window. My goal is to draw a tessellation animation which will draw the hexagon one after another from the center of the…
user2063057
  • 43
  • 1
  • 3
4
votes
1 answer

Tweaking Heightmap Generation For Hexagon Grids

Currently I'm working on a little project just for a bit of fun. It is a C++, WinAPI application using OpenGL. I hope it will turn into a RTS Game played on a hexagon grid and when I get the basic game engine done, I have plans to expand it…
4
votes
3 answers

Combine Arbitrary number of polygons together

I have an arbitrary number of polygons (hexes in this case) that are arranged randomly, but they are all touching another hex. Each individual hex has 6 x,y vertices. The vertex's are known for all the hexes. Can anyone point me in the direction of…
Jake Wilson
  • 88,616
  • 93
  • 252
  • 370
4
votes
2 answers

ggplot2 stat_binhex(): keep bin radius while changing plot size

I'd like to a find a way to keep regular hexagons (all sides have equal length) when resizing hexbin plots in ggplot2 without manually adjusting the binwidth parameter. To illustrate: d <- ggplot(diamonds, aes(carat, price))+ …
metasequoia
  • 7,014
  • 5
  • 41
  • 54
4
votes
2 answers

How can I, using current web tech, generate a hexagonal, interactive map

I want to learn html5/current web techs, specifically to create a game. Initially I want to be able to generate a top down, 2d map, made up of hexagonal tiles. These tiles will be randomly generated with the usual environmental tiles (grass,…
aSystemOverload
  • 2,994
  • 18
  • 49
  • 73
3
votes
0 answers

map a hex to original data points in geom_hex

I am trying to map hex from geom_hex to original data points. For example I want to find points in the iris dataframe that are related to highlighted hex (red circle). data("iris") rownames(iris) <- paste0("R", 1:nrow(iris)) plt <- ggplot(iris,…
Anna
  • 31
  • 2
3
votes
1 answer

Convert between spiral coordinates and axial coordinates in hexagon grid

I'm making a hexagon tile based game, which generates a honeycomb arrangement of hexagons in a spiral shape. My goal is to convert a world position (e.g. a mouse click) to a spiral coordinate (index / layer / position around layer). I can't think of…
Jomity
  • 56
  • 8
1 2
3
15 16