Description Usage Arguments Details Value Note Author(s) Examples
This function sets the location of the viewer.
1 | observer3d(x, y = NULL, z = NULL, auto = FALSE)
|
x, y, z |
The location as a 3 vector, using the usual |
auto |
If |
This function
sets the location of the viewer relative to the scene, after the model transformations
(scaling, rotation) have been done, but before lighting or projection have been
applied. (See par3d
for details on the rendering pipeline.)
The coordinate system is a slightly strange one: the X coordinate
moves the observer location from left to right, and the Y coordinate moves up
and down. The Z coordinate changes the depth from the viewer. All are measured
relative to the center of the bounding box (par("bbox")
) of the subscene.
The observer always looks in the positive Z direction
after the model rotation have been done. The coordinates are in post-scaling
units.
Invisibly returns the previous value.
This function is likely to change in future versions of rgl, to allow more flexibility in the specification of the observer's location and orientation.
Duncan Murdoch
1 2 | example(surface3d) # The volcano data
observer3d(0, 0, 440) # Viewed from very close up
|
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
srfc3d> #
srfc3d> # volcano example taken from "persp"
srfc3d> #
srfc3d>
srfc3d> data(volcano)
srfc3d> z <- 2 * volcano # Exaggerate the relief
srfc3d> x <- 10 * (1:nrow(z)) # 10 meter spacing (S to N)
srfc3d> y <- 10 * (1:ncol(z)) # 10 meter spacing (E to W)
srfc3d> zlim <- range(z)
srfc3d> zlen <- zlim[2] - zlim[1] + 1
srfc3d> colorlut <- terrain.colors(zlen) # height color lookup table
srfc3d> col <- colorlut[ z - zlim[1] + 1 ] # assign colors to heights for each point
srfc3d> open3d()
null
1
srfc3d> surface3d(x, y, z, color = col, back = "lines")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.