Hello there again,

It looks like you simply want to perform a subdivision. OpenMesh has a Tools directory which already has good implementations of subdivision schemes such as catmull clark, loop sub division and so on.
You can subdivide it for different criteria such as number of triangles, minimum edge length and so on. If you want to locally subdivide certain regions, you need some kind of localized / adaptive subdivision.
In any case, look at the tools here.

https://graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/tree/master/src/OpenMesh/Tools

If you split faces simply on your own, you will create a lot of complex vertices and edges and essentially make it useless for any realistic applications.

Kind regards,
S Vijai Kumar

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, March 12, 2019 12:41 PM, Billy Zinser <billy.zinser@gmail.com> wrote:

Hello,

I am just getting started with OpenMesh and learning the halfedge structure. I am trying to split a face and then split it again to ultimately create areas of different densities that looks something similar to the picture below. 

I have tried to use the following code:
int main()
{
  MyMesh mesh;
  // generate vertices
  MyMesh::VertexHandle vhandle[5];
  vhandle[0] = mesh.add_vertex(MyMesh::Point(0, 0,  0));
  vhandle[1] = mesh.add_vertex(MyMesh::Point( 0, 10,  0));
  vhandle[2] = mesh.add_vertex(MyMesh::Point( 10,  10,  0));
  vhandle[3] = mesh.add_vertex(MyMesh::Point(10,  0,  0));
  vhandle[4] = mesh.add_vertex(MyMesh::Point(5,5,0));

  mesh.add_face(vhandle[2], vhandle[1], vhandle [0]);
  mesh.add_face(vhandle[2], vhandle[0], vhandle [3]);

  mesh.split(mesh.face_handle(0), vhandle[4]);
  mesh.split(mesh.face_handle(1), vhandle[4]);

// This face_handle is generated from the previous split
// and is the one causing errors
mesh.split(mesh.face_handle(2), vhandle[1]); 

However when I try to load the output.off file into a mesh viewer I get the error, "warning mesh contains 0 vertices with NAN coordinates and two degenerated faces". Do you have any recommendations on how to create a mesh with a large amount of faces? I am relatively new to c++ as well as mesh generating so I feel like I'm taking the most difficult approach to this.

Thank you in advance for your help and I apologize if something like this has been answered in the documentation but I could not find it.

- William