[Rd] rgl rotations

Dominick Samperi djsamperi at gmail.com
Thu Apr 17 19:56:22 CEST 2014


Is there a way to change the viewpoint using view3d (or rgl.viewpoint)
with respect to
the image that currently appears rather than the perspective that rgl
thinks is the
default? For example, if I create an image and then perform what
should be a no-op:

rgl.viewpoint(userMatrix=rotationMatrix(0,1,0,0))

the image is rotated. Then I can perform rotations on the result
without surprises.
But I want to specify rotation with respect to the image as it
originally appeared,
or with respect to the viewpoint that is currently in effect.

Experimentation has revealed that when using rotationMatrix the z-axis
points out
of the canvas instead of pointing up as it often is in mathematics,
especially when
using the spherical coordinates (theta,phi).

I guess the question is: can we query rgl for the current viewpoint and then
apply changes to that? Another way of putting it is: can we do programmatically
what we can easily do using the mouse in interactive mode?

Thanks,
Dominick



More information about the R-devel mailing list