ageSetter

0th

Percentile

Set WebGL scene properties based on the age of components of objects.

Many rgl shapes contain lists of vertices with various attributes (available via rgl.attrib). This function modifies the data for those attributes in a WebGL scene.

Usage
ageSetter(births, ages, 
         colors = NULL, alpha = NULL, radii = NULL, 
         vertices = NULL, normals = NULL, origins = NULL, 
         texcoords = NULL, 
         objids, prefixes = "", digits = 7, 
         param = seq(floor(min(births)), ceiling(max(births))))
Arguments
births

Numeric vector with one value per vertex, used to determine the “age” of the vertex when displaying it.

ages

A non-decreasing sequence of “ages”.

colors, alpha, radii, vertices, normals, origins, texcoords

Attributes of the vertices. Non-NULL attributes will be interpolated from these values. See the Details section below.

objids, prefixes

The object ids and scene prefixes to modify. These are recycled to the same length.

digits

How many digits to output in the generated Javascript code.

param

Default values to be used by a slider control calling the generated function.

Details

The vertex attributes are specified as follows:

colors

A vector of colors in a format suitable for input to col2rgb

alpha

A numeric vector of alpha values between 0 and 1.

radii

A numeric vector of sphere radii.

vertices

A 3-column matrix of vertex coordinates.

normals

A 3-column matrix of vertex normals.

origins

A 2-column matrix of origins for text or sprites.

texcoords

A 2-column matrix of texture coordinates.

All attributes must have the same number of entries (rows for the matrices) as the ages vector. The births vector must have the same number of entries as the number of vertices in the object.

Not all objects contain all attributes listed here; if one is chosen that is not a property of the corresponding object, a Javascript alert() will be generated.

Value

A character vector of class c("ageSetter", "propertySetter") containing Javascript code defining a function suitable for use in a propertySlider.

The function takes a single argument, time, and uses it to compute the “age” of vertex i as time - births[i]. Those are then used with the ages argument to linearly interpolate settings of the specified attributes. Extrapolation is constant. Repeated values in ages can be used to obtain discontinuities in the settings.

See Also

propertySlider; more detailed control is available in vertexSetter.

Aliases
  • ageSetter
Examples
# NOT RUN {
propertySlider(ageSetter(births = 1:10, ages = c(-1, 0, 1), 
              alpha = c(0, 1, 1), objids = 123))
# }
Documentation reproduced from package rgl, version 0.100.50, License: GPL

Community examples

Looks like there are no examples yet.