IcoGrid-0.1.2: Library for generating grids of hexagons and pentagons mapped to a sphere.

Data.IcoGrid

Synopsis

Documentation

all_cells :: Int -> [Int]Source

Get a list of all cells in a grid of a given size. The length of this list is the number of cells, and they are numberd from 0 to n-1.

all_triads :: Int -> [(Int, Int, Int)]Source

Get all groups of 3 cells that meet at a point in the whole grid (of a given size). Each triad is repeated 3 times, with a different cell as the first one in the list.

neighbors :: Int -> Int -> [Int]Source

Get a list of neighbors of a particular cell, assuming a grid of a certain size.

coord_to_vec :: Int -> Int -> VecSource

Get the center of a cell as a point in 3-space, assuming a grid of a certain size. I have not yet implemented the reverse function, which is to find the closest cell to a given point.

triad_vecs :: Int -> (Int, Int, Int) -> [Vec]Source

Return list of vectors with the center vertex as head, and then the vertex between center and first neighbor, vertex in the middle, and a vertex between the center and the second neighbor. Can be drawn with a triangle fan. By drawing all the triads in this fashion, one can draw the whole grid. I left a little bit of a gap between cells to make the edges easier to see.