mirror of https://github.com/CGAL/cgal
Add new iterative authalic example
This commit is contained in:
parent
b98cedc1b9
commit
aa2bdbdb5e
|
|
@ -5,4 +5,5 @@
|
|||
\example Surface_mesh_parameterization/seam_Polyhedron_3.cpp
|
||||
\example Surface_mesh_parameterization/simple_parameterization.cpp
|
||||
\example Surface_mesh_parameterization/square_border_parameterizer.cpp
|
||||
\example Surface_mesh_parameterization/iterative_authalic_parameterizer.cpp
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,10 +63,8 @@ if ( CGAL_FOUND )
|
|||
target_link_libraries(simple_parameterization PUBLIC CGAL::Eigen_support)
|
||||
create_single_source_cgal_program( "square_border_parameterizer.cpp" )
|
||||
target_link_libraries(square_border_parameterizer PUBLIC CGAL::Eigen_support)
|
||||
create_single_source_cgal_program( "square_border_iterative_parameterizer.cpp" )
|
||||
target_link_libraries(square_border_iterative_parameterizer PUBLIC CGAL::Eigen_support)
|
||||
create_single_source_cgal_program( "compare_parameterization.cpp" )
|
||||
target_link_libraries(compare_parameterization PUBLIC CGAL::Eigen_support)
|
||||
create_single_source_cgal_program( "iterative_authalic_parameterizer.cpp" )
|
||||
target_link_libraries(iterative_authalic_parameterizer PUBLIC CGAL::Eigen_support)
|
||||
|
||||
if(SuiteSparse_FOUND)
|
||||
target_link_libraries(orbifold PRIVATE ${SuiteSparse_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string inputMesh = (argc>1) ? argv[1] : "data/mannequin-devil.off";
|
||||
std::string bash;
|
||||
int out;
|
||||
|
||||
bash = "./square_border_authalic_parameterizer " + inputMesh;
|
||||
out = system(bash.c_str());
|
||||
if (out == 0)
|
||||
std::cout << "square_border_authalic_parameterizer output written in discrete_result.off\n";
|
||||
|
||||
bash = "./square_border_iterative_parameterizer " + inputMesh;
|
||||
out = system(bash.c_str());
|
||||
if (out == 0)
|
||||
std::cout << "square_border_iterative_parameterizer output written in discrete_result.off\n";
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_parameterization/IO/File_off.h>
|
||||
#include <CGAL/Surface_mesh_parameterization/Square_border_parameterizer_3.h>
|
||||
#include <CGAL/Surface_mesh_parameterization/Circular_border_parameterizer_3.h>
|
||||
#include <CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h>
|
||||
#include <CGAL/Surface_mesh_parameterization/Iterative_parameterize.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
|
@ -19,8 +18,8 @@ typedef Kernel::Point_2 Point_2;
|
|||
typedef Kernel::Point_3 Point_3;
|
||||
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
|
||||
|
||||
typedef boost::graph_traits<Surface_mesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef boost::graph_traits<Surface_mesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
typedef CGAL::Unique_hash_map<vertex_descriptor, Point_2> UV_uhm;
|
||||
typedef boost::associative_property_map<UV_uhm> UV_pmap;
|
||||
|
|
@ -30,9 +29,10 @@ namespace SMP = CGAL::Surface_mesh_parameterization;
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/nefertiti.off");
|
||||
if(!in){
|
||||
if(!in)
|
||||
{
|
||||
std::cerr << "Error: problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Surface_mesh sm;
|
||||
|
|
@ -44,18 +44,19 @@ int main(int argc, char** argv)
|
|||
UV_uhm uv_uhm;
|
||||
UV_pmap uv_map(uv_uhm);
|
||||
|
||||
typedef SMP::Square_border_arc_length_parameterizer_3<Surface_mesh> Border_parameterizer;
|
||||
typedef SMP::Circular_border_arc_length_parameterizer_3<Surface_mesh> Border_parameterizer;
|
||||
Border_parameterizer border_parameterizer; // the border parameterizer will automatically compute the corner vertices
|
||||
|
||||
typedef SMP::Iterative_authalic_parameterizer_3<Surface_mesh, Border_parameterizer> Parameterizer;
|
||||
Parameterizer parameterizer(border_parameterizer);
|
||||
|
||||
Border_parameterizer border_param; // the border parameterizer will compute the corner vertices
|
||||
const int iterations = (argc > 2) ? std::atoi(argv[2]) : 15;
|
||||
SMP::Error_code err = parameterizer.parameterize(sm, bhd, uv_map, iterations);
|
||||
|
||||
int iterations = 15;
|
||||
double error;
|
||||
SMP::Error_code err = SMP::parameterize(sm, Parameterizer(border_param), bhd, uv_map, iterations, error);
|
||||
|
||||
if(err != SMP::OK) {
|
||||
if(err != SMP::OK)
|
||||
{
|
||||
std::cerr << "Error: " << SMP::get_error_message(err) << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::ofstream out("iterative_result.off");
|
||||
Loading…
Reference in New Issue