Fixed seam meshes not always picking the longest border in a connected component

This commit is contained in:
Mael Rouxel-Labbé 2016-11-15 13:46:07 +01:00
parent cde65fd465
commit 8e77c99653
8 changed files with 42 additions and 21 deletions

View File

@ -123,12 +123,19 @@ struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::vertex_point_t>
namespace CGAL {
template<class TM, class SEM, class SVM>
typename boost:: property_map<CGAL::Seam_mesh<TM, SEM, SVM>, vertex_point_t>::const_type
get(vertex_point_t, const Seam_mesh<TM, SEM, SVM>& sm)
{
return Seam_mesh_point_map<TM, SEM, SVM>(sm, get(vertex_point, sm.mesh()));
}
typename boost:: property_map<CGAL::Seam_mesh<TM, SEM, SVM>, vertex_point_t>::const_type
get(vertex_point_t, const Seam_mesh<TM, SEM, SVM>& sm)
{
return Seam_mesh_point_map<TM, SEM, SVM>(sm, get(vertex_point, sm.mesh()));
}
} // namespace CGAL
namespace boost
{
template<class TM, class SEM, class SVM>
struct graph_has_property<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::vertex_point_t>
: CGAL::Tag_true {};
} //boost
#endif // CGAL_PROPERTIES_SEAM_MESH_H

View File

@ -576,7 +576,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
}
halfedge_descriptor bhd(phd);
bhd = opposite(bhd,*sMesh); // a halfedge on the virtual border
bhd = opposite(bhd, *sMesh); // a halfedge on the virtual border
bool success = false;
switch(method)
{

View File

@ -1,7 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/Surface_mesh_parameterization/IO/File_off.h>
#include <CGAL/Surface_mesh_parameterization/Circular_border_parameterizer_3.h>

View File

@ -2,6 +2,7 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/boost/graph/graph_traits_Seam_mesh.h>
@ -10,6 +11,8 @@
#include <CGAL/Surface_mesh_parameterization/Two_vertices_parameterizer_3.h>
#include <CGAL/Surface_mesh_parameterization/LSCM_parameterizer_3.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
#include <boost/foreach.hpp>
#include <iostream>
#include <fstream>
@ -68,15 +71,17 @@ int main(int argc, char * argv[])
Mesh mesh(sm, seam_edge_pm, seam_vertex_pm);
SM_halfedge_descriptor smhd = mesh.add_seams(filename);
assert(smhd != SM_halfedge_descriptor());
if(smhd == SM_halfedge_descriptor() ) {
std::cerr << "Warning: No seams in input" << std::endl;
}
// The 2D points of the uv parametrisation will be written into this map
// Note that this is a halfedge property map, and that uv values
// are only stored for the canonical halfedges representing a vertex
UV_pmap uv_pm = sm.add_property_map<SM_halfedge_descriptor, Point_2>("h:uv").first;
halfedge_descriptor bhd(smhd);
bhd = opposite(bhd, mesh); // a halfedge on the virtual border
// a halfedge on the (possibly virtual) border
halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(mesh, CGAL::Polygon_mesh_processing::parameters::all_default()).first;
typedef SMP::Two_vertices_parameterizer_3<Mesh> Border_parameterizer;
typedef SMP::LSCM_parameterizer_3<Mesh, Border_parameterizer> Parameterizer;

View File

@ -307,7 +307,10 @@ int main(int argc, char * argv[])
sm.add_property_map<SM_vertex_descriptor,bool>("v:on_seam", false).first;
SM_Seam_mesh mesh(sm, seam_edge_pm, seam_vertex_pm);
SM_halfedge_descriptor smhd = mesh.add_seams("../data/lion.selection.txt");
SM_halfedge_descriptor smhd = mesh.add_seams(selection);
if(smhd == SM_halfedge_descriptor() ) {
std::cerr << "Warning: No seams in input" << std::endl;
}
// The 2D points of the uv parametrisation will be written into this map
// Note that this is a halfedge property map, and that the uv
@ -315,8 +318,8 @@ int main(int argc, char * argv[])
SM_UV_pmap uv_pm = sm.add_property_map<SM_halfedge_descriptor,
Point_2>("h:uv").first;
SM_SE_halfedge_descriptor bhd(smhd);
bhd = opposite(bhd, mesh); // a halfedge on the virtual border
// a halfedge on the (possibly virtual) border
SM_SE_halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(mesh).first;
// Indices
typedef boost::unordered_map<SM_SE_vertex_descriptor, int> Indices;
@ -357,7 +360,10 @@ int main(int argc, char * argv[])
PM_seam_vertex_pmap seam_vertex_pm(seam_vertex_hm);
PM_Seam_mesh mesh(pm, seam_edge_pm, seam_vertex_pm);
PM_halfedge_descriptor pmhd = mesh.add_seams("../data/lion.selection.txt");
PM_halfedge_descriptor pmhd = mesh.add_seams(selection);
if(pmhd == PM_halfedge_descriptor() ) {
std::cerr << "Warning: No seams in input" << std::endl;
}
// The 2D points of the uv parametrisation will be written into this map
// Note that this is a halfedge property map, and that the uv
@ -365,8 +371,8 @@ int main(int argc, char * argv[])
PM_UV_hmap uv_hm;
PM_UV_pmap uv_pm(uv_hm);
PM_SE_halfedge_descriptor bhd(pmhd);
bhd = opposite(bhd, mesh); // a halfedge on the virtual border
// a halfedge on the (possibly virtual) border
PM_SE_halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(mesh).first;
// Indices
typedef boost::unordered_map<PM_SE_vertex_descriptor, int> Indices;

View File

@ -2,6 +2,7 @@
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/boost/graph/graph_traits_Seam_mesh.h>
@ -9,6 +10,7 @@
#include <CGAL/Surface_mesh_parameterization/parameterize.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
#include <iostream>
#include <fstream>
@ -61,7 +63,9 @@ int main(int argc, char * argv[])
const char* filename = (argc>2) ? argv[2] : "data/lion.selection.txt";
SM_halfedge_descriptor smhd = mesh.add_seams(filename);
assert(smhd != SM_halfedge_descriptor());
if(smhd == SM_halfedge_descriptor() ) {
std::cerr << "Warning: No seams in input" << std::endl;
}
// The 2D points of the uv parametrisation will be written into this map
// Note that this is a halfedge property map, and that uv values
@ -69,8 +73,8 @@ int main(int argc, char * argv[])
UV_uhm uv_uhm;
UV_pmap uv_pm(uv_uhm);
halfedge_descriptor bhd(smhd);
bhd = opposite(bhd, mesh); // a halfedge on the virtual border
// a halfedge on the (possibly virtual) border
halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(mesh).first;
SMP::parameterize(mesh, bhd, uv_pm);

View File

@ -1,7 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/Surface_mesh_parameterization/IO/File_off.h>
#include <CGAL/Surface_mesh_parameterization/parameterize.h>

View File

@ -36,7 +36,6 @@
#include <CGAL/Algebraic_kernel_d_2.h>
#include <CGAL/Kernel/Conic_misc.h> // @tmp used for solving conic equations
#include <CGAL/Eigen_solver_traits.h>
#include <CGAL/OpenNL/linear_solver.h>
#include <CGAL/Polygon_mesh_processing/connected_components.h>
#include <CGAL/assertions.h>