`vertexControl.Rd`

This is a function to produce actions in a web display. A
`playwidget`

or Shiny
input control (e.g. a `sliderInput`

control)
sets a value which controls attributes of a selection of vertices.

- value
The value to use for input (typically

`input$value`

in a Shiny app.) Not needed with`playwidget`

.- 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", "radii", "ox", "oy", "oz", "ts", "tt", "offset")`

. See Details.- objid
A single RGL object id.

- tag
An alternate way to specify

`objid`

.- param
Parameter values corresponding to each row of

`values`

.- interp
Whether to interpolate between rows of

`values`

.

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,
they 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"`

.

Planes are handled specially. The coefficients `a, b, c`

in the `planes3d`

or `clipplanes3d`

specification are controlled
using `"nx", "ny", "nz"`

, and `d`

is handled as
`"offset"`

. The `vertices`

argument is interpreted
as the indices of the planes when these attributes are set.

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))
```

. The `vertices`

and `attributes`

vectors will be recycled to the same length, and entries from column `j`

of `values`

will be applied to
vertex `vertices[j]`

, attribute `attributes[j]`

.

The `value`

argument is translated into a row (or two rows if
`interp = TRUE`

) of `values`

by finding its location in `param`

.

A list of class `"rglControl"`

of cleaned up parameter
values, to be used in an RGL widget.

```
saveopts <- options(rgl.useNULL = TRUE)
theta <- seq(0, 6*pi, length.out = 100)
xyz <- cbind(sin(theta), cos(theta), theta)
plot3d(xyz, type="l")
```3D plot

id <- spheres3d(xyz[1,,drop=FALSE], col="red")
widget <- rglwidget(width=500, height=300) %>%
playwidget(vertexControl(values=xyz,
attributes=c("x", "y", "z"),
objid = id, param=1:100),
start = 1, stop = 100, rate=10)
if (interactive() || in_pkgdown_example())
widget
options(saveopts)