Working with vertices
There are a number of functions for accessing the vertices and their properties:
The
getNumVertices()
function returns the number of vertices.The
getVertex( i )
function returns the position of the vertex with indexi
.The
setVertex( i, p )
function sets the position of vertexi
top
. Note that this function can change the vertex but it cannot add a new vertex. So ifi
is greater or equal tomesh.getNumVertices()
, you need to add a vertex (or vertices) using themesh.addVertex( p )
function as described in the Using ofMesh section.The
removeVertex( i )
function deletes the vertex with indexi
. Be very careful when using this function; after deleting a vertex, you should probably also delete the corresponding normal, color, and texture coordinate, and change the indices of the triangles to keep its coherence.The
clearVertices()
function deletes all the vertices. See corresponding cautions forremoveVertex()
.The
clear()
function clears the mesh, including its vertices,...