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

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

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

## S3 method for class 'PATH'
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 silicate model

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. (WIP ... Otherwise a warning is issued if there's not overlap ... WIP)

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 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 recyling rule to expand out values, and nothing to stop the use of non numeric values being copied down. It's your model.

Value

silicate model with vertex values copied to vertices

Examples

1
2
3
4
5
6
library(raster)
r <- raster(volcano)
cl <- silicate::SC(rasterToContour(r))
plot3d(copy_down(cl, r)); rgl::rglwidget()
## looks funny?
auto_3d(z = 15); rgl::rglwidget()

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