Retrieves information about the shapes in a scene.

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 valuesx, y, z
"normals"3 valuesx, y, z
"centers"3 valuesx, y, z
"colors"4 valuesr, g, b, a
"texcoords"2 valuess, t
"dim"2 valuesr, c
"cex"1 valuecex
"adj"2 valuesx, y
"radii"1 valuer
"ids"1 valueid
"usermatrix"4 valuesx, y, z, w
"texts"1 valuetext
"types"1 valuetype
"flags"1 valueflag
"family"1 valuefamily
"font"1 valuefont
"pos"1 valuepos

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

Duncan Murdoch

Examples

p <- plot3d(rnorm(100), rnorm(100), rnorm(100), type = "s", col = "red")
rgl.attrib(p["data"], "vertices", last = 10)
#>                x           y          z
#>  [1,] -0.2473408 -0.19579253 -0.7306377
#>  [2,] -1.1531678  0.56433702  1.1116332
#>  [3,]  0.5355552  1.25732493 -0.1663814
#>  [4,]  2.6983950 -0.63459283  0.9676953
#>  [5,]  2.3290782  0.42423278 -0.4983194
#>  [6,] -0.1592154  0.18003118  0.9268858
#>  [7,] -0.1285290 -0.22959492  0.0811431
#>  [8,] -0.1851681 -0.07320771 -0.1144585
#>  [9,] -1.6411908 -0.68217242 -1.8649980
#> [10,]  1.0044202 -0.08488930 -1.4219571