Merge pull request #5616 from janetournois/PMP-isotropic_remeshing_corners-jtournois

PMP::isotropic_remeshing - keep corners incident to isolated constrained edges
This commit is contained in:
Sebastien Loriot 2021-04-21 15:29:34 +02:00 committed by GitHub
commit 5ea379b9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 4 deletions

View File

@ -77,7 +77,8 @@ namespace internal {
PATCH, //h and hopp belong to the patch to be remeshed PATCH, //h and hopp belong to the patch to be remeshed
PATCH_BORDER,//h belongs to the patch, hopp is MESH PATCH_BORDER,//h belongs to the patch, hopp is MESH
MESH, //h and hopp belong to the mesh, not the patch MESH, //h and hopp belong to the mesh, not the patch
MESH_BORDER //h belongs to the mesh, face(hopp, pmesh) == null_face() MESH_BORDER, //h belongs to the mesh, face(hopp, pmesh) == null_face()
ISOLATED_CONSTRAINT //h is constrained, and incident to faces that do not belong to a patch
}; };
// A property map // A property map
@ -1472,7 +1473,8 @@ private:
{ {
halfedge_descriptor hopp = opposite(h, mesh_); halfedge_descriptor hopp = opposite(h, mesh_);
if ( is_on_border(h) || is_on_patch_border(h) if ( is_on_border(h) || is_on_patch_border(h)
|| is_on_border(hopp) || is_on_patch_border(hopp)) || is_on_border(hopp) || is_on_patch_border(hopp)
|| is_an_isolated_constraint(h))
++nb_incident_features; ++nb_incident_features;
if (nb_incident_features > 2) if (nb_incident_features > 2)
return true; return true;
@ -1538,19 +1540,43 @@ private:
{ {
//deal with h and hopp for borders that are sharp edges to be preserved //deal with h and hopp for borders that are sharp edges to be preserved
halfedge_descriptor h = halfedge(e, mesh_); halfedge_descriptor h = halfedge(e, mesh_);
if (status(h) == PATCH){ Halfedge_status hs = status(h);
if (hs == PATCH) {
set_status(h, PATCH_BORDER); set_status(h, PATCH_BORDER);
hs = PATCH_BORDER;
has_border_ = true; has_border_ = true;
} }
halfedge_descriptor hopp = opposite(h, mesh_); halfedge_descriptor hopp = opposite(h, mesh_);
if (status(hopp) == PATCH){ Halfedge_status hsopp = status(hopp);
if (hsopp == PATCH) {
set_status(hopp, PATCH_BORDER); set_status(hopp, PATCH_BORDER);
hsopp = PATCH_BORDER;
has_border_ = true; has_border_ = true;
} }
if (hs != PATCH_BORDER && hsopp != PATCH_BORDER)
{
set_status(h, ISOLATED_CONSTRAINT);
set_status(hopp, ISOLATED_CONSTRAINT);
}
} }
} }
} }
std::ofstream ofs("dump_isolated.polylines.txt");
for (edge_descriptor e : edges(mesh_))
{
halfedge_descriptor h = halfedge(e, mesh_);
if (status(h) == ISOLATED_CONSTRAINT)
{
CGAL_assertion(status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT);
ofs << "2 " << get(vpmap_, target(h, mesh_))
<< " " << get(vpmap_, source(h, mesh_)) << std::endl;
}
}
ofs.close();
} }
Halfedge_status status(const halfedge_descriptor& h) const Halfedge_status status(const halfedge_descriptor& h) const
@ -1821,6 +1847,13 @@ public:
return status(h) == MESH; return status(h) == MESH;
} }
bool is_an_isolated_constraint(const halfedge_descriptor& h) const
{
bool res = (status(h) == ISOLATED_CONSTRAINT);
CGAL_assertion(!res || status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT);
return res;
}
private: private:
void halfedge_added(const halfedge_descriptor& h, void halfedge_added(const halfedge_descriptor& h,
const Halfedge_status& s) const Halfedge_status& s)