cloud
and wireframe
.panel.cloud(x, y, z, subscripts,
groups, distance, xlim, ylim, zlim,
panel.3d.cloud, panel.3d.wireframe,
rot.mat, aspect,
par.box,
xlab, ylab, zlab, scales.3d,
proportion = 0.6, wireframe = FALSE,
scpos = list(x = 1, y = 8, z = 12), ..., col.at, col.regions)
panel.wireframe(...)
ltransform3dMatrix(screen, R.mat)
ltransform3dto3d(x, R.mat, za = 1 , zb = 0, zmin, zmax, dist)
panel.3dscatter.old(x, y, z, rot.mat = diag(4), za, zb,
zback, zfront, distance,
groups = NULL,
subpanel = if (is.null(groups)) "panel.xyplot"
else "panel.superpose",
...)
panel.3dscatter(x, y, z, rot.mat = diag(4), za, zb,
zback, zfront, distance,
zlim, zero,
groups = NULL, subscripts = TRUE,
type = 'p',
col, col.point, col.line, lty, lwd, cex, pch, ...)
panel.3dwire(x, y, z, rot.mat = diag(4), za, zb,
minz = 0, maxz = 1,
col.at, col.regions,
shade = FALSE,
shade.colors = palette.shade,
light.source = c(1, 0, 0),
col = "black",
col.groups = superpose.line$col,
...)
palette.shade(cosangle, height, saturation = .3, ...)
panel.cloud
), not necessarily of the same
length. x
can be a numeric matrix with 3 rows for
ltransform3dto3d
cloud
cloud
wireframe
cloud
drape = TRUE
in wireframe
panel.3dscatter
once coordinates of their projections are
computed. subpanel="panel.superpose"
along with the
groups
argument can be used to create grouped displaycloud
s
in hsv
inside
palette.shade
cloud
and wireframe
. panel.wireframe
is the
same as panel.cloud
, which does the actual work. panel.cloud
is responsible for drawing the content that does
not depend on the data, namely, the bounding box, the arrows/scales,
etc. At some point, depending on whether wireframe
is TRUE, it
calls either panel.3d.wireframe
or panel.3d.cloud
, which
draws the data-driven part of the plot.
The arguments accepted by these two functions are different, since
they have essentially different purposes. For cloud, the data is
unstructured, and x, y, z
are all passed to the
panel.3d.cloud
function. For wireframe, on the other hand,
x
and y
are increasing vectors with unique values,
defining a rectangular. z
must be a matrix with length(x)
* length(y)
rows, and as many columns as the number of groups.
panel.3dscatter
is the default panel.3d.cloud
function,
which computes the projection of the points and calls the
subpanel
function to draw the points in 2-D. (It's a very
simple function, and could serve as a model for customizing the
contents of the panels in cloud
.)
panel.3dscatter.new
is intended as a replacement for
panel.3dscatter
in future versions. Has a type
argument
to control type of plot. Has some nice properties, but is still in an
experimental stage.
panel.3dwire
is the default panel.3d.wireframe
function. If shade = TRUE
, it attempts to color the surface as
being illuminated from a light source at infinite distance, in the
direction given by light.source
. palette.shade
is a
simple function that returns the apropriate colors required for
shading given the cosine of twice the angle of between the viewing
direction and the direction of the light source, and a height between
0 and 1. (No shadows are formed, though.) Multiple surfaces are drawn
if groups
is non-null in the call to wireframe
, however,
the algorithm is not sophisticated enough to render intersecting
surfaces correctly.
ltransform3dMatrix
and ltransform3dto3d
are utility
functions to help computation of projections. The first function takes
a list of the form of the screen
argument in cloud
and
wireframe
and a R.mat
, a 4x4 transformation matrix in
homogeneous coordinates, to return a new 4x4 transformation matrix that
is the result of applying R.mat
followed by the rotations in
screen
. The second function applies a 4x4 transformation matrix
in homogeneous coordinates to a 3xn matrix representing points in 3-D
space, and optionally does some perspective computations. (There has
been no testing with non-trivial transformation matrices, and my
knowledge of the homogeneous coordinate system is very limited, so
there might be bugs here.)
cloud