 # Add triangle to empty mesh

Hi,
I like to simply add, for example a new triangle to an existing or empty mesh. Like:

``````mesh = open3d.geometry.TriangleMesh()
t1 = numpy.asarray([[2,2],[5,2],[5,5]])
mesh.insertTriangle(t1)
``````

which would than create the edges in counter-clockwise way (for determining the normal direction). I can however not find any such functionality beside methods like ‘create_torus’ to actually generate geometry other than loading it from file.
How is the approach in Open3D when creating geometry from scratch with defined polygons and also how to add single points/vertices to a open3d.geometry.PointCloud. I searched for every standardized keywords like add, append, insert, push_back but it looks like the classes are missing the most basic functionality.

The example on this page was useful to me (after some modifications) to create a mesh with a triangle: http://www.open3d.org/docs/release/python_api/open3d.utility.Vector3iVector.html#open3d.utility.Vector3iVector

Here’s the modified version that works and also matches your points:

``````import open3d
import numpy as np

mesh = open3d.geometry.TriangleMesh()
np_vertices = np.array([[2, 2, 0],
[5, 2, 0],
[5, 5, 0]])
np_triangles = np.array([[0, 1, 2]]).astype(np.int32)

mesh.vertices = open3d.utility.Vector3dVector(np_vertices)

mesh.triangles = open3d.utility.Vector3iVector(np_triangles)

open3d.visualization.draw_geometries([mesh])
``````

To make a mesh, you’ll need the vertices and an array of the indices of three vertices that make the triangle.