mesh3d | R Documentation |

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

`x, y, z` |
coordinates. Any reasonable way of defining the
coordinates is acceptable. See the function |

`vertices` |
A 4 row matrix of homogeneous coordinates; takes
precedence over |

`material` |
material properties for later rendering |

`normals` |
normals at each vertex |

`texcoords` |
texture coordinates at each vertex |

`points` |
vector of indices of vertices to draw as points |

`segments` |
2 x n matrix of indices of vertices to draw as segments |

`triangles` |
3 x n matrix of indices of vertices to draw as triangles |

`quads` |
4 x n matrix of indices of vertices to draw as quads |

`indices` |
(obsolete) 3 or 4 x n matrix of vertex indices |

`homogeneous` |
(obsolete) should |

`meshColor` |
how should colours be interpreted? See details in |

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.

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

.

See `points3d`

for a discussion of texture coordinates.

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.