rglwidget (version 0.1.1402)

vertexControl: Set attributes of vertices.

Description

This is a function to produce actions in a Shiny app. A Shiny input control (e.g. a sliderInput control) sets a value which controls attributes of a selection of vertices.

Usage

vertexControl(values = NULL, vertices = 1, attributes,
              objid, param = seq_len(NROW(values)), interp = TRUE)

Arguments

values
A matrix of values, each row corresponding to an input value.
vertices
Which vertices are being controlled? Specify vertices as a number from 1 to the number of vertices in the objid.
attributes
A vector of attributes of a vertex, from c("x", "y", "z", "red", "green", "blue", "alpha", "nx", "ny", "nz", "radius", "ox", "oy", "oz", "ts", "tt"). See Details.
objid
A single rgl object id.
param
Parameter values corresponding to each row of values.
interp
Whether to interpolate between rows of values.

Value

  • A list of cleaned up parameter values, to be used in an rgl controller.

Details

Like rgl::vertexSetter, this function modifies attributes of vertices in a single object. The attributes are properties of each vertex in a scene; not all are applicable to all objects. In order, the are: coordinates of the vertex "x", "y", "z", color of the vertex "red", "green", "blue", "alpha", normal at the vertex "nx", "ny", "nz", radius of a sphere at the vertex "radius", origin within a texture "ox", "oy" and perhaps "oz", texture coordinates "ts", "tt".

If only one attribute of one vertex is specified, values may be given as a vector and will be treated as a one-column matrix. Otherwise values must be given as a matrix with ncol(values) == max(length(vertices), length(attributes)).

Examples

Run this code
library(rgl)
  saveopts <- options(rgl.useNULL = TRUE)
  open3d()
  ids <- plot3d((-10):10, rnorm(21), rnorm(21))
  vertexControl(values = 10:(-10),
                vertices = 11, attributes="x", objid=ids["data"])
  options(saveopts)

Run the code above in your browser using DataCamp Workspace