The function mba.surf
returns a surface approximated from a
bivariate scatter of data points using multilevel B-splines.
mba.surf(xyz, no.X, no.Y, n = 1, m = 1, h = 8, extend=FALSE,
sp=FALSE, ...)
List with 8 component:
a list that contains vectors x, y and the
no.X
from arguments.
no.Y
from arguments.
n
from arguments.
m
from arguments.
h
from arguments.
extend
from arguments.
sp
from arguments.
b.box
defines the bounding box over which z is estimated.
a
resolution of the approximated surface along the x axis.
resolution of the approximated surface along the y axis.
initial size of the spline space in the hierarchical construction along the x axis. If the rectangular domain is a square, n = m = 1 is recommended. If the x axis is k times the length of the y axis, n = 1, m = k is recommended. The default is n = 1.
initial size of the spline space in the hierarchical construction along the y axis. If the y axis is k times the length of the x axis, m = 1, n = k is recommended. The default is m = 1.
Number of levels in the hierarchical construction. If, e.g.,
n = m = 1 and h = 8, the resulting spline surface has a coefficient
grid of size
if FALSE, a convex hull is computed for the input points
and all matrix elements in z that have centers outside of this
polygon are set to NA
; otherwise, all elements in z are given an
estimated z value.
if TRUE, the resulting surface is returned as a
SpatialPixelsDataFrame
object; otherwise, the surface is in
image
format.
b.box
is an optional vector to sets the bounding
box. The vector's elements are minimum x, maximum x, minimum y, and maximum
y, respectively.
mba.points
if (FALSE) {
data(LIDAR)
mba.int <- mba.surf(LIDAR, 300, 300, extend=TRUE)$xyz.est
# Image plot of the surface.
image(mba.int, xaxs = "r", yaxs = "r")
# Perspective plot of the surface.
persp(mba.int, theta = 135, phi = 30, col = "green3", scale = FALSE,
ltheta = -120, shade = 0.75, expand = 10, border = NA, box = FALSE)
# For a good time, I recommend using rgl.
library(rgl)
# Exaggerate z a bit for effect.
mba.int$z <- 10*mba.int$z
# Make nice colors for the rgl surface.
zlim <- range(mba.int$z)
zlen <- zlim[2] - zlim[1] + 1
colorlut <- terrain.colors(zlen) # Height color lookup table.
col <- colorlut[mba.int$z - zlim[1] + 1 ] # Assign colors to heights for each point.
open3d()
surface3d(mba.int$x, mba.int$y, mba.int$z, color = col)
}
Run the code above in your browser using DataLab