basis3d {gellipsoid} | R Documentation |
Draw Basis Vectors in an rgl Scene
Description
The function calculates and optionally draws basis vectors to be used as
coordinate axes in an rgl 3D display. For geometric diagrams and some data
displays, this can be more useful than using axis3d
or
box3d
to provide guides or axes. The origin
argument permits multiple diagrams or graphs in the same display, each with
their own coordinate axes.
Usage
basis3d(
matrix = diag(3),
origin = c(0, 0, 0),
scale = 1,
draw = TRUE,
label = draw,
texts = colnames(basis),
lwd = 3,
cex = 2,
...
)
Arguments
matrix |
A 3 x 3 matrix, whose columns are the basis vectors, typically of unit length. |
origin |
Origin in the rgl scene of the basis vectors |
scale |
Scaling factor for the basis vectors |
draw |
If |
label |
If |
texts |
A character vector of length 3 used for labels. Defaults to
|
lwd |
Line width for vectors |
cex |
Character size for labels |
... |
Other arguments, passed to |
Value
Returns invisibly a 6 x 3 matrix, whose columns are the coordinate
axes, c("x", "y", "z")
. Odd numbered rows give the coordinates of
the origin
, while even numbered rows give the locations of the tips
of the vectors.
Author(s)
Michael Friendly
See Also
Examples
# show two different sets of basis vectors
open3d()
basis3d()
A <- matrix(c(1,2,0.1,
2,1,0.1,
0.1,0.1,0.5), 3,3)
basis3d(t(A), col="red")
# scene with two different displays
open3d()
basis3d()
basis3d(origin=c(2,0,0))