This is the workhorse function for anglr, the idea is that just about anything can be plotted in a 3D scene, polygons, lines, rasters, matrix. These objects from sp, sf, raster, trip, and silicate should all work.
# S3 method for TRI plot3d(x, ...) # S3 method for TRI0 plot3d(x, ...) # S3 method for DEL plot3d(x, ...) # S3 method for DEL0 plot3d(x, ...) # S3 method for QUAD plot3d(x, ...) # S3 method for matrix plot3d(x, ...) # S3 method for BasicRaster plot3d(x, ...) # S3 method for sc plot3d(x, ...) # S3 method for SC plot3d(x, ..., add = FALSE) # S3 method for SC0 plot3d(x, ..., add = FALSE) # S3 method for PATH plot3d(x, ..., add = FALSE) # S3 method for sf plot3d(x, ..., add = FALSE) # S3 method for sfc plot3d(x, ..., add = FALSE) # S3 method for triangulation plot3d(x, ..., add = FALSE) # S3 method for Spatial plot3d(x, ..., add = FALSE) # S3 method for trip plot3d(x, ..., add = FALSE) # S3 method for ARC plot3d(x, ..., add = FALSE)
x | silicate model, SC, TRI, ARC, or PATH |
---|---|
... | passed to material properties |
add | add to plot or not |
rgl shape3d types (note that "segment3d" is currently an imaginary shape3d type)
The function plot3d()
covers the full suite of plotting functions from
rgl::plot3d()
for meshes, points, and lines. This main function includes the
family of dot3d()
, wire3d()
, and persp3d()
and each works with
matrix, raster, sf, sp, trip, RTriangle, and silicate models. Each of the
mesh-surface forms rely on as.mesh3d()
conversion behind the scenes,
whereas plot3d()
for the linear types (sf, sp, trip, and from silicate SC,
SC0, PATH, PATH0, and ARC0) all are plotted using rgl segments without going
through a triangulated surface form. This reflects their underlying topology
when it comes to 3D visualization and analysis.
If the scene looks funny the aspect ratio might be poor, we've decided not to
automatically update this with normal plots, but running auto_3d()
will
attempt to set a reasonable aspect ratio. It can also be used to set
exaggerations in different axes.
For SC edges are matched to their object/s. One object's properties is
applied as colour. If color_
column is present on the data object table it
is used.
If the argument 'color' is used, this is passed down to the rgl plot function - and will be applied per primitive, not per silicate object. This provides flexibility but does require knowledge of the underlying structures in use.
library(silicate) cad_tas$color_ <- rainbow(nrow(cad_tas)) x <- SC(cad_tas) plot3d(x) ## plot3d anything plot3d(volcano) wire3d(volcano) dot3d(volcano) # \donttest{ plot3d(cad_tas) persp3d(cad_tas) wire3d(cad_tas) dot3d(cad_tas) # } ## add Z elevation to an sf polygon in a mesh plot3d(copy_down(as.mesh3d(silicate::minimal_mesh), raster::raster(volcano))) ## but make it much more interesting # \donttest{ plot3d(copy_down(as.mesh3d(DEL(silicate::minimal_mesh, max_area = 0.0001)), raster::raster(-volcano)), col = c("black", "orange")); auto_3d() wire3d(silicate::minimal_mesh) # }