Copy down provides ways to transfer object level data values to vertex level.
copy_down(x, z = NULL, ..., .id = "z_") # S3 method for mesh3d copy_down(x, z = NULL, ..., .id = "z_") # S3 method for SC copy_down(x, z = NULL, ..., .id = "z_") # S3 method for SC0 copy_down(x, z = NULL, ..., .id = "z_") # S3 method for TRI copy_down(x, z = NULL, ..., .id = "z_") # S3 method for TRI0 copy_down(x, z = NULL, ..., .id = "z_") # S3 method for PATH copy_down(x, z = NULL, ..., .id = "z_") # S3 method for PATH0 copy_down(x, z = NULL, ..., .id = "z_") # S3 method for ARC copy_down(x, z = NULL, ..., .id = "z_") # S3 method for QUAD copy_down(x, z = NULL, ..., .id = "z_")
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_" |
a mesh3d or silicate model with vertex values copied to vertices (depending on the input argument 'x')
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.
library(raster)#>r <- raster(volcano) cl <- silicate::SC(rasterToContour(r)) plot3d(copy_down(cl, r)) ## looks funny? auto_3d() # \donttest{ 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#> class : SC #> type : Primitive #> vertices : 7544 (3-space) #> primitives : 3772 (1-space) #> crs : +proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs# }