The anglr package gives direct access to generic 3D tools and provides a full suite of mesh-creation and 3D plotting functions. By extending the rgl package conversion and visualization functions for the mesh3d class a wide variety of complex spatial data can be brought into 3D scenes. These tools allow for spatial raster, polygons, and lines that are common in GIS contexts to be converted into mesh forms with high flexibility and the ability to integrate disparate data types. Vector and raster data can be seamlessly combined as meshes, and surfaces can be set to have material properties based on data values or with image textures. Textures and other data combinations use projection transformations to map between coordinate systems, and objects can be easily visualized in an interactive scene at any stage.

Details

The 'anglr' package show-cases extended features for geo-spatial data by extending and supporting the data models of the silicate package. Any kind of spatial data is intended to be supported, not just the geographic ones:

  • coordinates beyond X and Y, or longitude and latitude

  • storing attributes on vertices, primitives, branches (parts), or objects

  • topology and geometry are distinguishable and not conflated

  • spatial data can be represented as a graph of spatial primitives

  • polygons as true surfaces, not just path structures with a 2D-only region-filling rule

  • TBD higher dimensional primitives are possible

  • TBD n-dimensional rasters with curvilinear coordinates, and the discrete-continuous distinction

Licensing

The anglr package is released with license CC BY-NC-SA 4.0 to match the one dependency RTriangle. Please note and respect the license of the RTriangle package used by the DEL() or DEL0() functions in anglr, and invoked within 3D plot methods. These return high-quality constrained Delaunay triangulations of polygonal regions, with the ability to control mesh characteristics including maximum triangle area, minimum internal angle, and conformance to the Delaunay criterion. If you are interested in a less restrictive license for high-quality meshing in R please get involved with the laridae package which aims to provide access to CGAL.

Creation

as.mesh3dcoercion function to convert most spatial data to mesh forms
SCand other silicate models are all supported, including the structural forms SC0, TRI0, PATH0
Spatialmost spatial types can be used directly including raster and sf
DELcreate a mostly-Delaunay shape-preserving constrained triangulation

III. Plotting

As much as possible plotting will represent the true nature of the data given.

mesh_plotplot in 2D, including curvilinear reprojections with rasters
plot3dand related 3D plot functions in rgl can be used directly on most input types
globeconvert X,Y planar or angular to 3D on the surface of a globe, based on the data in longitude-latitude form
plot3d.SCplot 1D topology in 3D geometry space
plot3d.TRIplot 2D topology in 3D geometry space (DEL or TRI)

Options and technicalities

There is an option set for the maximum number of triangles that can be generated by the DEL() or DEL0() models when using the max_area argument. Inspect the limit with getOption("anglr.max.triangles") or set a new limit with options(anglr.max.triangles = <new limit>).

In terms of the RTriangle::triangulate() function the max_area argument controls and masks the a argument for RTriangle. It's possible to pass in values for q, Y, j, D, S, V, and Q - but we don't recommend experimenting with these unless you know what they are for. There is a coarse check for a limit on the number of triangles that can be created but general caution is advised when experimenting.