Main Content

createMesh

Create new mesh with specified values

    Description

    createMesh(actor,vertices,normals,faces) creates a mesh defined by vertices, normals and faces.

    createMesh(___,tcoords,vcolor) creates a mesh additionally defined by the texture coordinates tcoords and the vertex colors vcolor.

    Input Arguments

    collapse all

    Vertex positions, specified as a real positive (N,3) vector. This vector includes all vertex positions to be used for the mesh geometry.

    Example: vertices = reshape(1: 6, 2, 3)

    Data Types: double

    Actor class where mesh is created, specified as a sim3d.Actor object.

    Faces of actor shape, specified as a real positive (N,3) vector. This vector defines how each triangle of the mesh is drawn. Length must be a multiple of 3.

    Example: faces = [1: 3; 4 : 6]

    Data Types: double

    Normal vectors for each vertex, specified as a real positive (N,3) vector. This vector must be the same length as vertices vector.

    Example: normals = reshape(7: 12, 2, 3)

    Data Types: double

    Vertex colors, specified a real positive (N,3) vector. This vector must be the same length as vertices vector.

    Example: vertexcolor = reshape(25 : 33, 3, 3)

    Data Types: double

    Texture coordinates of each vertex, specified a real positive (N,2) vector. This must be the same length as vertices array.

    Example: texturecoord = reshape(21 : 24, 2, 2)

    Data Types: double

    Version History

    Introduced in R2022b