mirror of https://github.com/CGAL/cgal
examples cleaning
This commit is contained in:
parent
60a7f92bac
commit
f020d47938
|
|
@ -6,11 +6,15 @@
|
||||||
|
|
||||||
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
||||||
#include <CGAL/make_mesh_3.h>
|
#include <CGAL/make_mesh_3.h>
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/tetrahedral_remeshing.h>
|
#include <CGAL/tetrahedral_remeshing.h>
|
||||||
|
|
||||||
#include <CGAL/IO/File_medit.h>
|
#include <CGAL/IO/File_medit.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
using Polyhedron = CGAL::Mesh_polyhedron_3<K>::type;
|
using Polyhedron = CGAL::Mesh_polyhedron_3<K>::type;
|
||||||
|
|
@ -78,7 +82,7 @@ int main(int argc, char* argv[])
|
||||||
Corners_pmap corners_pmap(corners);
|
Corners_pmap corners_pmap(corners);
|
||||||
|
|
||||||
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
||||||
CGAL::parameters::edge_is_constrained_map(constraints_pmap).
|
edge_is_constrained_map(constraints_pmap).
|
||||||
vertex_is_constrained_map(corners_pmap));
|
vertex_is_constrained_map(corners_pmap));
|
||||||
|
|
||||||
//note we use the move semantic, with std::move(c3t3),
|
//note we use the move semantic, with std::move(c3t3),
|
||||||
|
|
@ -90,7 +94,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
const double target_edge_length = 0.1;//coarsen the mesh
|
const double target_edge_length = 0.1;//coarsen the mesh
|
||||||
CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length,
|
CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length,
|
||||||
CGAL::parameters::number_of_iterations(5)
|
number_of_iterations(5)
|
||||||
.smooth_constrained_edges(true)
|
.smooth_constrained_edges(true)
|
||||||
.edge_is_constrained_map(constraints_pmap));
|
.edge_is_constrained_map(constraints_pmap));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,16 @@
|
||||||
#include <CGAL/make_mesh_3.h>
|
#include <CGAL/make_mesh_3.h>
|
||||||
#include <CGAL/tetrahedral_remeshing.h>
|
#include <CGAL/tetrahedral_remeshing.h>
|
||||||
|
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/File_medit.h>
|
#include <CGAL/IO/File_medit.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
using Polyhedron = CGAL::Surface_mesh<K::Point_3>;
|
using Surface_mesh = CGAL::Surface_mesh<K::Point_3>;
|
||||||
using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3<K, Polyhedron>;
|
using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3<K, Surface_mesh>;
|
||||||
|
|
||||||
#ifdef CGAL_CONCURRENT_MESH_3
|
#ifdef CGAL_CONCURRENT_MESH_3
|
||||||
using Concurrency_tag = CGAL::Parallel_if_available_tag;
|
using Concurrency_tag = CGAL::Parallel_if_available_tag;
|
||||||
|
|
@ -48,22 +52,22 @@ int main(int argc, char* argv[])
|
||||||
const int nb_iter = (argc > 2) ? atoi(argv[2]) : 5;
|
const int nb_iter = (argc > 2) ? atoi(argv[2]) : 5;
|
||||||
|
|
||||||
std::ifstream input(fname);
|
std::ifstream input(fname);
|
||||||
Polyhedron polyhedron;
|
Surface_mesh mesh;
|
||||||
|
|
||||||
std::string filename(fname);
|
std::string filename(fname);
|
||||||
input >> polyhedron;
|
input >> mesh;
|
||||||
if (input.fail()) {
|
if (input.fail()) {
|
||||||
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CGAL::is_triangle_mesh(polyhedron)) {
|
if (!CGAL::is_triangle_mesh(mesh)) {
|
||||||
std::cerr << "Input geometry is not triangulated." << std::endl;
|
std::cerr << "Input geometry is not triangulated." << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create domain
|
// Create domain
|
||||||
Mesh_domain domain(polyhedron);
|
Mesh_domain domain(mesh);
|
||||||
|
|
||||||
// Get sharp features
|
// Get sharp features
|
||||||
domain.detect_features();
|
domain.detect_features();
|
||||||
|
|
@ -84,11 +88,11 @@ int main(int argc, char* argv[])
|
||||||
Constraints_pmap constraints_pmap(constraints);
|
Constraints_pmap constraints_pmap(constraints);
|
||||||
|
|
||||||
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
||||||
CGAL::parameters::edge_is_constrained_map(constraints_pmap));
|
edge_is_constrained_map(constraints_pmap));
|
||||||
|
|
||||||
// Remeshing
|
// Remeshing
|
||||||
CGAL::tetrahedral_isotropic_remeshing(tr, size,
|
CGAL::tetrahedral_isotropic_remeshing(tr, size,
|
||||||
CGAL::parameters::number_of_iterations(nb_iter)
|
number_of_iterations(nb_iter)
|
||||||
.edge_is_constrained_map(constraints_pmap));
|
.edge_is_constrained_map(constraints_pmap));
|
||||||
|
|
||||||
std::ofstream out("out_remeshed.mesh");
|
std::ofstream out("out_remeshed.mesh");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#define CGAL_TETRAHEDRAL_REMESHING_VERBOSE
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <CGAL/Polyhedron_3.h>
|
#include <CGAL/Polyhedron_3.h>
|
||||||
|
|
@ -15,6 +13,8 @@
|
||||||
|
|
||||||
#include <CGAL/IO/File_medit.h>
|
#include <CGAL/IO/File_medit.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
using Point = K::Point_3;
|
using Point = K::Point_3;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include <CGAL/Tetrahedral_remeshing/Remeshing_triangulation_3.h>
|
#include <CGAL/Tetrahedral_remeshing/Remeshing_triangulation_3.h>
|
||||||
#include <CGAL/tetrahedral_remeshing.h>
|
#include <CGAL/tetrahedral_remeshing.h>
|
||||||
|
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include "tetrahedral_remeshing_generate_input.h"
|
#include "tetrahedral_remeshing_generate_input.h"
|
||||||
|
|
||||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
#define CGAL_DUMP_REMESHING_STEPS
|
|
||||||
#define CGAL_TETRAHEDRAL_REMESHING_VERBOSE
|
|
||||||
#define CGAL_TETRAHEDRAL_REMESHING_DEBUG
|
|
||||||
|
|
||||||
// experiments on sizing
|
|
||||||
//#define CGAL_AVERAGE_SIZING_AFTER_COLLAPSE
|
|
||||||
#define CGAL_MAX_SIZING_IN_IS_TOO_LONG
|
|
||||||
#define CGAL_MIN_SIZING_IN_IS_TOO_SHORT
|
|
||||||
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <CGAL/Mesh_triangulation_3.h>
|
#include <CGAL/Mesh_triangulation_3.h>
|
||||||
|
|
@ -16,10 +6,13 @@
|
||||||
|
|
||||||
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
||||||
#include <CGAL/make_mesh_3.h>
|
#include <CGAL/make_mesh_3.h>
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/tetrahedral_remeshing.h>
|
#include <CGAL/tetrahedral_remeshing.h>
|
||||||
|
|
||||||
#include <CGAL/IO/File_medit.h>
|
#include <CGAL/IO/File_medit.h>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
// Domain
|
// Domain
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
|
|
@ -54,7 +47,7 @@ struct Distance_from_corner_sizing_field
|
||||||
typedef K::FT FT;
|
typedef K::FT FT;
|
||||||
typedef K::Point_3 Point_3;
|
typedef K::Point_3 Point_3;
|
||||||
|
|
||||||
const Point_3 corner = Point_3{ -1., -1., -1 }; //lower corner of the cube
|
const Point_3 corner{ -1., -1., -1 }; //lower corner of the cube
|
||||||
|
|
||||||
template<typename Index>
|
template<typename Index>
|
||||||
FT operator()(const Point_3& p, const int dim, const Index&) const
|
FT operator()(const Point_3& p, const int dim, const Index&) const
|
||||||
|
|
@ -67,7 +60,7 @@ struct Distance_from_corner_sizing_field
|
||||||
};
|
};
|
||||||
|
|
||||||
// To avoid verbose function and named parameters call
|
// To avoid verbose function and named parameters call
|
||||||
using namespace CGAL::parameters;
|
namespace p = CGAL::parameters;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -87,18 +80,18 @@ int main(int argc, char* argv[])
|
||||||
domain.detect_features();
|
domain.detect_features();
|
||||||
|
|
||||||
// Mesh criteria
|
// Mesh criteria
|
||||||
Mesh_criteria criteria(edge_size = 0.1,
|
Mesh_criteria criteria(p::edge_size = 0.1,
|
||||||
facet_size = 0.1,
|
p::facet_size = 0.1,
|
||||||
facet_distance = 0.005);
|
p::facet_distance = 0.005);
|
||||||
|
|
||||||
// Mesh generation
|
// Mesh generation
|
||||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
|
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, p::no_perturb().no_exude());
|
||||||
|
|
||||||
Constraints_set constraints;
|
Constraints_set constraints;
|
||||||
Constraints_pmap constraints_pmap(constraints);
|
Constraints_pmap constraints_pmap(constraints);
|
||||||
|
|
||||||
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
Triangulation_3 tr = CGAL::convert_to_triangulation_3(std::move(c3t3),
|
||||||
CGAL::parameters::edge_is_constrained_map(constraints_pmap));
|
p::edge_is_constrained_map(constraints_pmap));
|
||||||
|
|
||||||
//note we use the move semantic, with std::move(c3t3),
|
//note we use the move semantic, with std::move(c3t3),
|
||||||
// to avoid a copy of the triangulation by the function
|
// to avoid a copy of the triangulation by the function
|
||||||
|
|
@ -109,7 +102,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
CGAL::tetrahedral_isotropic_remeshing(tr,
|
CGAL::tetrahedral_isotropic_remeshing(tr,
|
||||||
Distance_from_corner_sizing_field(),
|
Distance_from_corner_sizing_field(),
|
||||||
CGAL::parameters::number_of_iterations(3)
|
p::number_of_iterations(3)
|
||||||
.edge_is_constrained_map(constraints_pmap)
|
.edge_is_constrained_map(constraints_pmap)
|
||||||
.smooth_constrained_edges(true));
|
.smooth_constrained_edges(true));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue