plot3d: 3D object plot

plot3dR Documentation

3D object plot

Description

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.

Usage

## S3 method for class 'TRI'
plot3d(x, ...)

## S3 method for class 'TRI0'
plot3d(x, ...)

## S3 method for class 'DEL'
plot3d(x, ...)

## S3 method for class 'DEL0'
plot3d(x, ...)

## S3 method for class 'QUAD'
plot3d(x, ...)

## S3 method for class 'matrix'
plot3d(x, ...)

## S3 method for class 'BasicRaster'
plot3d(x, ...)

## S3 method for class 'sc'
plot3d(x, ...)

## S3 method for class 'SC'
plot3d(x, ..., add = FALSE)

## S3 method for class 'SC0'
plot3d(x, ..., add = FALSE)

## S3 method for class 'PATH'
plot3d(x, ..., add = FALSE)

## S3 method for class 'sf'
plot3d(x, ..., add = FALSE)

## S3 method for class 'sfc'
plot3d(x, ..., add = FALSE)

## S3 method for class 'triangulation'
plot3d(x, ..., add = FALSE)

## S3 method for class 'Spatial'
plot3d(x, ..., add = FALSE)

## S3 method for class 'trip'
plot3d(x, ..., add = FALSE)

## S3 method for class 'ARC'
plot3d(x, ..., add = FALSE)

Arguments

x

silicate model, SC, TRI, ARC, or PATH

...

passed to material properties

add

add to plot or not

Details

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.

Value

rgl shape3d types (note that "segment3d" is currently an imaginary shape3d type)

See Also

wire3d as.mesh3d persp3d dot3d shade3d

Examples

library(silicate)
cad_tas$color_ <- rainbow(nrow(cad_tas))
x <- SC(cad_tas)
plot3d(x)

## plot3d anything
plot3d(volcano)
wire3d(volcano)
dot3d(volcano)


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

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)


r-gris/trimesh documentation built on Nov. 18, 2022, 2:46 a.m.