Learn R Programming

rgl (version 0.111.6)

rgl.primitive: Add primitive set shape

Description

Adds a shape node to the current scene. These low-level functions should not be called by users.

Usage

rgl.points(x, y = NULL, z = NULL, ... )
rgl.lines(x, y = NULL, z = NULL, ... )
rgl.linestrips(x, y = NULL, z = NULL, ...)
rgl.triangles(x, y = NULL, z = NULL, normals = NULL, texcoords = NULL, ... )
rgl.quads(x, y = NULL, z = NULL, normals = NULL, texcoords = NULL, ... )

Value

Each primitive function returns the integer object ID of the shape that was added to the scene. These can be passed to pop3d

to remove the object from the scene.

Arguments

x, y, z

coordinates. Any reasonable way of defining the coordinates is acceptable. See the function xyz.coords for details.

normals

Normals at each point.

texcoords

Texture coordinates at each point.

...

Material properties (see material3d for details) or indices (see points3d for details).

Details

Adds a shape node to the scene.

The names of these functions correspond to OpenGL primitives. They all take a sequence of vertices in x, y, z. The only non-obvious ones are rgl.lines which draws line segments based on pairs of vertices, and rgl.linestrips which joins the vertices.

These are the lower level functions called by points3d, segments3d, lines3d, etc. The two principal differences between the rgl.* functions and the *3d functions are that the former set all unspecified material properties to defaults, whereas the latter use current values as defaults; the former make persistent changes to material properties with each call, whereas the latter make temporary changes only for the duration of the call. There are also differences in default settings when the function calls trigger the opening of a new window.

Users should never call these functions, which are supplied only for back-compatibility.