This control works with playwidget to change settings in a WebGL display in the same way as par3dinterp does within R.

par3dinterpControl(fn, from, to, steps, subscene = NULL, omitConstant = TRUE, ...)

Arguments

fn

A function returned from par3dinterp.

from, to, steps

Values where fn should be evaluated.

subscene

Which subscene's properties should be modified?

omitConstant

If TRUE, do not set values that are constant across the range.

...

Additional parameters which will be passed to propertyControl.

Details

par3dinterpSetter sets parameters corresponding to values produced by the result of par3dinterp.

Value

Returns controller data in a list of class "rglControl".

Author

Duncan Murdoch

Examples

example(plot3d)
#> 
#> plot3d>   open3d()
#> glX 
#>  65 
#> 
#> plot3d>   x <- sort(rnorm(1000))
#> 
#> plot3d>   y <- rnorm(1000)
#> 
#> plot3d>   z <- rnorm(1000) + atan2(x, y)
#> 
#> plot3d>   plot3d(x, y, z, col = rainbow(1000))
M <- r3dDefaults$userMatrix
fn <- par3dinterp(times = (0:2)*0.75, userMatrix = list(M,
                                      rotate3d(M, pi/2, 1, 0, 0),
                                      rotate3d(M, pi/2, 0, 1, 0)),
                                      scale = c(0.5, 1, 2))
control <- par3dinterpControl(fn, 0, 3, steps = 15)
control      
#> $type
#> [1] "propertySetter"
#> 
#> $value
#> [1] 0
#> 
#> $values
#>   [1]  1.000000000  0.000000000  0.000000000  0.000000000  0.342020143
#>   [6] -0.939692621  0.000000000  0.939692621  0.342020143  0.500000000
#>  [11]           NA           NA  0.998369041  0.050703068  0.026238445
#>  [16] -0.007314602  0.569415722 -0.822017173 -0.056619376  0.820484573
#>  [21]  0.568857901  0.534842192           NA           NA  0.989105392
#>  [26]  0.105661523  0.102499589 -0.060179738  0.925674268 -0.373504416
#>  [31] -0.134346277  0.363266834  0.921948093  0.637640343           NA
#>  [36]           NA  0.990712394  0.068794966  0.117286848 -0.086684321
#>  [41]  0.984106495  0.154984627 -0.104760587 -0.163712122  0.980929947
#>  [46]  0.814507563           NA           NA  0.996736229 -0.033919752
#>  [51] -0.073255303  0.057236229  0.936865474  0.344974053  0.056928930
#>  [56] -0.348040994  0.935749199  1.071663409           NA           NA
#>  [61]  0.828096222 -0.298486804 -0.474512672  0.343807557  0.938993751
#>  [66]  0.009332723  0.442778739 -0.170869435  0.880199196  1.396176643
#>  [71]           NA           NA  0.345267170 -0.719548401 -0.602528572
#>  [76]  0.320091606  0.693799362 -0.645123097  0.882231231  0.029875488
#>  [81]  0.469867545  1.731473131           NA           NA  0.034119704
#>  [86] -0.921358025 -0.387214714  0.048739806  0.388513287 -0.920153171
#>  [91]  0.998228570  0.012522584  0.058162769  1.964985298           NA
#>  [96]           NA  0.034119704 -0.921358025 -0.387214714  0.048739806
#> [101]  0.388513287 -0.920153171  0.998228570  0.012522584  0.058162769
#> [106]  1.964985298           NA           NA  0.345267170 -0.719548401
#> [111] -0.602528572  0.320091606  0.693799362 -0.645123097  0.882231231
#> [116]  0.029875488  0.469867545  1.731473131           NA           NA
#> [121]  0.828096222 -0.298486804 -0.474512672  0.343807557  0.938993751
#> [126]  0.009332723  0.442778739 -0.170869435  0.880199196  1.396176643
#> [131]           NA           NA  0.996736229 -0.033919752 -0.073255303
#> [136]  0.057236229  0.936865474  0.344974053  0.056928930 -0.348040994
#> [141]  0.935749199  1.071663409           NA           NA  0.990712394
#> [146]  0.068794966  0.117286848 -0.086684321  0.984106495  0.154984627
#> [151] -0.104760587 -0.163712122  0.980929947  0.814507563           NA
#> [156]           NA  0.989105392  0.105661523  0.102499589 -0.060179738
#> [161]  0.925674268 -0.373504416 -0.134346277  0.363266834  0.921948093
#> [166]  0.637640343           NA           NA  0.998369041  0.050703068
#> [171]  0.026238445 -0.007314602  0.569415722 -0.822017173 -0.056619376
#> [176]  0.820484573  0.568857901  0.534842192           NA           NA
#> [181]  1.000000000  0.000000000  0.000000000  0.000000000  0.342020143
#> [186] -0.939692621  0.000000000  0.939692621  0.342020143  0.500000000
#> [191]           NA           NA
#> 
#> $entries
#>  [1]  0  1  2  4  5  6  8  9 10  0 NA NA
#> 
#> $properties
#>  [1] "userMatrix" "userMatrix" "userMatrix" "userMatrix" "userMatrix"
#>  [6] "userMatrix" "userMatrix" "userMatrix" "userMatrix" "scale"     
#> [11] NA           NA          
#> 
#> $objids
#> [1] 878
#> 
#> $param
#>  [1] 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
#> 
#> $interp
#> [1] TRUE
#> 
#> attr(,"class")
#> [1] "rglControl"
if (interactive() || in_pkgdown_example()) 
  rglwidget(width = 500, height = 250) %>%
  playwidget(control,
       step = 0.01, loop = TRUE, rate = 0.5)