Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

attributes

Get information about shapes


Description

Retrieves information about the shapes in a scene.

Usage

rgl.attrib(id, attrib, first = 1, 
	last = rgl.attrib.count(id, attrib))

Arguments

id

A shape identifier, as returned by ids3d.

attrib

An attribute of a shape. Currently supported: one of
"vertices", "normals", "colors", "texcoords", "dim", "texts", "cex", "adj", "radii", "centers", "ids", "usermatrix", "types", "flags", "offsets", "family", "font", "pos"
or unique prefixes to one of those.

first, last

Specify these to retrieve only those rows of the result.

Details

If the identifier is not found or is not a shape that has the given attribute, zero will be returned by rgl.attrib.count, and an empty matrix will be returned by rgl.attrib.

The first four attrib names correspond to the usual OpenGL properties; "dim" is used just for surfaces, defining the rows and columns in the rectangular grid; "cex", "adj", "family", "font" and "pos" apply only to text objects.

Value

rgl.attrib returns the values of the attribute. Attributes are mostly real-valued, with the following sizes:

"vertices" 3 values x, y, z
"normals" 3 values x, y, z
"centers" 3 values x, y, z
"colors" 4 values r, g, b, a
"texcoords" 2 values s, t
"dim" 2 values r, c
"cex" 1 value cex
"adj" 2 values x, y
"radii" 1 value r
"ids" 1 value id
"usermatrix" 4 values x, y, z, w
"texts" 1 value text
"types" 1 value type
"flags" 1 value flag
"family" 1 value family
"font" 1 value font
"pos" 1 value pos

The "texts", "types" and "family" attributes are character-valued; the "flags" attribute is logical valued, with named rows.

These are returned as matrices with the row count equal to the count for the attribute, and the columns as listed above.

Author(s)

Duncan Murdoch

See Also

Examples

p <- plot3d(rnorm(100), rnorm(100), rnorm(100), type = "s", col = "red")
rgl.attrib(p["data"], "vertices", last = 10)

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.