Would it be possible to get a sample how to add ngon to mesh using c++?
Also why mesh.SetTriangle(int,int,int,int) and mesh.SetQuad(int,int,int,int,int) have +1 number?
For setting up triangle what does the first int represent - is it id?
Is it something like this for defining hex mesh as ngon?
Or there are other option to do this?
int face_count = 6;
int vertex_count = 12;
BOOL bVertexNormals = FALSE;
BOOL bTextureCoordinates = FALSE;
ON_Mesh mesh(face_count, vertex_count, bVertexNormals, bTextureCoordinates);
mesh.SetVertex(0, ON_3fPoint(0.45f, 5.37f, 0.0f));
mesh.SetVertex(1, ON_3fPoint(-0.16f, 4.32f, 0.0f));
mesh.SetVertex(2, ON_3fPoint(0.44f, 3.26f, 0.0f));
mesh.SetVertex(3, ON_3fPoint(1.66f, 3.25f, 0.0f));
mesh.SetVertex(4, ON_3fPoint(2.28f, 4.31f, 0.0f));
mesh.SetVertex(5, ON_3fPoint(1.67f, 5.37f, 0.0f));
mesh.SetTriangle(0,0,2,1);
mesh.SetTriangle(1,5,2,0);
mesh.SetTriangle(2,3,2,5);
mesh.SetTriangle(3,5,4,3);
mesh.ComputeVertexNormals();
mesh.Compact();
unsigned int m_Vcount = 6;
const unsigned int m_vi[8] = { 5,4,3,2,1,0 };
unsigned int m_Fcount = 4;
const unsigned int m_fi[6] = {0,1,2,3};
mesh.AddNgon(m_Vcount, m_vi, m_Fcount, m_fi);
context.m_doc.AddMeshObject(mesh);
context.m_doc.Redraw();