Convert a rectangular grid of points into a hexagonal grid


I have a rectangular grid of points like thisenter image description here and I want to get indices of these points which forms a hexagonal grid like this enter image description here.

How can I "Hexagonalize" the rectangular grid given that I want to draw only complete hexagons?

EDIT:

I added another picture showing what I want to achieve enter image description here


Answers:


You can create two grids, one with dimensions N/2xN/2 where N=20, and the other is (N-1)/2+1x(N-1)/2+1. If the index called is odd, you go to the inner cells in your drawing with length N-1, otherwise the outer ones with length N.

I guess this would be the most economical/optimized way to go.