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