Description Usage Arguments Details Value Author(s) Examples
These functions take a user orientation matrix from an rgl scene and approximate the parameters to either lattice or base graphics functions.
1 2 | rglToLattice(rotm = par3d("userMatrix"))
rglToBase(rotm = par3d("userMatrix"))
|
rotm |
A matrix in homogeneous coordinates to convert. |
The lattice package can use Euler angles in
the ZYX scheme to describe the rotation of a scene
in its wireframe
or
cloud
functions. The
rglToLattice
function computes these angles
based on rotm
, which defaults to the current
user matrix. This allows rgl to be used
to interactively find a decent viewpoint and
then reproduce it in lattice.
The base graphics persp
function does
not use full Euler angles; it
uses a viewpoint angle, and assume the z axis
remains vertical. The rglToBase
function
computes the viewpoint angle accurately if the
rgl scene is displayed with a vertical
z axis, and does an approximation otherwise.
rglToLattice
returns a list suitable to
be used as the screen
argument to
wireframe
.
rglToBase
returns a list containing
theta
and phi
components which
can be used as corresponding arguments in persp
.
Duncan Murdoch
1 2 3 4 5 6 7 8 9 | persp3d(volcano, col = "green")
if ((hasorientlib <- requireNamespace("orientlib")) &&
requireNamespace("lattice"))
lattice::wireframe(volcano, screen = rglToLattice())
if (hasorientlib) {
angles <- rglToBase()
persp(volcano, col = "green", border = NA, shade = 0.5,
theta = angles$theta, phi = angles$phi)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.