mirror of https://github.com/CGAL/cgal
fix tests
This commit is contained in:
parent
99e1903d5d
commit
c8ce944eb5
|
|
@ -39,15 +39,15 @@ int main()
|
|||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter));
|
||||
std::cout << "Remeshing done. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
// face area map
|
||||
std::map<face_descriptor, std::size_t> face_index;
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ int main()
|
|||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter));
|
||||
std::cout << "Remeshing done. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
// algorithm instance
|
||||
L21_metric error_metric(mesh,
|
||||
|
|
|
|||
|
|
@ -30,15 +30,15 @@ int load_and_remesh_sm(TM &mesh) {
|
|||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter));
|
||||
std::cout << "Remeshing done. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -54,16 +54,16 @@ int load_and_remesh_poly(TM &mesh) {
|
|||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter).
|
||||
face_index_map(get(boost::face_external_index, mesh)));
|
||||
std::cout << "Remeshing done. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/remesh.h>
|
||||
#include <CGAL/Polygon_mesh_processing/repair.h>
|
||||
|
||||
#include <CGAL/Variational_shape_approximation.h>
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ typedef L21_approx::Error_metric L21_metric;
|
|||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
bool test_manifold(const char *file_name, const FT drop = FT(1e-8))
|
||||
bool test_manifold(const char *file_name, const FT drop = FT(1e-2))
|
||||
{
|
||||
Mesh mesh;
|
||||
std::ifstream input(file_name);
|
||||
|
|
@ -27,18 +28,22 @@ bool test_manifold(const char *file_name, const FT drop = FT(1e-8))
|
|||
return false;
|
||||
}
|
||||
|
||||
const std::size_t nb_removed = PMP::remove_isolated_vertices(mesh);
|
||||
if (nb_removed > 0)
|
||||
std::cout << nb_removed << " isolated vertices are removed." << std::endl;
|
||||
|
||||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter));
|
||||
std::cout << "Remeshing done. "
|
||||
<< " (" << num_faces(mesh) << " faces)..." << std::endl;
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
std::cout << "Testing \"" << file_name << '\"' << std::endl;
|
||||
// algorithm instance
|
||||
|
|
@ -51,7 +56,8 @@ bool test_manifold(const char *file_name, const FT drop = FT(1e-8))
|
|||
// approximation, seeding from error, drop to the target error incrementally
|
||||
const std::size_t num_iterations = 20;
|
||||
const std::size_t inner_iterations = 5;
|
||||
approx.initialize_seeds(CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::INCREMENTAL)
|
||||
approx.initialize_seeds(
|
||||
CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::INCREMENTAL)
|
||||
.min_error_drop(drop)
|
||||
.number_of_relaxations(inner_iterations));
|
||||
approx.run(num_iterations);
|
||||
|
|
@ -80,7 +86,7 @@ int main()
|
|||
if (!test_manifold("./data/cube-ouvert.off"))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (!test_manifold("./data/sphere.off", FT(1e-2)))
|
||||
if (!test_manifold("./data/sphere.off"))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -68,12 +68,25 @@ typedef CGAL::Variational_shape_approximation<
|
|||
int main()
|
||||
{
|
||||
Mesh mesh;
|
||||
std::ifstream input("./data/cube-ouvert.off");
|
||||
std::ifstream input("./data/sphere.off");
|
||||
if (!input || !(input >> mesh) || !CGAL::is_triangle_mesh(mesh)) {
|
||||
std::cerr << "Invalid input file." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const double target_edge_length = 0.05;
|
||||
const unsigned int nb_iter = 3;
|
||||
|
||||
std::cout << "Start remeshing. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
PMP::isotropic_remeshing(
|
||||
faces(mesh),
|
||||
target_edge_length,
|
||||
mesh,
|
||||
PMP::parameters::number_of_iterations(nb_iter));
|
||||
std::cout << "Remeshing done. ("
|
||||
<< std::distance(faces(mesh).first, faces(mesh).second) << " faces)..." << std::endl;
|
||||
|
||||
// construct face normal and area map
|
||||
Vertex_point_map vpmap = get(boost::vertex_point, const_cast<Mesh &>(mesh));
|
||||
Face_area_map area_pmap =
|
||||
|
|
@ -96,7 +109,8 @@ int main()
|
|||
Compact_approx approx(mesh, vpmap, error_metric);
|
||||
|
||||
std::cout << "random seeding and run" << std::endl;
|
||||
approx.initialize_seeds(CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::RANDOM)
|
||||
approx.initialize_seeds(
|
||||
CGAL::parameters::seeding_method(CGAL::Surface_mesh_approximation::RANDOM)
|
||||
.max_number_of_proxies(20));
|
||||
approx.run(20);
|
||||
if (approx.number_of_proxies() != 20)
|
||||
|
|
|
|||
Loading…
Reference in New Issue