Hi,
I am new and recently started to play with OpenMesh. I would like to
subdivide a triangle mesh based on midpoint criteria. It is required that
the subdivided mesh has the same geometry as the original one. No geometry
loss!
I read a STL mesh and tried to use the uniform subdivider:
___________________________________________________________________
struct CustomTraits : public OpenMesh::DefaultTraitsDouble { };
typedef OpenMesh::TriMesh_ArrayKernelT<CustomTraits> OM_TriMesh;
OM_TriMesh om_mesh;
OpenMesh::IO::read_mesh( om_mesh, fname_in);
int n_refine = 1;
OpenMesh::Subdivider::Uniform::MidpointT<OM_TriMesh> divider;
divider.attach(om_mesh);
divider(n_refine);
divider.detach();
OpenMesh::IO::write_mesh( om_mesh , fname_out);
____________________________________________________________________
Conceptually, I supposed it would uniformly divide one triangle into four
triangles after connecting its edge midpoints. However, I found it was not
true and the subdivided mesh is geometrically not exactly the same as the
original one.
In addition, for a simple mesh with only 1 triangle(stl format), I found
that only the central triangle connected with midpoints is generated and
triangles associated with the original vertices are lost. I looked at the
source code, and found that it was caused by the "if (!_m.is_boundary(vh))"
check. So it seems the boundary vertices are ignored. Then the geometry
after subdivision became different from the original mesh. Is it true? Can
anyone help and tell me how to do that? Thank you very much.
Best,
Xujun