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/make_mesh_3.h>
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#include <CGAL/tetrahedral_remeshing.h>
|
||||
|
||||
#include <CGAL/IO/File_medit.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
// Domain
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Polyhedron = CGAL::Mesh_polyhedron_3<K>::type;
|
||||
|
|
@ -78,7 +82,7 @@ int main(int argc, char* argv[])
|
|||
Corners_pmap corners_pmap(corners);
|
||||
|
||||
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));
|
||||
|
||||
//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
|
||||
CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length,
|
||||
CGAL::parameters::number_of_iterations(5)
|
||||
number_of_iterations(5)
|
||||
.smooth_constrained_edges(true)
|
||||
.edge_is_constrained_map(constraints_pmap));
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,16 @@
|
|||
#include <CGAL/make_mesh_3.h>
|
||||
#include <CGAL/tetrahedral_remeshing.h>
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
#include <CGAL/IO/File_medit.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
// Domain
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Polyhedron = CGAL::Surface_mesh<K::Point_3>;
|
||||
using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3<K, Polyhedron>;
|
||||
using Surface_mesh = CGAL::Surface_mesh<K::Point_3>;
|
||||
using Mesh_domain = CGAL::Polyhedral_mesh_domain_with_features_3<K, Surface_mesh>;
|
||||
|
||||
#ifdef CGAL_CONCURRENT_MESH_3
|
||||
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;
|
||||
|
||||
std::ifstream input(fname);
|
||||
Polyhedron polyhedron;
|
||||
Surface_mesh mesh;
|
||||
|
||||
std::string filename(fname);
|
||||
input >> polyhedron;
|
||||
input >> mesh;
|
||||
if (input.fail()) {
|
||||
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!CGAL::is_triangle_mesh(polyhedron)) {
|
||||
if (!CGAL::is_triangle_mesh(mesh)) {
|
||||
std::cerr << "Input geometry is not triangulated." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Create domain
|
||||
Mesh_domain domain(polyhedron);
|
||||
Mesh_domain domain(mesh);
|
||||
|
||||
// Get sharp features
|
||||
domain.detect_features();
|
||||
|
|
@ -71,11 +75,11 @@ int main(int argc, char* argv[])
|
|||
// Mesh criteria
|
||||
const double size = 0.072;
|
||||
Mesh_criteria criteria(edge_size = size,
|
||||
facet_angle = 25,
|
||||
facet_size = size,
|
||||
facet_distance = 0.1 * size,
|
||||
cell_radius_edge_ratio = 2,
|
||||
cell_size = size);
|
||||
facet_angle = 25,
|
||||
facet_size = size,
|
||||
facet_distance = 0.1 * size,
|
||||
cell_radius_edge_ratio = 2,
|
||||
cell_size = size);
|
||||
|
||||
// Mesh generation
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
|
||||
|
|
@ -84,11 +88,11 @@ int main(int argc, char* argv[])
|
|||
Constraints_pmap constraints_pmap(constraints);
|
||||
|
||||
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
|
||||
CGAL::tetrahedral_isotropic_remeshing(tr, size,
|
||||
CGAL::parameters::number_of_iterations(nb_iter)
|
||||
number_of_iterations(nb_iter)
|
||||
.edge_is_constrained_map(constraints_pmap));
|
||||
|
||||
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/Polyhedron_3.h>
|
||||
|
|
@ -15,6 +13,8 @@
|
|||
|
||||
#include <CGAL/IO/File_medit.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
// Domain
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using Point = K::Point_3;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int main()
|
|||
// Mesh criteria
|
||||
Spherical_sizing_field size;
|
||||
Mesh_criteria criteria(params::facet_angle(30).facet_size(0.1).facet_distance(0.025).
|
||||
cell_radius_edge_ratio(2).cell_size(size));
|
||||
cell_radius_edge_ratio(2).cell_size(size));
|
||||
|
||||
// Mesh generation
|
||||
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, params::no_exude().no_perturb());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <CGAL/Tetrahedral_remeshing/Remeshing_triangulation_3.h>
|
||||
#include <CGAL/tetrahedral_remeshing.h>
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#include "tetrahedral_remeshing_generate_input.h"
|
||||
|
||||
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/Mesh_triangulation_3.h>
|
||||
|
|
@ -16,10 +6,13 @@
|
|||
|
||||
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
||||
#include <CGAL/make_mesh_3.h>
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#include <CGAL/tetrahedral_remeshing.h>
|
||||
|
||||
#include <CGAL/IO/File_medit.h>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
// Domain
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
|
|
@ -54,7 +47,7 @@ struct Distance_from_corner_sizing_field
|
|||
typedef K::FT FT;
|
||||
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>
|
||||
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
|
||||
using namespace CGAL::parameters;
|
||||
namespace p = CGAL::parameters;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
|
@ -87,18 +80,18 @@ int main(int argc, char* argv[])
|
|||
domain.detect_features();
|
||||
|
||||
// Mesh criteria
|
||||
Mesh_criteria criteria(edge_size = 0.1,
|
||||
facet_size = 0.1,
|
||||
facet_distance = 0.005);
|
||||
Mesh_criteria criteria(p::edge_size = 0.1,
|
||||
p::facet_size = 0.1,
|
||||
p::facet_distance = 0.005);
|
||||
|
||||
// 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_pmap constraints_pmap(constraints);
|
||||
|
||||
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),
|
||||
// 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,
|
||||
Distance_from_corner_sizing_field(),
|
||||
CGAL::parameters::number_of_iterations(3)
|
||||
p::number_of_iterations(3)
|
||||
.edge_is_constrained_map(constraints_pmap)
|
||||
.smooth_constrained_edges(true));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue