mirror of https://github.com/CGAL/cgal
Test the global API of Surface_Mesh_Parameterization
This commit is contained in:
parent
f168d3911e
commit
9c7a75f36f
|
|
@ -10,6 +10,7 @@
|
|||
#include <CGAL/surface_mesh_parameterization.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||
#include <CGAL/Polygon_mesh_processing/connected_components.h>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
|
|
@ -17,6 +18,7 @@
|
|||
#include <fstream>
|
||||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
|
|
@ -94,7 +96,7 @@ int main(int, char**)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(pm).first;
|
||||
PM_halfedge_descriptor hd = PMP::longest_border(pm).first;
|
||||
|
||||
CGAL::Unique_hash_map<PM_vertex_descriptor, Point_2,
|
||||
boost::hash<PM_vertex_descriptor> > uvhm;
|
||||
|
|
@ -113,7 +115,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with MVC (POLY)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // MVC_POLYHEDRON_MESH
|
||||
|
||||
// ***************************************************************************
|
||||
// ARAP WITH POLYHEDRON_MESH
|
||||
|
|
@ -131,7 +133,7 @@ int main(int, char**)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(pm).first;
|
||||
PM_halfedge_descriptor hd = PMP::longest_border(pm).first;
|
||||
|
||||
// UV map
|
||||
CGAL::Unique_hash_map<PM_vertex_descriptor, Point_2,
|
||||
|
|
@ -143,11 +145,9 @@ int main(int, char**)
|
|||
// Indices map
|
||||
typedef boost::unordered_map<PM_vertex_descriptor, int> Indices;
|
||||
Indices indices;
|
||||
CGAL::Polygon_mesh_processing::connected_component(
|
||||
face(opposite(hd, pm), pm),
|
||||
pm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<PMesh, Indices>(pm, indices)));
|
||||
PMP::connected_component(face(opposite(hd, pm), pm), pm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<PMesh, Indices>(pm, indices)));
|
||||
|
||||
boost::associative_property_map<Indices> vipm(indices);
|
||||
|
||||
|
|
@ -158,8 +158,8 @@ int main(int, char**)
|
|||
// Parameterizer
|
||||
SMP::ARAP_parameterizer_3<PMesh> parameterizer;
|
||||
SMP::Error_code status = parameterizer.parameterize(pm, hd, uvpm, vipm, vpm);
|
||||
|
||||
if(status != SMP::OK) {
|
||||
SMP::Error_code status_bis = SMP::parameterize(pm, parameterizer, hd, uvpm);
|
||||
if(status != SMP::OK || status_bis != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with ARAP (POLY)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // ARAP_POLYHEDRON_MESH
|
||||
|
||||
// ***************************************************************************
|
||||
// Barycentric mapping
|
||||
|
|
@ -185,7 +185,7 @@ int main(int, char**)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(sm).first;
|
||||
SM_halfedge_descriptor hd = PMP::longest_border(sm).first;
|
||||
assert(hd != SM_halfedge_descriptor());
|
||||
|
||||
// UV map
|
||||
|
|
@ -195,11 +195,9 @@ int main(int, char**)
|
|||
// Indices map
|
||||
typedef boost::unordered_map<SM_vertex_descriptor, int> Indices;
|
||||
Indices indices;
|
||||
CGAL::Polygon_mesh_processing::connected_component(
|
||||
face(opposite(hd, sm), sm),
|
||||
sm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SMesh, Indices>(sm, indices)));
|
||||
PMP::connected_component(face(opposite(hd, sm), sm), sm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SMesh, Indices>(sm, indices)));
|
||||
boost::associative_property_map<Indices> vipm(indices);
|
||||
|
||||
// Vertex parameterized map
|
||||
|
|
@ -210,8 +208,9 @@ int main(int, char**)
|
|||
SMP::Barycentric_mapping_parameterizer_3<SMesh> parameterizer;
|
||||
|
||||
SMP::Error_code status = parameterizer.parameterize(sm, hd, uvpm, vipm, vpm);
|
||||
SMP::Error_code status_bis = SMP::parameterize(sm, parameterizer, hd, uvpm);
|
||||
|
||||
if(status != SMP::OK) {
|
||||
if(status != SMP::OK || status_bis != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -219,7 +218,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with Barycentric (SM)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // BARY_SURF_MESH
|
||||
|
||||
// ***************************************************************************
|
||||
// ARAP WITH SURF_MESH
|
||||
|
|
@ -238,8 +237,7 @@ int main(int, char**)
|
|||
}
|
||||
|
||||
// halfedge on the longest border
|
||||
SM_halfedge_descriptor hd =
|
||||
CGAL::Polygon_mesh_processing::longest_border(sm).first;
|
||||
SM_halfedge_descriptor hd = PMP::longest_border(sm).first;
|
||||
|
||||
CGAL::Unique_hash_map<SM_vertex_descriptor, Point_2,
|
||||
boost::hash<SM_vertex_descriptor> > uvhm;
|
||||
|
|
@ -251,11 +249,9 @@ int main(int, char**)
|
|||
// Indices map
|
||||
typedef boost::unordered_map<SM_vertex_descriptor, int> Indices;
|
||||
Indices indices;
|
||||
CGAL::Polygon_mesh_processing::connected_component(
|
||||
face(opposite(hd, sm), sm),
|
||||
sm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SMesh, Indices>(sm, indices)));
|
||||
PMP::connected_component(face(opposite(hd, sm), sm), sm,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SMesh, Indices>(sm, indices)));
|
||||
boost::associative_property_map<Indices> vipm(indices);
|
||||
|
||||
// Parameterized bool pmap
|
||||
|
|
@ -266,7 +262,9 @@ int main(int, char**)
|
|||
SMP::ARAP_parameterizer_3<SMesh> parameterizer;
|
||||
|
||||
SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_pm, vipm, vpm);
|
||||
if(status != SMP::OK) {
|
||||
SMP::Error_code status_bis = SMP::parameterize(sm, parameterizer, hd, uv_pm);
|
||||
|
||||
if(status != SMP::OK || status_bis != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -274,7 +272,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with ARAP (SM)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // ARAP_SURF_MESH
|
||||
|
||||
#ifdef DCM_PM_SEAM_MESH
|
||||
{
|
||||
|
|
@ -307,16 +305,14 @@ int main(int, char**)
|
|||
PM_UV_pmap uv_pm(uv_hm);
|
||||
|
||||
// a halfedge on the (possibly virtual) border
|
||||
PM_SE_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(mesh).first;
|
||||
PM_SE_halfedge_descriptor hd = PMP::longest_border(mesh).first;
|
||||
|
||||
// Indices
|
||||
typedef boost::unordered_map<PM_SE_vertex_descriptor, int> Indices;
|
||||
Indices indices;
|
||||
CGAL::Polygon_mesh_processing::connected_component(
|
||||
face(opposite(hd, mesh), mesh),
|
||||
mesh,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<PM_Seam_mesh, Indices>(mesh, indices)));
|
||||
PMP::connected_component(face(opposite(hd, mesh), mesh), mesh,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<PM_Seam_mesh, Indices>(mesh, indices)));
|
||||
boost::associative_property_map<Indices> vipm(indices);
|
||||
|
||||
// Parameterized
|
||||
|
|
@ -326,8 +322,9 @@ int main(int, char**)
|
|||
SMP::Discrete_conformal_map_parameterizer_3<PM_Seam_mesh> parameterizer;
|
||||
|
||||
SMP::Error_code status = parameterizer.parameterize(mesh, hd, uv_pm, vipm, vpm);
|
||||
SMP::Error_code status_bis = SMP::parameterize(mesh, parameterizer, hd, uv_pm);
|
||||
|
||||
if(status != SMP::OK) {
|
||||
if(status != SMP::OK || status_bis != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -335,7 +332,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with DCM (SEAM POLY)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // DCM_PM_SEAM_MESH
|
||||
|
||||
// ***************************************************************************
|
||||
// DAC WITH SEAM_MESH (SM)
|
||||
|
|
@ -373,16 +370,14 @@ int main(int, char**)
|
|||
Point_2>("h:uv").first;
|
||||
|
||||
// a halfedge on the (possibly virtual) border
|
||||
SM_SE_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(mesh).first;
|
||||
SM_SE_halfedge_descriptor hd = PMP::longest_border(mesh).first;
|
||||
|
||||
// Indices
|
||||
typedef boost::unordered_map<SM_SE_vertex_descriptor, int> Indices;
|
||||
Indices indices;
|
||||
CGAL::Polygon_mesh_processing::connected_component(
|
||||
face(opposite(hd, mesh), mesh),
|
||||
mesh,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SM_Seam_mesh, Indices>(mesh, indices)));
|
||||
PMP::connected_component(face(opposite(hd, mesh), mesh), mesh,
|
||||
boost::make_function_output_iterator(
|
||||
SMP::internal::Index_map_filler<SM_Seam_mesh, Indices>(mesh, indices)));
|
||||
boost::associative_property_map<Indices> vipm(indices);
|
||||
|
||||
// Parameterized
|
||||
|
|
@ -392,7 +387,9 @@ int main(int, char**)
|
|||
SMP::Discrete_authalic_parameterizer_3<SM_Seam_mesh> parameterizer;
|
||||
|
||||
SMP::Error_code status = parameterizer.parameterize(mesh, hd, uv_pm, vipm, vpm);
|
||||
if(status != SMP::OK) {
|
||||
SMP::Error_code status_bis = SMP::parameterize(mesh, parameterizer, hd, uv_pm);
|
||||
|
||||
if(status != SMP::OK || status_bis != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -400,7 +397,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with DAC (SEAM SM)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // DAC_SM_SEAM_MESH
|
||||
|
||||
#ifdef ORBIFOLD_SM_MESH
|
||||
{
|
||||
|
|
@ -464,10 +461,10 @@ int main(int, char**)
|
|||
|
||||
// a halfedge on the (possibly virtual) border
|
||||
// only used in output (will also be used to handle multiple connected components in the future)
|
||||
SM_SE_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(mesh,
|
||||
CGAL::Polygon_mesh_processing::parameters::all_default()).first;
|
||||
SM_SE_halfedge_descriptor hd = PMP::longest_border(mesh, PMP::parameters::all_default()).first;
|
||||
|
||||
SMP::Error_code status = parameterizer.parameterize(mesh, hd, cmap, uvmap, vimap);
|
||||
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
@ -476,7 +473,7 @@ int main(int, char**)
|
|||
std::cout << "Parameterized with Orbifold (SEAM SM)!" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // ORBIFOLD_SM_MESH
|
||||
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue