mirror of https://github.com/CGAL/cgal
Merge pull request #2100 from janetournois/PMP-fix_isotropic_remeshing_patch_corners-jtournois
PMP : fix isotropic remeshing of a selection
This commit is contained in:
commit
dfd77d4aff
|
|
@ -48,6 +48,7 @@
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
#include <boost/unordered_set.hpp>
|
#include <boost/unordered_set.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/container/flat_set.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
@ -303,6 +304,8 @@ namespace internal {
|
||||||
{
|
{
|
||||||
tag_halfedges_status(face_range); //called first
|
tag_halfedges_status(face_range); //called first
|
||||||
|
|
||||||
|
constrain_patch_corners(face_range);
|
||||||
|
|
||||||
BOOST_FOREACH(face_descriptor f, face_range)
|
BOOST_FOREACH(face_descriptor f, face_range)
|
||||||
{
|
{
|
||||||
input_triangles_.push_back(triangle(f));
|
input_triangles_.push_back(triangle(f));
|
||||||
|
|
@ -1372,6 +1375,43 @@ private:
|
||||||
return PMP::compute_face_normal(f, mesh_);
|
return PMP::compute_face_normal(f, mesh_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename FaceRange>
|
||||||
|
void constrain_patch_corners(const FaceRange& face_range)
|
||||||
|
{
|
||||||
|
boost::container::flat_set<vertex_descriptor> visited;
|
||||||
|
|
||||||
|
BOOST_FOREACH(face_descriptor f, face_range)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(halfedge_descriptor h,
|
||||||
|
halfedges_around_face(halfedge(f, mesh_), mesh_))
|
||||||
|
{
|
||||||
|
vertex_descriptor vt = target(h, mesh_);
|
||||||
|
//treat target(h, mesh_)
|
||||||
|
if (visited.find(vt) != visited.end())
|
||||||
|
continue;//already treated
|
||||||
|
|
||||||
|
if (status(h) == PATCH)//h not on patch boundary
|
||||||
|
continue; //so neither is target(h, mesh_)
|
||||||
|
|
||||||
|
//count incident MESH_BORDER edges
|
||||||
|
unsigned int nb_incident_borders = 0;
|
||||||
|
BOOST_FOREACH(halfedge_descriptor hv,
|
||||||
|
halfedges_around_target(h, mesh_))
|
||||||
|
{
|
||||||
|
CGAL_assertion(vt == target(hv, mesh_));
|
||||||
|
if ( (status(hv) == PATCH_BORDER && status(opposite(hv, mesh_)) == MESH_BORDER)
|
||||||
|
|| (status(hv) == MESH_BORDER && status(opposite(hv, mesh_)) == PATCH_BORDER))
|
||||||
|
nb_incident_borders++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nb_incident_borders == 1) //this is a special corner
|
||||||
|
set_constrained(vt, true);
|
||||||
|
|
||||||
|
visited.insert(vt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename FaceRange>
|
template<typename FaceRange>
|
||||||
void tag_halfedges_status(const FaceRange& face_range)
|
void tag_halfedges_status(const FaceRange& face_range)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue