Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

viewpoint

Set up viewpoint


Description

Set the viewpoint orientation.

Usage

view3d( theta = 0, phi = 15, ...)
rgl.viewpoint( theta = 0, phi = 15, fov = 60, zoom = 1, 
        scale = par3d("scale"), interactive = TRUE, userMatrix, 
        type = c("userviewpoint", "modelviewpoint") )

Arguments

theta, phi

polar coordinates

...

additional parameters to pass to rgl.viewpoint

fov

field-of-view angle in degrees

zoom

zoom factor

scale

real length 3 vector specifying the rescaling to apply to each axis

interactive

logical, specifying if interactive navigation is allowed

userMatrix

4x4 matrix specifying user point of view

type

which viewpoint to set?

Details

The data model can be rotated using the polar coordinates theta and phi. Alternatively, it can be set in a completely general way using the 4x4 matrix userMatrix. If userMatrix is specified, theta and phi are ignored.

The pointing device of your graphics user-interface can also be used to set the viewpoint interactively. With the pointing device the buttons are by default set as follows:

left

adjust viewpoint position

middle

adjust field of view angle

right or wheel

adjust zoom factor

The user's view can be set with fov and zoom.

If the fov angle is set to 0, a parallel or orthogonal projection is used. Small non-zero values (e.g. 0.01 or less, but not 0.0) are likely to lead to rendering errors due to OpenGL limitations.

Prior to version 0.94, all of these characteristics were stored in one viewpoint object. With that release the characteristics are split into those that affect the projection (the user viewpoint) and those that affect the model (the model viewpoint). By default, this function sets both, but the type argument can be used to limit the effect.

See Also

Examples

## Not run: 
# animated round trip tour for 10 seconds

rgl.open()
shade3d(oh3d(), color = "red")

start <- proc.time()[3]
while ((i <- 36*(proc.time()[3] - start)) < 360) {
  rgl.viewpoint(i, i/4); 
}

## End(Not run)

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.