fertrecipes.blogg.se

Gridded sphere
Gridded sphere











gridded sphere

Other such divisions can be derived from a tetrahedron or an octahedron then at the corners of the triangles one will have triangles or squares, resp. a division into congruent equilateral triangles. (The icosahedron gives the finest regular division of the sphere surface into triangles, i.e. The corners of the icosahedron define the centers of the pentagons, the faces of the icosahedron define the patches of the mapped hexagonal grids.

#Gridded sphere code

the triangle corners coincide with hexagon centers, see the examples for n = 0,1,2,20:Ĭompute corners of icosahedron and define the 20 triangular faces of it (see code below). So this is a way to construct such a hexagonal grid on the sphere:Ĭreate triangular cutout of hexagonal grid: a fixed triangle (I chose (-0.5,0),(0.5,0),(0,sqrt(3)/2) ) gets superimposed a hexagonal grid with desired resolution n s.t. So there are 12 pentagons and 20 patches of a triangular cutout of a hexongal mesh mapped to the sphere. When five equilateral triangles meet in one corner and cover the whole sphere, this can only be the configuration induced by a icosahedron.

gridded sphere

You only need to implement truncate and dual operators for the shape you are looking for.įirst some analysis of the image in the question: the spherical triangle spanned by neighbouring pentagon centers seems to be equilateral. such as winged-edge or half-edge datastructures for your mesh. I would suggest using a datastructure that makes it easy to traverse the neighbourhood give a vertex, edge etc. You can already see where this is going.Īpply steps 3 & 4 repeatedly until you are satisfied.įor example below is the mesh for dtdtdtdtI. At this point the recipe is tdtI (read from right!). We apply the "Dual" operator (Conway notation d). We apply a "Truncate" operation (Conway notation t) to the mesh (the sperical mapping of this one is a football). The polyhedron you are looking for can be generated from an icosahedron - Initialise a mesh with an icosahedron. The construction is easy to follow step by step, you can click the images below to get a live preview. The ( rather elegant) algorithm to generate this (and many many more) can be succinctly encoded in something called a Conway Polyhedron Notation. P+coord_map("ortho", orientation = c(-38.49831, -179.The shape you have is one of so called "Goldberg polyhedra", is also a geodesic polyhedra. However, if we plot the cells on a sphere, we see that they are of equal area, as promised: #Replot on a spherical projection Note that the cells are distorted by the projection of this flat map. Geom_path (data=grid, aes(x=long, y=lat, group=group), alpha=0.4, color="white") Geom_polygon(data=grid, aes(x=long, y=lat, group=group), fill="green", alpha=0.4) + Geom_polygon(data=countries, aes(x=long, y=lat, group=group), fill=NA, color="black") + #Get polygons for each country of the world Grid <- dgcellstogrid(dggs,df$cell,frame=TRUE,wrapcells=TRUE) #Get the grid in a more convenient format Be wary of doing this if you have too many samples, though. WriteOGR(grid, "dgg_sample_cells.kml", "cells", "KML")Īt this point you're done! You can parse weed out any highly unlikely pentagons by counting vertices in the KML, if need be.įor kicks, let's plot which polygons were chosen. #Save the hex boundaries to a handy KML file for use in your project Grid <- dgcellstogrid(dggs,df$cell,frame=FALSE) #Get the corresponding grid cells for each randomly chosen lat-longĭf$cell <- dgtransform(dggs,df$lat,df$lon) #Future versions of the package will make it easier to reject the pentagonsĭggs <- dgconstruct(area=100000, metric=FALSE, resround='nearest') #But, with millions and millions of hexes, you are unlikely to choose one #Note: 12 cells are actually pentagons with an area 5/6 that of the hexagons #will tell you which area is closest to the one you want. #Note: Cells can only have certain areas, the `dgconstruct()` function below You could, of course, choose a much smaller value, but these #Construct a global grid in which every hexagonal cell has an area of #Distribute the points uniformly on a sphere using equations from It also saves the vertices of these hexagonal cells to a file for use in other contexts. The following code accomplishes what you want by distributing hexagonal cells of equal area uniformly across the surface of the Earth. You're also right that they're the only way you're going to get cells of equal area.įortunately, I've built an R package called dggridR which makes it easy to work with them. You're right that geodesic grids are tricky. This solution also produces an output file in a standard format that any language should be able to read. If you need a different language, many of them have interfaces to R that you could use. You don't specify if you have a language preference.













Gridded sphere