 # Meshing from indices

Hi,

If I have an array of mesh vertices for instance 6 vertices.

These vertices in array are already sorted in a way that they are in continuous loop.
(Drawing from one vertex to another it is possible to draw a closed polyline)

Are there any method to triangulate such array of id, similarly to mesh from closed polyline, but here it is from array of integers?

It is possible to build a mesh “from scratch” by first giving it a list of vertices, then specifying each face (ie triangle or quad) as a list of indices. What programming language are you using?

I am using c#. The issue I have a mesh with ngons. But ngons have empty array of faces (producing invalid mesh).
But ngons have a vertex array, that is equal to polyline loops inside mesh.

More simply I am searching what would be approach to triangulate any polygon from array of indices (not coordinates) if I already know that they form a loop (sticking with concave ngons).

Similar problem was mention on wikipedia:

Well, there is the `Polyline.TriangulatePolyline()` function, see http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_Geometry_Polyline_TriangulateClosedPolyline.htm

It returns a set of `MeshFace` objects that contain indices that reflect the array indices in the polyline. But I guess that this is nothing more than the series (0, 1, N-2), (N-2, 2, N-3), (N-3, 3, N-4), … to iteratively create triangles out of a closed polygon.

In another post I see that you have hexagons? In that case it might be more useful to add the average point of all 6 points and draw triangles from each edge of the hexagon to the middle point, to give 6 triangles that form the hexagon. It will be nicer than the iterative method.

Edit:

There is also this method `Mesh.CreateFromClosedPolyline`, see http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Mesh_CreateFromClosedPolyline.htm