# Find the vertices of each mesh face

I using the rhinocommand(C++), As the title shows, I want to find a single face of the mesh, such as mesh vertices, vertex normal, face normals, etc.
Now I can get all the vertex coordinates and normal vectors of the mesh.

``````        ON_3dPoint  dV;
ON_3fVector  N;
if (mesh->HasSynchronizedDoubleAndSinglePrecisionVertices())
dV = mesh->m_dV[i];
if (mesh->HasVertexNormals())
N = mesh->m_N[i];
``````

But I don’t know which face the information belongs to, and the mesh of the face is a triangle or quad.

Then, I can also get the normal vector of the face, but this can only be used on the cube…

``````        ON_3fVector  fN;
if (mesh->HasFaceNormals())
fN = mesh->m_FN[i];
``````

If you have any ideas, please give us a lot of advice.
Thank you.

Hi @t107408022,

Mesh vertices are stored on the `ON_Mesh::m_V` array.

Mesh faces, `ON_MeshFace`, are stored on the `ON_Mesh::m_F` array.

A mesh face’s vertex indices are stored on the `ON_Meshface::vi` array.

Thus:

``````  const ON_Mesh& mesh = ......;

// Get first mesh face
const ON_MeshFace& face = mesh.m_F[0];
if (face.IsTriangle())
{
ON_3fPoint vertex0 = mesh.m_V[face.vi[0]];
ON_3fPoint vertex1 = mesh.m_V[face.vi[1]];
ON_3fPoint vertex2 = mesh.m_V[face.vi[2]];
// TODO...
}
else
{
ON_3fPoint vertex0 = mesh.m_V[face.vi[0]];
ON_3fPoint vertex1 = mesh.m_V[face.vi[1]];
ON_3fPoint vertex2 = mesh.m_V[face.vi[2]];
ON_3fPoint vertex3 = mesh.m_V[face.vi[3]];
// TODO...
}
``````

Does this help?

– Dale

Hello @dale Thank you very much for your assistance.
Next, I need to get is the normal vector of the mesh face. I have tried `ON_Mesh::m_FN` , but only the cube is `m_FN.Count() = m_F.Count()` .
I know that `ON_Mesh::m_N` can get the normal vector of the vertex. Maybe I want to calculate the face vector from the point vector?

If you don’t bother, I would like to ask the parameters in `ON_MeshFace::GetPlaneEquation` What is `ON_3dPointListRef& vertex_list` ?

Hi @t107408022,

A mesh’s vertex normals are stored in the `ON_Mesh::m_N` array. You can calculate vertex normals using `ON_Mesh::ComputeVertexNormals`.

A mesh’s face normals are stored in the `ON_Mesh::m_FN` array. You can calculate vertex normals using `ON_Mesh::ComputeFaceNormals’.

A list of mesh face vertices.

– Dale