copy_down: Copy down values to vertices

Description Usage Arguments Details Value Examples

View source: R/copy_down.R

Description

Copy down provides ways to transfer object level data values to vertex level.

Usage

 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
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'mesh3d'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'SC'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'SC0'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'TRI'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'TRI0'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'PATH'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'PATH0'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'ARC'
copy_down(x, z = NULL, ..., .id = "z_")

## S3 method for class 'QUAD'
copy_down(x, z = NULL, ..., .id = "z_")

Arguments

x

a mesh3d or a silicate object

z

object specifying values to copy down, a vector of values, a column name, a raster (see details)

...

currently ignored

.id

character value, the name of the resulting column in the vertices, default is "z_"

Details

Various methods are used depending on the second argument z.

If z is a raster (BasicRaster) a numeric value for each vertex is found by bilinear interpolation using raster::extract(raster, vertex, method = "bilinear"). Vertices are transformed into the space used by the raster if possible.

If z is a character value, that column is taken from the object table.

The .id argument must be character and exist as a column name in the object table.

If z is a vector or a constant value it's simply copied down.

No checking is done on the type of the result, and so there's nothing to stop the use of the recycling rule to expand out values, and nothing to stop the use of non numeric values being copied down.

Use silicate::TRI0() or DEL0() or silicate::SC0() to convert various spatial formats into suitable forms for this function.

Value

a mesh3d or silicate model with vertex values copied to vertices (depending on the input argument 'x')

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(raster)
r <- raster(volcano)
cl <- silicate::SC(rasterToContour(r))
plot3d(copy_down(cl, r))
## looks funny?
auto_3d()


sc <- copy_down(SC0(cont_tas), "ELEVATION")
sc$object$color_ <- hcl.colors(nrow(sc$object), "YlOrRd")
 plot3d(sc)

 ## a planar straight line graph with x, y (UTM) and ELEVATION (metres)
 sc

anglr documentation built on July 29, 2020, 9:06 a.m.