hexagonal-tiles

Hexagonal tilling of hemi-sphere

孤人 提交于 2019-12-20 05:16:13
问题 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

ggplot2 multiple stat_binhex() plots with different color gradients in one image

荒凉一梦 提交于 2019-12-18 12:26:27
问题 I'd like to use ggplot2's stat_binhex() to simultaneously plot two independent variables on the same chart, each with its own color gradient using scale_colour_gradientn(). If we disregard the fact that the x-axis units do not match, a reproducible example would be to plot the following in the same image while maintaining separate fill gradients. d <- ggplot(diamonds, aes(x=carat,y=price))+ stat_binhex(colour="white",na.rm=TRUE)+ scale_fill_gradientn(colours=c("white","blue"),name =

Manhattan Distance between tiles in a hexagonal grid

不问归期 提交于 2019-12-17 17:50:48
问题 For a square grid the euclidean distance between tile A and B is: distance = sqrt(sqr(x1-x2)) + sqr(y1-y2)) For an actor constrained to move along a square grid, the Manhattan Distance is a better measure of actual distance we must travel: manhattanDistance = abs(x1-x2) + abs(y1-y2)) How do I get the manhattan distance between two tiles in a hexagonal grid as illustrated with the red and blue lines below? 回答1: I once set up a hexagonal coordinate system in a game so that the y -axis was at a

How to draw a hexagon map in libGdx using the Polygon class?

狂风中的少年 提交于 2019-12-13 18:38:59
问题 I recently asked this question on how to draw a hexagon in Android. After finding in the accepted answer that I would have to use umpteen lines of [repetitive] code (compared to the eleven when using regular Java Graphics and Polygon objects) I began to search for solutions. I found that libGdx has a Polygon class. I began trying to implement the code in the linked question (the code my question started out with) with slight modification, including replacing the graphics class. I stumbled

Hexagonal grid representing a cellular network as used in mobile communication systems

谁说胖子不能爱 提交于 2019-12-12 09:56:40
问题 I am relatively new to Matlab and I want to generate a hexagonal grid that represents a cellular network where each hexagon has a specific behaviour. My question is how does one go from a square grid to hex grid (transfer matrix)?. This is what I have so far. [X,Y] = meshgrid(0:60); figure(1), plot(X,Y,'b') hold on, plot(Y,X,'b') axis square 回答1: A few years ago I wrote some code to do just that: %// Define input data: close all clear all M_max = 14; %// number of cells in vertical direction

How to plot (x,y,z) coordinates in the shape of a hexagonal grid?

為{幸葍}努か 提交于 2019-12-10 12:19:36
问题 If for example, I have the following coordinates with corresponding colors which represent a hexagonal shaped grid of hexagons: coord = [[0,0,0],[0,1,-1],[-1,1,0],[-1,0,1],[0,-1,1],[1,-1,0],[1,0,-1]] colors = [["Green"],["Blue"],["Green"],["Green"],["Red"],["Green"],["Green"]] How can one plot this in Python so that the points on the plot retain that hexagonal shape? Additionally how can one represent the 'colors' list on the hexagon. Somewhat like this: Simple Hexagonal grid But the look

Hexagonal grid representing a cellular network as used in mobile communication systems

大兔子大兔子 提交于 2019-12-06 11:12:19
I am relatively new to Matlab and I want to generate a hexagonal grid that represents a cellular network where each hexagon has a specific behaviour. My question is how does one go from a square grid to hex grid (transfer matrix)?. This is what I have so far. [X,Y] = meshgrid(0:60); figure(1), plot(X,Y,'b') hold on, plot(Y,X,'b') axis square A few years ago I wrote some code to do just that: %// Define input data: close all clear all M_max = 14; %// number of cells in vertical direction N_max = 10; %// number of cells in horizontal direction trans = 1; %// hexagon orientation (0 or 1) %// Do

Hexagon grid on sphere without pentagon

隐身守侯 提交于 2019-12-05 16:21:50
问题 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! 回答1: Impossible. This is mathemetical theorem. Only imprecise ways exist I guess.

Perspective Coords for 2D Hex Grid

时光怂恿深爱的人放手 提交于 2019-12-04 20:34:33
Here's a stumper... Porting some old code, I have this 2D hex grid being rendered in 2.5D: The y-scale & position of the tiles is calculated for perspective, but I'd like to scale & position them for perspective horizontally as well (the toons at the top of the board look squished). Here's the current code: const SCALE_X = PixiStages.game._width * 0.0012; const SCALE_Y = PixiStages.game._height * 0.0018; this.scale.x = SCALE_X; this.scale.y = SCALE_Y * ( 0.5 + 0.5 * gamePiece.y / Game.TILE_ROWS ); const getStageXFromBoardX = ( board_x ) => { const tileWidth = SCALE_X * 38; return board_x

Tweaking Heightmap Generation For Hexagon Grids

拟墨画扇 提交于 2019-12-04 15:03:27
问题 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 further. At the moment my application consists of a VBO that holds vertex and heightmap information. The heightmap is generated using a midpoint displacement algorithm (diamond-square). In order to implement a hexagon grid I went with the idea explained