diff --git a/Mesh_3/demo/Mesh_3/C3t3_type.h b/Mesh_3/demo/Mesh_3/C3t3_type.h index 6da8a2548c3..dc4a2adb756 100644 --- a/Mesh_3/demo/Mesh_3/C3t3_type.h +++ b/Mesh_3/demo/Mesh_3/C3t3_type.h @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -31,6 +32,7 @@ private: namespace CGAL { +#ifndef CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN // A specialisation of Triangle_accessor_3 which fits our Polyhedron type template class Triangle_accessor_3 @@ -61,11 +63,17 @@ public: return Triangle_3(a,b,c); } }; +#endif } typedef CGAL::Mesh_3::Robust_intersection_traits_3 RKernel; -typedef CGAL::Polyhedral_mesh_domain_3 Polyhedral_mesh_domain; +typedef CGAL::Polyhedral_mesh_domain_3 Polyhedral_mesh_domain_without_features; +#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN + typedef CGAL::Polyhedral_mesh_domain_with_features_3 Polyhedral_mesh_domain; +#else + typedef Polyhedral_mesh_domain_without_features Polyhedral_mesh_domain; +#endif typedef CGAL::Labeled_image_mesh_domain_3 Image_mesh_domain; typedef Wrapper Function_wrapper; typedef CGAL::Mesh_3::Labeled_mesh_domain_3 Function_mesh_domain; @@ -73,11 +81,10 @@ typedef CGAL::Mesh_3::Labeled_mesh_domain_3 Function // Triangulation #ifdef CONCURRENT_MESH_3 typedef CGAL::Parallel_mesh_triangulation_3::type Tr; - typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; #else typedef CGAL::Mesh_triangulation_3::type Tr; - typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; #endif +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // 3D complex diff --git a/Mesh_3/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp b/Mesh_3/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp index 612d631a0f2..4ec7d3202ec 100644 --- a/Mesh_3/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp +++ b/Mesh_3/demo/Mesh_3/Mesh_3_plugin_polyhedron_cgal_code.cpp @@ -21,6 +21,9 @@ Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh, if( NULL == pMesh ) { return NULL; } Polyhedral_mesh_domain* p_domain = new Polyhedral_mesh_domain(*pMesh); +#ifdef CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN + p_domain->detect_features(); +#endif Scene_c3t3_item* p_new_item = new Scene_c3t3_item(); diff --git a/Mesh_3/demo/Mesh_3/Mesh_function.h b/Mesh_3/demo/Mesh_3/Mesh_function.h index 88a10143879..0e2f7c8c9d0 100644 --- a/Mesh_3/demo/Mesh_3/Mesh_function.h +++ b/Mesh_3/demo/Mesh_3/Mesh_function.h @@ -35,6 +35,7 @@ #include #include +#include #include "C3t3_type.h" #include "Meshing_thread.h" @@ -52,6 +53,23 @@ struct Mesh_parameters }; +template < typename EdgeCriteria > +struct Edge_criteria_sizing_field_wrapper +{ + typedef typename EdgeCriteria::Index Index; + typedef typename EdgeCriteria::FT FT; + typedef typename EdgeCriteria::Point_3 Point_3; + + Edge_criteria_sizing_field_wrapper(const EdgeCriteria& ec) : ec_(ec) {} + FT operator()(const Point_3& p, const int dim, const Index& index) const + { return ec_.sizing_field(p,dim,index); } + +private: + // No need to copy EdgeCriteria here + const EdgeCriteria& ec_; +}; + + template < typename Domain_ > class Mesh_function : public Mesh_function_interface @@ -82,6 +100,7 @@ private: typedef C3t3::Triangulation Tr; typedef CGAL::Mesh_criteria_3 Mesh_criteria; + typedef Mesh_criteria::Edge_criteria Edge_criteria; typedef Mesh_criteria::Facet_criteria Facet_criteria; typedef Mesh_criteria::Cell_criteria Cell_criteria; @@ -155,7 +174,16 @@ launch() #ifdef CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING CGAL::default_random = CGAL::Random(0); #endif - + + // Create mesh criteria + Mesh_criteria criteria(Edge_criteria(p_.facet_sizing), + Facet_criteria(p_.facet_angle, + p_.facet_sizing, + p_.facet_approx), + Cell_criteria(p_.tet_shape, + p_.tet_sizing)); + +#ifndef CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN // Mesh initialization : get some points and add them to the mesh Initial_points_vector initial_points; domain_->construct_initial_points_object()(std::back_inserter(initial_points)); @@ -173,14 +201,13 @@ launch() c3t3_.set_index(v,it->second); } } - - // Create mesh criteria - Mesh_criteria criteria(Facet_criteria(p_.facet_angle, - p_.facet_sizing, - p_.facet_approx), - Cell_criteria(p_.tet_shape, - p_.tet_sizing)); - +#else + typedef Edge_criteria_sizing_field_wrapper Sizing_field; + CGAL::Mesh_3::Protect_edges_sizing_field + protect_edges(c3t3_, *domain_, Sizing_field(criteria.edge_criteria_object())); + protect_edges(true); +#endif + // Build mesher and launch refinement process mesher_ = new Mesher(c3t3_, *domain_, criteria); mesher_->refine_mesh(); diff --git a/Mesh_3/demo/Mesh_3/Polyhedron_type.h b/Mesh_3/demo/Mesh_3/Polyhedron_type.h index a1785386f9a..69afe8a594b 100644 --- a/Mesh_3/demo/Mesh_3/Polyhedron_type.h +++ b/Mesh_3/demo/Mesh_3/Polyhedron_type.h @@ -9,6 +9,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; // surface mesh #include +#include #include "Polyhedron_type_fwd.h" @@ -24,6 +25,6 @@ typedef Kernel::Iso_cuboid_3 Iso_cuboid; typedef Kernel::Plane_3 Plane_3; // surface mesh -typedef CGAL::Polyhedron_3 Polyhedron; +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; #endif // POLYHEDRON_TYPE_H diff --git a/Mesh_3/demo/Mesh_3/Polyhedron_type_fwd.h b/Mesh_3/demo/Mesh_3/Polyhedron_type_fwd.h index 61dd6b9361d..d812e8d5442 100644 --- a/Mesh_3/demo/Mesh_3/Polyhedron_type_fwd.h +++ b/Mesh_3/demo/Mesh_3/Polyhedron_type_fwd.h @@ -2,6 +2,8 @@ #define POLYHEDRON_TYPE_FWD_H #include +#include +#include #include #ifdef USE_FORWARD_DECL @@ -13,7 +15,7 @@ namespace CGAL { template < typename FT_ > struct Simple_cartesian; - class Epick; + //class Epick; class Polyhedron_items_3; @@ -38,13 +40,15 @@ namespace CGAL { // kernel -typedef CGAL::Epick Kernel; +//typedef CGAL::Epick Kernel; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; // surface mesh -typedef CGAL::Polyhedron_3::type Polyhedron; +/*typedef CGAL::Polyhedron_3 > Polyhedron; + std::allocator > Polyhedron;*/ #else // USE_FORWARD_DECL diff --git a/Mesh_3/demo/Mesh_3/config.h b/Mesh_3/demo/Mesh_3/config.h index 901d85b36a4..24bdc7517f3 100644 --- a/Mesh_3/demo/Mesh_3/config.h +++ b/Mesh_3/demo/Mesh_3/config.h @@ -9,7 +9,7 @@ //#define CGAL_MESH_3_VERY_VERBOSE #define CGAL_MESH_3_IO_VERBOSE -#define SHOW_REMAINING_BAD_ELEMENT_IN_RED +//#define SHOW_REMAINING_BAD_ELEMENT_IN_RED #ifndef CGAL_POLYHEDRON_DEMO_NO_PARAMETRIZATION # define CGAL_POLYHEDRON_DEMO_USE_PARAMETRIZATION @@ -23,8 +23,12 @@ # define CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER #endif -#define CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS -//#define CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES +// If you define this, implicit function and segmented images won't be available +//#define CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN +#ifndef CGAL_MESH_3_DEMO_ACTIVATE_SHARP_FEATURES_IN_POLYHEDRAL_DOMAIN +# define CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS +//# define CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES +#endif // ========================================================================== // MESH_3 GENERAL PARAMETERS @@ -33,7 +37,7 @@ //#define CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE // WARNING: VERY SLOW #define CGAL_MESH_3_INITIAL_POINTS_NO_RANDOM_SHOOTING //#define CGAL_MESHES_DEBUG_REFINEMENT_POINTS -#define CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END +//#define CHECK_AND_DISPLAY_THE_NUMBER_OF_BAD_ELEMENTS_IN_THE_END // ========================================================================== // CONCURRENCY @@ -116,8 +120,8 @@ #else // !CONCURRENT_MESH_3 -//# define CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE -# define CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE +# define CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE +//# define CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE # define CGAL_MESH_3_IF_UNSORTED_QUEUE_JUST_SORT_AFTER_SCAN // For better performance on meshes like fandisk