Search code examples
matlabvertex

how to join vertices to form triangular mesh?


I have a set of triangulated mesh data. For every triangular face, I want to form a smaller similar triangle inside. I generated three new vertices for the new triangle in each original faces. How can I join all the three generated vertices in each faces using matlab?

Thanks for all help!


Solution

  • The vertices in your triangulated mesh data will be placed in a list.

    v[0] = (x0,y0,z0)
    v[1] = (x1,y1,z1)
    .
    .
    v[n] = (xn,yn,zn)
    

    Next to this list, there will be a list of triangle or polygon data.

    triangle[0] = (0,1,2)  // these are the indices of the vertex in the vertex list
    triangle[1] = (1,2,3)
    .
    .
    triangle[k] = ( , , )
    

    If your new list of vertices has the same order as the original, you should be able to copy this list to a new mesh data object. If you now copy the same list of triangle or polygon data, your mesh should be created.