anglr: Raster anglr

Description Usage Arguments Details Value Warning Examples

View source: R/anglr.R

Description

Colours not supported, this just gives the viridis palette sequentially.

Create primitive-based "mesh" structures from various inputs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## S3 method for class 'BasicRaster'
anglr(x, z = NULL, ..., na.rm = TRUE, type = NULL,
  max_area = NULL)

## S3 method for class 'trip'
anglr(x, z = NULL, ..., type = NULL, max_area = NULL)

anglr(x, z = NULL, ..., type = NULL, max_area = NULL)

## Default S3 method:
anglr(x, z = NULL, ..., type = NULL, max_area = NULL)

## S3 method for class 'SpatialMultiPoints'
anglr(x, z = NULL, ..., type = NULL,
  max_area = NULL)

## S3 method for class 'SpatialPoints'
anglr(x, z = NULL, ..., type = NULL,
  max_area = NULL)

## S3 method for class 'mesh3d'
anglr(x, z = NULL, ..., type = NULL, max_area = NULL)

Arguments

x

input data

z

raster, by default x is used

...

arguments passed to methods

na.rm

remove missing values

type

type of topology to create (LINE or POLYGON)

max_area

maximum area in coordinate system of x, passed to triangulate 'a' argument

Details

#' Methods exist for SpatialPolygons, SpatialLines, rgl mesh3d(triangle) ...

Value

quad_mesh

a list of tibble data frames, using the gris-map_table model

Warning

anglr only checks for presence of triangle centres within known holes, so this doesn't pick up examples of overlapping areas e.g. https://github.com/hypertidy/anglr/issues/39

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
library(raster)
w <- raster(volcano)
plot(anglr(w/300))

## -----------------------------------------------
## POLYGONS
data(simpleworld)
b <- anglr(simpleworld)
plot(b)
#if (require(rworldxtra)) {

#data(countriesHigh)
#sv <- c("New Zealand", "Antarctica", "Papua New Guinea",
#  "Indonesia", "Malaysia", "Fiji", "Australia")
#a <- subset(countriesHigh, SOVEREIGNT %in% sv)
#b7 <- anglr(a, max_area = 0.5)
#plot(globe(b7))
#}
## -----------------------------------------------
## LINES
#l1 <- anglr(as(a, "SpatialLinesDataFrame") )
#plot(l1)
#plot(globe(l1))

#data("flight_tracks", package = "silicate")
#r <- anglr(flight_tracks)
#plot(r)
#rgl::aspect3d(1, 1, 0.001)
#rgl::rglwidget()

## copy feature attributes onto vertices
#library(sf)
#example(st_read)
#library(rgl)
#rgl.clear(); plot(anglr(st_cast(nc, "MULTILINESTRING"), z = "BIR74"));

#x <- nc
## copy raster attributes onto vertices (must be same projection for now)
#topo <- raster(system.file("extdata", "gebco1.tif", package = "ang
#rgl.clear(); plot(anglr(x, z = topo/10));
#data("wrld_simpl", package= "maptools")
# rgl.clear(); plot(globe(anglr(st_as_sf(wrld_simpl[c(9, 160), ]), z = topo*1e4, max_area = .1)));

## we can nominate the output type so we aren't bound to what's come in
#rgl.clear(); plot(anglr(st_cast(x, "MULTILINESTRING"), z = topo/1000, type = "POLYGON"));
#rgl.clear(); plot(anglr(x, z = topo/1000, type = "LINE"));
## -----------------------------------------------
## RGL TRIANGLES
library(rgl)

dod <- anglr(dodecahedron3d(col = "cyan"))
octo <- anglr(translate3d(octahedron3d(col = "blue"), 6, 0, 0))
plot(dod, col = viridis::viridis(5)[1], alpha = 0.3)
plot(octo, col = viridis::viridis(5)[5], alpha = 0.3)
bg3d("grey")

r-gris/trimesh documentation built on March 19, 2018, 6:53 a.m.