Creates meshes containing points, segments, triangles and quads.
mesh3d( x, y = NULL, z = NULL, vertices,
material = NULL,
normals = NULL, texcoords = NULL,
points = NULL, segments = NULL,
triangles = NULL, quads = NULL,
meshColor = c("vertices", "edges", "faces", "legacy"))
qmesh3d(vertices, indices, homogeneous = TRUE, material = NULL,
normals = NULL, texcoords = NULL,
meshColor = c("vertices", "edges", "faces", "legacy"))
tmesh3d(vertices, indices, homogeneous = TRUE, material = NULL,
normals = NULL, texcoords = NULL,
meshColor = c("vertices", "edges", "faces", "legacy"))
Objects of class c("mesh3d",
"shape3d")
.
See points3d
for a discussion of texture coordinates.
coordinates. Any reasonable way of defining the
coordinates is acceptable. See the function xyz.coords
for details.
A 4 row matrix of homogeneous coordinates; takes
precedence over x, y, z
.
material properties for later rendering
normals at each vertex
texture coordinates at each vertex
vector of indices of vertices to draw as points
2 x n matrix of indices of vertices to draw as segments
3 x n matrix of indices of vertices to draw as triangles
4 x n matrix of indices of vertices to draw as quads
(obsolete) 3 or 4 x n matrix of vertex indices
(obsolete) should tmesh3d
and qmesh3d
vertices be assumed to be homogeneous?
how should colours be interpreted? See details in shade3d
.
These functions create mesh3d
objects, which consist of a matrix
of vertex coordinates together with a matrices of indices indicating how the vertices should be displayed, and
material properties.
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 4 by n
matrix using
homogeneous coordinates. Indices of these vertices are
contained in optional components ip
for points,
is
for line segments, it
for triangles, and
ib
for quads.
Individual meshes may have any combination of these.
The functions tmesh3d
and qmesh3d
are included
for back-compatibility; they produce meshes of triangles and
quads respectively.
shade3d
, shapelist3d
for multiple shapes
# generate a quad mesh object
vertices <- c(
-1.0, -1.0, 0,
1.0, -1.0, 0,
1.0, 1.0, 0,
-1.0, 1.0, 0
)
indices <- c( 1, 2, 3, 4 )
open3d()
wire3d( mesh3d(vertices = vertices, quads = indices) )
Run the code above in your browser using DataLab