mirror of https://github.com/CGAL/cgal
Merge pull request #3194 from MaelRL/Parameterization-Reduce_verbosity-GF
SMP: clean verbosity
This commit is contained in:
commit
0e8b9b45df
|
|
@ -27,12 +27,12 @@ typedef boost::graph_traits<SurfaceMesh>::face_descriptor face_descriptor;
|
|||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/three_peaks.off");
|
||||
if(!in) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SurfaceMesh sm;
|
||||
|
|
@ -52,11 +52,11 @@ int main(int argc, char * argv[])
|
|||
|
||||
if(err != SMP::OK) {
|
||||
std::cerr << "Error: " << SMP::get_error_message(err) << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::ofstream out("result.off");
|
||||
SMP::IO::output_uvmap_to_off(sm, bhd, uv_map, out);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
|||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in_mesh((argc>1) ? argv[1] : "data/lion.off");
|
||||
if(!in_mesh){
|
||||
std::cerr << "Error: problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SurfaceMesh sm;
|
||||
|
|
@ -97,6 +97,6 @@ int main(int argc, char * argv[])
|
|||
std::ofstream out("result.off");
|
||||
SMP::IO::output_uvmap_to_off(mesh, bhd, uv_pm, out);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ typedef SurfaceMesh::Property_map<SM_halfedge_descriptor, Point_2> UV_pmap;
|
|||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CGAL::Timer task_timer;
|
||||
task_timer.start();
|
||||
|
|
@ -50,7 +50,7 @@ int main(int argc, char * argv[])
|
|||
std::ifstream in_mesh(mesh_filename);
|
||||
if(!in_mesh) {
|
||||
std::cerr << "Error: problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SurfaceMesh sm; // underlying mesh of the seam mesh
|
||||
|
|
@ -120,4 +120,5 @@ int main(int argc, char * argv[])
|
|||
parameterizer.parameterize(mesh, bhd, cmap, uvmap, vimap);
|
||||
|
||||
std::cout << "Finished in " << task_timer.time() << " seconds" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
|||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in_mesh((argc>1)?argv[1]:"data/lion.off");
|
||||
if(!in_mesh) {
|
||||
std::cerr << "Error: problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PolyMesh sm;
|
||||
|
|
@ -77,6 +77,6 @@ int main(int argc, char * argv[])
|
|||
std::ofstream out("result.off");
|
||||
SMP::IO::output_uvmap_to_off(mesh, bhd, uv_pm, out);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ typedef boost::graph_traits<SurfaceMesh>::face_descriptor face_descriptor;
|
|||
|
||||
namespace SMP = CGAL::Surface_mesh_parameterization;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/nefertiti.off");
|
||||
if(!in) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SurfaceMesh sm;
|
||||
|
|
@ -44,5 +44,5 @@ int main(int argc, char * argv[])
|
|||
std::ofstream out("result.off");
|
||||
SMP::IO::output_uvmap_to_off(sm, bhd, uv_map, out);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ bool read_vertices(const PolyMesh& mesh,
|
|||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/nefertiti.off");
|
||||
if(!in){
|
||||
|
|
@ -118,7 +118,7 @@ int main(int argc, char * argv[])
|
|||
Vd_array vda;
|
||||
if(!read_vertices(sm, filename, vda)) {
|
||||
std::cerr << "Error: problem loading the square corners" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
typedef SMP::Square_border_uniform_parameterizer_3<PolyMesh> Border_parameterizer;
|
||||
|
|
@ -138,5 +138,5 @@ int main(int argc, char * argv[])
|
|||
std::ofstream out("result.off");
|
||||
SMP::IO::output_uvmap_to_off(sm, bhd, uv_map, out);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1327,8 +1327,11 @@ public:
|
|||
NT energy_this = compute_current_energy(mesh, faces, ctmap, lp, lpmap,
|
||||
ltmap, uvmap);
|
||||
NT energy_last;
|
||||
|
||||
#ifdef CGAL_PARAMETERIZATION_ARAP_VERBOSE
|
||||
std::cout << "Initial energy: " << energy_this << std::endl;
|
||||
std::cout << m_iterations << " max iterations" << std::endl;
|
||||
#endif
|
||||
|
||||
// main loop
|
||||
for(unsigned int ite=1; ite<=m_iterations; ++ite)
|
||||
|
|
@ -1342,7 +1345,9 @@ public:
|
|||
energy_last = energy_this;
|
||||
energy_this = compute_current_energy(mesh, faces, ctmap, lp, lpmap,
|
||||
ltmap, uvmap);
|
||||
#ifdef CGAL_PARAMETERIZATION_ARAP_VERBOSE
|
||||
std::cout << "Energy at iteration " << ite << " : " << energy_this << std::endl;
|
||||
#endif
|
||||
CGAL_warning(energy_this >= 0);
|
||||
|
||||
if(status != OK)
|
||||
|
|
@ -1353,9 +1358,11 @@ public:
|
|||
{ // also no need compute energy if this iteration is the last iteration
|
||||
double energy_diff = std::abs((energy_last - energy_this) / energy_this);
|
||||
if(energy_diff < m_tolerance) {
|
||||
#ifdef CGAL_PARAMETERIZATION_ARAP_VERBOSE
|
||||
std::cout << "Minimization process ended after: "
|
||||
<< ite + 1 << " iterations. "
|
||||
<< "Energy diff: " << energy_diff << std::endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -744,7 +744,6 @@ public:
|
|||
// Run the MVC
|
||||
parameterize_convex_hull_with_MVC(mesh, vertices, faces, ct, uvmap, vimap, vpmap);
|
||||
|
||||
std::cout << "End of post processing" << std::endl;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,10 +110,12 @@ Error_code read_cones(const TriangleMesh& tm, std::ifstream& in, VertexIndexMap
|
|||
while(in >> cone_index)
|
||||
cones.push_back(cone_index);
|
||||
|
||||
#ifdef CGAL_PARAMETERIZATION_ORBIFOLD_CONE_VERBOSE
|
||||
std::cout << "Input cones: ";
|
||||
for(std::size_t i=0; i<cones.size(); ++i)
|
||||
std::cout << cones[i] << " ";
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
if(cones.size() < 3 || cones.size() > 4) {
|
||||
std::cerr << "Error: Not enough or too many input cones" << std::endl;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ namespace Surface_mesh_parameterization {
|
|||
|
||||
namespace internal {
|
||||
|
||||
// -> ->
|
||||
// Return cotangent of (P,Q,R) corner (i.e. cotan of QP, QR angle).
|
||||
// -> ->
|
||||
// Returns the cotangent of the corner (P,Q,R) (i.e. the cotan of the angle (QP, QR) ).
|
||||
template<typename K>
|
||||
typename K::FT cotangent(const typename K::Point_3& P,
|
||||
const typename K::Point_3& Q,
|
||||
|
|
@ -46,18 +46,17 @@ typename K::FT cotangent(const typename K::Point_3& P,
|
|||
|
||||
Vector_3 u = P - Q;
|
||||
Vector_3 v = R - Q;
|
||||
// (u . v) / ((u x v).len)
|
||||
NT dot = (u*v);
|
||||
Vector_3 cross_vector = CGAL::cross_product(u,v);
|
||||
NT dot = (u * v);
|
||||
Vector_3 cross_vector = CGAL::cross_product(u, v);
|
||||
NT cross_norm = CGAL::sqrt(cross_vector * cross_vector);
|
||||
if(cross_norm != 0.0)
|
||||
if(cross_norm != NT(0))
|
||||
return (dot / cross_norm);
|
||||
else
|
||||
return 0.0; // undefined
|
||||
return 0; // undefined
|
||||
}
|
||||
|
||||
// -> ->
|
||||
// Return tangent of (P,Q,R) corner (i.e. tangent of QP, QR angle).
|
||||
// -> ->
|
||||
// Returns the tangent of the corner (P,Q,R) (i.e. the tangent of angle (QP, QR) ).
|
||||
template<typename K>
|
||||
typename K::FT tangent(const typename K::Point_3& P,
|
||||
const typename K::Point_3& Q,
|
||||
|
|
@ -68,17 +67,16 @@ typename K::FT tangent(const typename K::Point_3& P,
|
|||
|
||||
Vector_3 u = P - Q;
|
||||
Vector_3 v = R - Q;
|
||||
// (u . v) / ((u x v).len)
|
||||
NT dot = (u * v);
|
||||
Vector_3 cross_vector = CGAL::cross_product(u, v);
|
||||
NT cross_norm = CGAL::sqrt(cross_vector * cross_vector);
|
||||
if(dot != 0.0)
|
||||
if(dot != NT(0))
|
||||
return (cross_norm / dot);
|
||||
else
|
||||
return 0.0; // undefined
|
||||
return 0; // undefined
|
||||
}
|
||||
|
||||
// Fix sine to be within [-1;1].
|
||||
// Fixes the sine to be within [-1;1].
|
||||
template<typename K>
|
||||
typename K::FT fix_sine(typename K::FT sine)
|
||||
{
|
||||
|
|
@ -90,8 +88,8 @@ typename K::FT fix_sine(typename K::FT sine)
|
|||
return sine;
|
||||
}
|
||||
|
||||
// -> ->
|
||||
// Return angle (in radians) of of (P,Q,R) corner (i.e. QP, QR angle).
|
||||
// -> ->
|
||||
// Returns the angle (in radians) of the corner (P,Q,R) (i.e. the angle (QP, QR) ).
|
||||
template<typename K>
|
||||
typename K::FT compute_angle_rad(const typename K::Point_3& P,
|
||||
const typename K::Point_3& Q,
|
||||
|
|
@ -103,10 +101,9 @@ typename K::FT compute_angle_rad(const typename K::Point_3& P,
|
|||
Vector_3 u = P - Q;
|
||||
Vector_3 v = R - Q;
|
||||
|
||||
// check
|
||||
NT product = CGAL::sqrt(u * u) * CGAL::sqrt(v * v);
|
||||
if(product == 0)
|
||||
return 0.0;
|
||||
if(product == NT(0))
|
||||
return 0;
|
||||
|
||||
// cosine
|
||||
NT dot = (u * v);
|
||||
|
|
@ -116,7 +113,7 @@ typename K::FT compute_angle_rad(const typename K::Point_3& P,
|
|||
Vector_3 w = CGAL::cross_product(u, v);
|
||||
NT abs_sine = CGAL::sqrt(w * w) / product;
|
||||
|
||||
if(cosine >= 0)
|
||||
if(cosine >= NT(0))
|
||||
return std::asin(fix_sine<K>(abs_sine));
|
||||
else
|
||||
return CGAL_PI - std::asin(fix_sine<K>(abs_sine));
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void compute_shortest_paths_between_two_cones(const TriangleMesh& mesh,
|
|||
EdgeOutputIterator oi)
|
||||
{
|
||||
if(source == target) {
|
||||
std::cout << "Warning: the source and target are identical in 'shortest_path' " << std::endl;
|
||||
std::cerr << "Warning: the source and target are identical in 'shortest_path' " << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ void compute_shortest_paths_between_two_cones(const TriangleMesh& mesh,
|
|||
try {
|
||||
boost::dijkstra_shortest_paths(mesh, source, boost::predecessor_map(pred_pmap).visitor(vis));
|
||||
} catch (const std::exception& e) {
|
||||
std::cout << e.what() << std::endl;
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
||||
// Draw the path from target to source and collect the edges along the way
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ int main(int, char**)
|
|||
in >> pm;
|
||||
if(!in || num_vertices(pm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(pm).first;
|
||||
|
|
@ -108,7 +108,7 @@ int main(int, char**)
|
|||
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with MVC (POLY)!" << std::endl;
|
||||
|
|
@ -129,7 +129,7 @@ int main(int, char**)
|
|||
in >> pm;
|
||||
if(!in || num_vertices(pm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
PM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(pm).first;
|
||||
|
|
@ -162,7 +162,7 @@ int main(int, char**)
|
|||
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with ARAP (POLY)!" << std::endl;
|
||||
|
|
@ -183,7 +183,7 @@ int main(int, char**)
|
|||
in >> sm;
|
||||
if(!in || num_vertices(sm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SM_halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(sm).first;
|
||||
|
|
@ -214,7 +214,7 @@ int main(int, char**)
|
|||
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with Barycentric (SM)!" << std::endl;
|
||||
|
|
@ -235,7 +235,7 @@ int main(int, char**)
|
|||
in >> sm;
|
||||
if(!in || num_vertices(sm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// halfedge on the longest border
|
||||
|
|
@ -269,7 +269,7 @@ int main(int, char**)
|
|||
SMP::Error_code status = parameterizer.parameterize(sm, hd, uv_pm, vipm, vpm);
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with ARAP (SM)!" << std::endl;
|
||||
|
|
@ -286,7 +286,7 @@ int main(int, char**)
|
|||
in >> pm;
|
||||
if(!in || num_vertices(pm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
const char* selection = "data/fandisk.dcm.selection.txt";
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ int main(int, char**)
|
|||
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with DCM (SEAM POLY)!" << std::endl;
|
||||
|
|
@ -351,7 +351,7 @@ int main(int, char**)
|
|||
in >> sm;
|
||||
if(!in || num_vertices(sm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const char* selection = "data/bear.dac.selection.txt";
|
||||
|
|
@ -395,7 +395,7 @@ int main(int, char**)
|
|||
SMP::Error_code status = parameterizer.parameterize(mesh, hd, uv_pm, vipm, vpm);
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with DAC (SEAM SM)!" << std::endl;
|
||||
|
|
@ -413,7 +413,7 @@ int main(int, char**)
|
|||
in >> sm;
|
||||
if(!in || num_vertices(sm) == 0) {
|
||||
std::cerr << "Problem loading the input data" << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const char* cone_filename = "data/fandisk.orbifold.selection.txt";
|
||||
|
|
@ -471,7 +471,7 @@ int main(int, char**)
|
|||
SMP::Error_code status = parameterizer.parameterize(mesh, hd, cmap, uvmap, vimap);
|
||||
if(status != SMP::OK) {
|
||||
std::cout << "Encountered a problem: " << status << std::endl;
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
std::cout << "Parameterized with Orbifold (SEAM SM)!" << std::endl;
|
||||
|
|
@ -481,5 +481,5 @@ int main(int, char**)
|
|||
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue