Append mesh on top of current mesh

Since R2022b

Syntax

``addMesh(actor,vertices,normals,faces)``
``addMesh(___,tcoords,vcolor)``

Description

````addMesh(actor,vertices,normals,faces)` adds a partial mesh defined by `vertices`, `normals`, and `faces`. The resulting geometric mesh creates a single body.```
````addMesh(___,tcoords,vcolor)` adds a mesh additionally defined by the texture coordinates `tcoords` and the vertex colors `vcolor`.```

Input Arguments

collapse all

Actor class where mesh is being added, specified as a `sim3d.Actor` object.

Vertex positions, specified as an N-by-3 matrix. This matrix includes the coordinates of all vertex positions to be used for the mesh geometry. Each vertex has a vertex ID equal to its row number in the matrix. N specifies the number of vertices.

Example: ```vertices = [-1 -1 0; 1 -1 0; 1 1 0; -1 1 0; -1 -1 0; 1 -1 0;1 1 0;-1 1 0]```

Data Types: `double`

Vertices of each triangular face, specified as an M-by-3 matrix. This matrix defines how each triangle of the mesh is drawn. The matrix specifies the vertex IDs that define each triangular face of the mesh. M is the number of triangular faces in the mesh.

Example: ```faces = [0 3 2; 0 2 1; 4 6 7; 4 5 6]```

Data Types: `double`

Normal vectors of each vertex, specified as an N-by-3 matrix. Each row of the matrix specifies the normal vector for a vertex. This matrix must be the same size as `vertices` matrix.

Example: ```normals = [0 0 1; 0 0 1; 0 0 1; 0 0 1; 0 0 -1; 0 0 -1; 0 0 -1; 0 0 -1]```

Data Types: `double`

Vertex colors, specified as an N-by-3 matrix. This matrix specifies the color value of each vertex in the `[R G B]` form. This matrix must be the same length as `vertices`.

Note

To display `vcolor` along with the actor base color, set the `VertexBlend` property to a value greater than 0. If `VertexBlend` is 1, then actor displays only the `vcolor`.

Example: ```vcolor = [1 0 0; 0 1 0; 0 0 1; 1 0 1; 1 1 0; 0 1 1; 1 1 0; 0 1 0]```

Data Types: `double`

Texture coordinates for each vertex, specified as an N-by-2 matrix. This matrix defines which point on the texture file maps to each of the vertices. This matrix must be the same length as `vertices`.

Example: `tcoords = [0 0; 0 1; 1 1; 1 0; 0 0; 0 1; 1 1; 1 0]`

Data Types: `double`

Version History

Introduced in R2022b