addMesh
Description
Input Arguments
actor
— Actor class where property is being added
sim3d.Actor
object
Actor class where mesh is being added, specified as a sim3d.Actor
object.
vertices
— Vertex positions
N-by-3 matrix
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
faces
— Vertices of each triangular face
M-by-3 matrix
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
normals
— Normal vectors of each vertex
N-by-3 matrix
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
vcolor
— Vertex colors
N-by-3 matrix
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
tcoords
— Texture coordinates
N-by-2 matrix
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)