{"id":18722681,"url":"https://github.com/mdsumner/bluegum","last_synced_at":"2026-02-13T00:41:28.722Z","repository":{"id":72211213,"uuid":"210838144","full_name":"mdsumner/bluegum","owner":"mdsumner","description":"Create various forms of globe meshes","archived":false,"fork":false,"pushed_at":"2019-10-26T03:18:34.000Z","size":180,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T12:17:27.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mdsumner.github.io/bluegum/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsumner.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-25T12:21:47.000Z","updated_at":"2019-10-26T03:19:19.000Z","dependencies_parsed_at":"2023-02-24T05:30:32.203Z","dependency_job_id":null,"html_url":"https://github.com/mdsumner/bluegum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbluegum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbluegum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbluegum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fbluegum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsumner","download_url":"https://codeload.github.com/mdsumner/bluegum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239587244,"owners_count":19663892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:42:25.372Z","updated_at":"2026-02-13T00:41:28.684Z","avatar_url":"https://github.com/mdsumner.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nlibrary(bluegum)\n```\n\n\n## bluegum\n\n\u003c!-- badges: start --\u003e\n[![Travis build status](https://travis-ci.org/mdsumner/bluegum.svg?branch=master)](https://travis-ci.org/mdsumner/bluegum)\n[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/mdsumner/bluegum?branch=master\u0026svg=true)](https://ci.appveyor.com/project/mdsumner/bluegum)\n[![Codecov test coverage](https://codecov.io/gh/mdsumner/bluegum/branch/master/graph/badge.svg)](https://codecov.io/gh/mdsumner/bluegum?branch=master)\n[![CRAN status](https://www.r-pkg.org/badges/version/bluegum)](https://CRAN.R-project.org/package=bluegum)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\u003c!-- badges: end --\u003e\n\nThe goal of bluegum is to get the simplest mesh creation for the R-global project and outline the space of tools that already exist. \n\nCurrently this stuff is scattered over a mess of my projects, gris, anglr, silicate, quadmesh, and it's time to outline the bare essentials and just how powerful rgl (and some key friends) already are. \n\nWIP\n\n### Scope\n\nWe will limit to visualizations that use a geocentric projection of the Earth's surface - i.e. a globe. \n\nLuckily this does allow us to visit a lot of options. \n\n####  convex hull in 3D is Delaunay surface\n\nThe `tri_graticule()` function can create an entire sphere or a portion of one and use the convex hull method or a Delaunay-triangulation algorithm directly. \n\n\nIn hull mode, this could be used for arbitrary locations on the sphere and works as well with a portion of the sphere but the hull will also wrap around the inside of the sliced sphere so it's a different result. \n\n```{r del-hull, eval=FALSE}\nlibrary(bluegum)\nhull \u003c- tri_graticule(hull = TRUE)\nlibrary(rgl)\n#clear3d();\n#plot3d(hull, specular = \"black\")\n#rglwidget()\n```\n\nMake it more detailed so that individual faces aren't so visible. \n\n```{r del-hull-detail, eval=FALSE}\nhull \u003c- tri_graticule(n = 60 * c(1, 1/2), hull = TRUE)\nlibrary(rgl)\nclear3d()\nplot3d(hull, specular = grey(0.05))\nrglwidget()\n\n```\n\nIf we ask for a partial sphere when it's a hull, because the hull has to wrap around (well, you might want this but it's not faceted on those internal sides). \n\n```{r partial, eval=FALSE}\nhull \u003c- tri_graticule(xlim = c(100, 150),  hull = TRUE)\nclear3d()\nplot3d(hull, specular = \"black\")\nrglwidget()\n```\n\n### random points in hull mode\n\nThis mode requires us to set the number of coordinates (not the number of faces in x/y) and allows\ninput of points on the surface, or they are created randomly. \n\n```{r random, eval=FALSE}\nlibrary(rgl)\nhull \u003c- hull_graticule(n_coords = 24)\nclear3d()\nplot3d(hull, specular = \"black\")\nrglwidget()\n```\n\nWe can pass in a 2- or 3-column matrix of coordinates, with lon, lat, and elevation - 0\nis used if elevation is not included. \n\n```{r random-coords,eval=FALSE}\n\nhull \u003c- hull_graticule(coords = geosphere::randomCoordinates(120))\nclear3d()\nplot3d(hull, specular = \"black\")\nrglwidget()\n\n```\n\n\n\n\n### direct creation of delaunay hull\n\nIf we only want a sector and not wrap we need to use a triangulation tool directly, without hull mode. \n\n```{r sector, eval=FALSE}\nhull \u003c- tri_graticule(xlim = c(100, 150),  hull = FALSE)\nclear3d()\nplot3d(hull, specular = \"black\")\nrglwidget()\n```\n\nWe probably can't tell the difference, hull or otherwise. \n\n```{r delaunay, eval=FALSE}\nlibrary(bluegum)\nhull \u003c- tri_graticule(hull =FALSE)\nlibrary(rgl)\nclear3d();\nplot3d(hull, alpha = 0.5, specular = \"black\")\nrglwidget()\n\n```\n\n### direct creation of quads on the sphere\n\nThe function `quad_graticule()` will produce a sphere or a portion of one using a quadmesh. \nThe hull mode is not relevant with quad. \n\n\n```{r quad, eval=FALSE}\nhull \u003c- quad_graticule()\nlibrary(rgl)\nclear3d();\nplot3d(hull, alpha = 0.5, specular = \"black\")\nrglwidget()\n\n\nhull \u003c- quad_graticule(ylim = c(-10, 30))\nlibrary(rgl)\nclear3d();\nplot3d(hull, alpha = 0.5, specular = \"black\")\nrglwidget()\n\n```\n\n\n### 2.  icosa\n\nSee Agafonkin for a parallel tool in JS: https://twitter.com/mourner/status/1176159651953594370\n\n\n```R\nlibrary(icosa)\ng \u003c- icosa::trigrid(8)\nlibrary(rgl)\nclear3d()\n## note that we cannot index by name and use NA, hence match() here\nlines3d(g@vertices[match(t(cbind(g@edges, NA) ), rownames(g@vertices)), ])\nrglwidget()\n```\n\n### 3.  quadmesh+reproj direct from a raster\n\n### 4. terrain relief on mesh (trivial)\n\n### 5. image textures - mesh3d format (two-step indexing to 0,1)\n\n\n---\n\nPlease note that the 'bluegum' project is released with a\n  [Contributor Code of Conduct](CODE_OF_CONDUCT.md).\n  By contributing to this project, you agree to abide by its terms.\n  \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fbluegum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsumner%2Fbluegum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fbluegum/lists"}