Convert an object to a mesh3d
quadrangle mesh,
with methods for raster::raster()
and matrix
.
dquadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL
)
# S3 method for default
dquadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL
)
quadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL,
maxcell = 50000
)
# S3 method for SpatRaster
quadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL,
maxcell = 50000
)
# S3 method for BasicRaster
quadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL,
maxcell = 50000
)
# S3 method for matrix
quadmesh(
x,
z = x,
na.rm = FALSE,
...,
texture = NULL,
texture_filename = NULL,
maxcell = 50000
)
raster object for mesh structure
raster object for height values
remove quads where missing values?
ignored
optional input RGB raster, 3-layers
optional input file path for PNG texture
default number of raster or terra cells to plot, with a default lowish-number - set to NULL
to use native resolution
mesh3d
quadmesh()
generates the cell-based interpretation of a raster (AREA) but applies a continuous
interpretation of the values of the cells to each quad corner. dquadmesh
splits the mesh and
applies a discrete interpretation directly. Loosely, the quadmesh is a continuous surface and the dquadmesh
is free-floating cells, but it's a little more complicated and depends on the options applied. (The interpolation)
applied in the quadmesh case is not entirely consistent.
The output is described as a mesh because it is a dense representation of a continuous shape, in this case plane-filling quadrilaterals defined by index of four of the available vertices.
The z
argument defaults to the input x
argument, though may be set to NULL
, a constant
numeric value, or another raster. If the coordinate system of z
and x
don't match the z values
are queried by reprojection.
Any raster RGB object (3-layers, ranging in 0-255) may be used as
a texture on the resulting mesh3d object. If texture
is a palette raster it will be
auto-expanded to RGB.
It is not possible to provide rgl with an object of data for texture, it must be a PNG file and so
the in-memory texture
argument is written out to PNG file (with a message). The location of the file
may be set explicitly with texture_filename
. Currently it's not possible to not use the texture
object
in-memory.