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"))

## Arguments

x, y, z 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.

## Details

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.

## Value

Objects of class c("mesh3d", "shape3d").

See rgl.primitive for a discussion of texture coordinates.

shade3d, shapelist3d for multiple shapes

## Examples


# 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) )