3D triangle and quadrangle mesh object creation and a collection of sample objects.
Usage
qmesh3d(vertices, indices, homogeneous = TRUE, material = NULL,
normals = NULL, texcoords = NULL)
tmesh3d(vertices, indices, homogeneous = TRUE, material = NULL,
normals = NULL, texcoords = NULL)
cube3d(trans = identityMatrix(), ...)
tetrahedron3d(trans = identityMatrix(), ...)
octahedron3d(trans = identityMatrix(), ...)
icosahedron3d(trans = identityMatrix(), ...)
dodecahedron3d(trans = identityMatrix(), ...)
cuboctahedron3d(trans = identityMatrix(), ...)
oh3d(trans = identityMatrix(), ...) # an 'o' object
dot3d(x, ...) # draw dots at the vertices of an object
## S3 method for class 'mesh3d'
dot3d(x, override = TRUE, ...)
wire3d(x, ...) # draw a wireframe object
## S3 method for class 'mesh3d'
wire3d(x, override = TRUE, ...)
shade3d(x, ...) # draw a shaded object
## S3 method for class 'mesh3d'
shade3d(x, override = TRUE, ...)
Arguments
x
a mesh3d object (class qmesh3d or tmesh3d)
vertices
3- or 4-component vector of coordinates
indices
4-component vector of vertex indices
homogeneous
logical indicating if homogeneous (four component) coordinates are used.
material
material properties for later rendering
normals
normals at each vertex
texcoords
texture coordinates at each vertex
trans
transformation to apply to objects; see below for defaults
...
additional rendering parameters
override
should the parameters specified here override those stored in the object?
Details
These functions create and work with mesh3d objects, which consist of a matrix
of vertex coordinates together with a matrix of indices indicating which vertex is
part of which face. Such objects may have triangular faces,
planar quadrilateral faces, or both.
The sample objects optionally take a matrix transformation trans as
an argument. This transformation is applied to all vertices of the default shape.
The default is an identity transformation.
The "shape3d" class is a general class for shapes that can be plotted
by dot3d, wire3d or shade3d.
The "mesh3d" class is a class of objects that form meshes: the vertices
are in member vb, as a 3 or 4 by n matrix. Meshes with triangular
faces will contain it, a 3 * n matrix giving the indices of the
vertices in each face. Quad meshes will have vertex indices in ib,
a 4 * n matrix.
Value
qmesh3d, cube3d, oh3d, tmesh3d,
tetrahedron3d, octahedron3d, icosahedron3d and
dodecahedron3d return objects of class c("mesh3d",
"shape3d"). The first three of these are quad meshes, the rest are
triangle meshes.
dot3d, wire3d, and shade3d are called for their side effect
of drawing an object into the scene; they return an object ID (or vector of IDs, for some
classes) invisibly.
See rgl.primitive for a discussion of texture coordinates.