open3d: RGL Display Functions

Description Usage Arguments Details Value See Also Examples

View source: R/r3d.rgl.R

Description

open3d opens a new rgl window; cur3d returns the device number of the current window; close3d closes one or more windows.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
open3d(..., params = getr3dDefaults(), 
	    useNULL = rgl.useNULL(), silent = FALSE)
	    
close3d(dev = cur3d(), silent = TRUE)
	    
cur3d()

set3d(dev, silent = FALSE)

getr3dDefaults(class = NULL, value = NULL)

r3dDefaults

Arguments

...

arguments in tag = value form, or a list of tagged values. The tags must come from the graphical parameters described in par3d.

params

a list of graphical parameters

useNULL

whether to use the null graphics device

dev

which device to close or use

silent

whether report on what was done

class, value

names of components to retrieve

Details

open3d opens a new rgl device, and sets the parameters as requested. The r3dDefaults list returned by the getr3dDefaults function will be used as default values for parameters. As installed this sets the point of view to 'world coordinates' (i.e. x running from left to right, y from front to back, z from bottom to top), the mouseMode to (zAxis, zoom, fov), and the field of view to 30 degrees. Users may create their own variable named r3dDefaults in the global environment and it will override the installed one. If there is a bg element in the list or the arguments, it should be a list of arguments to pass to the bg3d function to set the background.

The arguments to open3d may include material, a list of material properties as in r3dDefaults, but note that high level functions such as plot3d normally use the r3dDefaults values in preference to this setting.

If useNULL is TRUE, rgl will use a “null” device. This device records objects as they are plotted, but displays nothing. It is intended for use with rglwidget.

Value

The open3d function returns the device that was opened. If silent = TRUE, it is returned invisibly.

The cur3d function returns the current device, or the value 0 if there isn't one.

set3d returns the device number of the previously active device.

The close3d function returns the new current device, invisibly.

The r3dDefaults variable is a list containing default settings. The getr3dDefaults function searches the user's global environment for r3dDefaults and returns the one in the rgl namespace if it was not found there. The components of the list may include any settable par3d parameter, or "material", which should include a list of default material3d properties, or "bg", which is a list of defaults to pass to the bg3d function.

See Also

rgl.useNULL for default usage of null device.

Examples

1
2
3
4
    r3dDefaults
    open3d()
    shade3d(cube3d(color = rainbow(6), meshColor = "faces"))
    cur3d()

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'. 
$userMatrix
     [,1]       [,2]      [,3] [,4]
[1,]    1  0.0000000 0.0000000    0
[2,]    0  0.3420201 0.9396926    0
[3,]    0 -0.9396926 0.3420201    0
[4,]    0  0.0000000 0.0000000    1

$mouseMode
[1] "trackball" "zoom"      "fov"       "pull"     

$FOV
[1] 30

$bg
$bg$color
[1] "white"

$bg$fogtype
[1] "none"


$family
[1] "sans"

$material
$material$color
[1] "black"

$material$fog
[1] TRUE


null 
   1 
null 
   1 

rgl documentation built on Feb. 1, 2021, 3:01 a.m.