diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h index e738302d533..87ebbe012ab 100644 --- a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h +++ b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_ray_intersection.h @@ -201,7 +201,7 @@ template boost::optional< typename AABB_tree::template Intersection_and_primitive_id::Type > AABB_tree::first_intersection(const Ray& query, const SkipFunctor& skip) const { - CGAL_static_assertion_msg((std::is_same::value), + static_assert(std::is_same::value, "Ray and Ray_3 must be the same type"); switch(size()) // copy-paste from AABB_tree::traversal diff --git a/AABB_tree/test/AABB_tree/aabb_test_is_ray_intersection_geomtraits.cpp b/AABB_tree/test/AABB_tree/aabb_test_is_ray_intersection_geomtraits.cpp index c7198fe98e0..35612dc8ded 100644 --- a/AABB_tree/test/AABB_tree/aabb_test_is_ray_intersection_geomtraits.cpp +++ b/AABB_tree/test/AABB_tree/aabb_test_is_ray_intersection_geomtraits.cpp @@ -26,16 +26,16 @@ int main() { using namespace CGAL::internal::AABB_tree; - CGAL_static_assertion_msg( + static_assert( (Is_ray_intersection_geomtraits::value), "CGAL::Epeck should be a RayIntersectionGeomTraits"); - CGAL_static_assertion_msg( + static_assert( (Is_ray_intersection_geomtraits< CGAL::Simple_cartesian >::value), "CGAL::Epeck should be a RayIntersectionGeomTraits"); - CGAL_static_assertion_msg( + static_assert( (!Is_ray_intersection_geomtraits::value), "Pure AABBGeomTraits shouldn't be a RayIntersectionGeomTraits"); - CGAL_static_assertion_msg( + static_assert( (!Is_ray_intersection_geomtraits::value), "The empty struct shouldn't be a RayIntersectionGeomTraits"); diff --git a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp index 1bd5f4bd02a..4ecbef7420c 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp @@ -9,8 +9,8 @@ int main(){ typedef FT::Numerator_type Numerator_type; typedef FT::Denominator_type Denominator_type; - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); Numerator_type numerator; Denominator_type denominator; diff --git a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp index abf8265a837..e85c2e8d73b 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp @@ -9,7 +9,7 @@ binary_func(const A& a , const B& b){ typedef CGAL::Coercion_traits CT; // check for explicit interoperability - CGAL_static_assertion((CT::Are_explicit_interoperable::value)); + static_assert(CT::Are_explicit_interoperable::value); // CT::Cast is used to to convert both types into the coercion type typename CT::Cast cast; diff --git a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h index cdfca730976..e0d5eee6706 100644 --- a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h +++ b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h @@ -353,8 +353,7 @@ class Algebraic_structure_traits_base< Type_, typedef Coercion_traits< NT1, NT2 > CT; typedef typename CT::Type Coercion_type_NT1_NT2; CGAL_USE_TYPE(Coercion_type_NT1_NT2); - CGAL_static_assertion(( - ::std::is_same::value)); + static_assert(::std::is_same::value); typename Coercion_traits< NT1, NT2 >::Cast cast; operator()( cast(x), cast(y), q, r ); diff --git a/Algebraic_foundations/include/CGAL/Coercion_traits.h b/Algebraic_foundations/include/CGAL/Coercion_traits.h index 14acb431c7c..f6c9092dec6 100644 --- a/Algebraic_foundations/include/CGAL/Coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Coercion_traits.h @@ -35,9 +35,9 @@ #define CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, Result_type ) \ template < class CT_Type_1, class CT_Type_2 > \ Result_type operator()( const CT_Type_1& x, const CT_Type_2& y ) const { \ - CGAL_static_assertion((::std::is_same< \ + static_assert(::std::is_same< \ typename Coercion_traits< CT_Type_1, CT_Type_2 >::Type, NT \ - >::value)); \ + >::value) ; \ \ typename Coercion_traits< CT_Type_1, CT_Type_2 >::Cast cast; \ return operator()( cast(x), cast(y) ); \ diff --git a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h index db6b3df845d..5453868a132 100644 --- a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h +++ b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h @@ -85,13 +85,13 @@ public: // determine extractable scalar factor Scalar operator () (const NT& a) { - CGAL_static_assertion(( ::std::is_same< NT,Scalar >::value)); + static_assert(::std::is_same< NT,Scalar >::value); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a, SAT()); } // determine extractable scalar factor Scalar operator () (const NT& a, const Scalar& d) { - CGAL_static_assertion(( ::std::is_same< NT,Scalar >::value)); + static_assert(::std::is_same< NT,Scalar >::value); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a,d,SAT()); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h index 5a5e23c7d8f..82483c0dcce 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h @@ -44,7 +44,7 @@ template void check_result_type(AdaptableFunctor, ResultType){ typedef typename AdaptableFunctor::result_type result_type; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); CGAL_USE_TYPE(result_type); } // check nothing for CGAL::Null_functor @@ -122,12 +122,11 @@ void test_algebraic_structure_intern( const CGAL::Integral_domain_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - CGAL_static_assertion( - (!::std::is_same< Integral_division, Null_functor >::value)); - CGAL_static_assertion((!::std::is_same< Divides, Null_functor >::value)); - CGAL_static_assertion((!::std::is_same< Is_zero, Null_functor >::value)); - CGAL_static_assertion((!::std::is_same< Is_one, Null_functor >::value)); - CGAL_static_assertion((!::std::is_same< Square, Null_functor >::value)); + static_assert(!::std::is_same< Integral_division, Null_functor >::value); + static_assert(!::std::is_same< Divides, Null_functor >::value); + static_assert(!::std::is_same< Is_zero, Null_functor >::value); + static_assert(!::std::is_same< Is_one, Null_functor >::value); + static_assert(!::std::is_same< Square, Null_functor >::value); // functor const Is_zero is_zero = Is_zero(); @@ -206,7 +205,7 @@ void test_algebraic_structure_intern( CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - CGAL_static_assertion((!::std::is_same< Gcd, Null_functor>::value)); + static_assert(!::std::is_same< Gcd, Null_functor>::value); const Gcd gcd = Gcd(); assert( gcd( AS ( 0), AS ( 0)) == unit_normal( AS (0) ) ); @@ -268,9 +267,9 @@ void test_algebraic_structure_intern( const CGAL::Euclidean_ring_tag&) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - CGAL_static_assertion((!::std::is_same< Div, Null_functor>::value)); - CGAL_static_assertion((!::std::is_same< Mod, Null_functor>::value)); - CGAL_static_assertion((!::std::is_same< Div_mod, Null_functor>::value)); + static_assert(!::std::is_same< Div, Null_functor>::value); + static_assert(!::std::is_same< Mod, Null_functor>::value); + static_assert(!::std::is_same< Div_mod, Null_functor>::value); const Div div=Div(); const Mod mod=Mod(); @@ -387,7 +386,7 @@ void test_algebraic_structure_intern( const CGAL::Field_with_sqrt_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); - CGAL_static_assertion((!::std::is_same< Sqrt, Null_functor>::value)); + static_assert(!::std::is_same< Sqrt, Null_functor>::value); const Sqrt sqrt =Sqrt(); AS a(4); @@ -613,11 +612,11 @@ class Test_is_square { CGAL_USE_TYPE(First_argument_type); CGAL_USE_TYPE(Second_argument_type); - CGAL_static_assertion( + static_assert( ( ::std::is_same< AS , First_argument_type>::value)); - CGAL_static_assertion( + static_assert( ( ::std::is_same< AS& , Second_argument_type>::value)); - //CGAL_static_assertion(( ::std::is_same< bool , Result_type>::value)); + //static_assert(::std::is_same< bool , Result_type>::value); bool b = Result_type(true); CGAL_USE(b); AS test_number = AS(3)*AS(3); @@ -649,8 +648,8 @@ public: typedef typename Sqrt::result_type Result_type; CGAL_USE_TYPE(Argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion(( ::std::is_same< AS , Argument_type>::value)); - CGAL_static_assertion(( ::std::is_same< AS , Result_type>::value)); + static_assert(::std::is_same< AS , Argument_type>::value); + static_assert(::std::is_same< AS , Result_type>::value); typedef Algebraic_structure_traits AST; typedef typename AST::Is_exact Is_exact; assert( !Is_exact::value || AS (3) == sqrt( AS (9))); @@ -675,11 +674,11 @@ public: CGAL_USE_TYPE(First_argument_type); CGAL_USE_TYPE(Second_argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion( + static_assert( ( ::std::is_same::value)); - CGAL_static_assertion( + static_assert( ( ::std::is_same< AS , Second_argument_type>::value)); - CGAL_static_assertion( + static_assert( ( ::std::is_same< AS , Result_type>::value)); AS epsilon(1); assert( test_equality_epsilon( AS (2), @@ -803,7 +802,7 @@ void test_algebraic_structure(){ typedef CGAL::Algebraic_structure_traits< AS > AST; CGAL_SNAP_AST_FUNCTORS(AST); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef typename AST::Boolean Boolean; assert(!Boolean()); @@ -816,14 +815,12 @@ void test_algebraic_structure(){ using CGAL::Integral_domain_without_division_tag; using CGAL::Null_functor; // Test for desired exactness - CGAL_static_assertion( - ( ::std::is_same< typename AST::Is_exact, Is_exact >::value)); - - CGAL_static_assertion(( ::boost::is_convertible< Tag, - Integral_domain_without_division_tag >::value )); - CGAL_static_assertion(( ::std::is_same< Tag, Algebraic_category>::value)); - CGAL_static_assertion((!::std::is_same< Simplify, Null_functor>::value)); - CGAL_static_assertion((!::std::is_same< Unit_part, Null_functor>::value)); + static_assert(::std::is_same< typename AST::Is_exact, Is_exact >::value); + static_assert(::std::is_convertible< Tag, + Integral_domain_without_division_tag >::value ); + static_assert(::std::is_same< Tag, Algebraic_category>::value); + static_assert(!::std::is_same< Simplify, Null_functor>::value); + static_assert(!::std::is_same< Unit_part, Null_functor>::value); const Simplify simplify=Simplify();; const Unit_part unit_part= Unit_part(); @@ -943,7 +940,7 @@ void test_algebraic_structure( const AS & a, const AS & b, const AS & c) { typedef CGAL::Algebraic_structure_traits AST; typedef typename AST::Is_numerical_sensitive Is_numerical_sensitive; - CGAL_static_assertion( + static_assert( !(::std::is_same::value)); CGAL_USE_TYPE(Is_numerical_sensitive); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h index 0caa6ced04e..cff190a023d 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h @@ -326,7 +326,7 @@ void test_implicit_interoperable_one_way() { typedef typename CT::Type C; typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable; - CGAL_static_assertion( + static_assert( (::std::is_same::value)); assert((::std::is_same::value)); @@ -346,9 +346,9 @@ void test_explicit_interoperable_one_way(){ typedef typename CT::Cast Cast; typedef typename Cast::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value); + static_assert(::std::is_same::value); typename CT::Cast cast; A a(3); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h index e1aa91eb29d..6d11b6f2c55 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h @@ -37,11 +37,11 @@ void test_fraction_traits(){ typedef typename FT::Compose Compose; CGAL_USE_TYPE(Is_fraction); - CGAL_static_assertion( (::std::is_same::value)); - CGAL_static_assertion( (::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); + static_assert(!::std::is_same::value); + static_assert(!::std::is_same::value); + static_assert(!::std::is_same::value); // Decompose diff --git a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h index 5efda40bc2f..68e648e69c5 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h @@ -29,7 +29,7 @@ void test_rational_traits(){ typedef Rational_traits Rational_traits; typedef typename Rational_traits::RT RT; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); assert( Rational_traits().numerator(x) == RT(7)); assert( Rational_traits().denominator(x) == RT(2)); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h index bb67e3f57a5..fbe5b66132b 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h @@ -48,9 +48,9 @@ namespace CGAL { void operator() (const ToDouble& to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - CGAL_static_assertion(( ::std::is_same::value)); + static_assert( ::std::is_same::value); CGAL_USE_TYPE(Argument_type); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert( ::std::is_same::value); CGAL_USE_TYPE(Result_type); assert(42.0 == to_double(Type(42))); } @@ -71,9 +71,9 @@ namespace CGAL { typedef typename To_interval::argument_type Argument_type; typedef typename To_interval::result_type Result_type; typedef std::pair Interval_type; - CGAL_static_assertion(( ::std::is_same::value)); + static_assert( ::std::is_same::value); CGAL_USE_TYPE(Argument_type); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert( ::std::is_same::value); CGAL_USE_TYPE(Result_type); CGAL_USE_TYPE(Interval_type); // assert(NiX::in(42.0,to_Interval(Type(42)))); @@ -139,7 +139,7 @@ void test_real_embeddable() { CGAL_SNAP_RET_FUNCTORS(RET); typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_true; - CGAL_static_assertion(( ::std::is_same< Is_real_embeddable, Tag_true>::value)); + static_assert(::std::is_same< Is_real_embeddable, Tag_true>::value); CGAL_USE_TYPE(Is_real_embeddable); typedef typename RET::Boolean Boolean; @@ -246,7 +246,7 @@ void test_not_real_embeddable() { typedef CGAL::Real_embeddable_traits RET; typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_false; - CGAL_static_assertion(( ::std::is_same< Is_real_embeddable, Tag_false>::value)); + static_assert(::std::is_same< Is_real_embeddable, Tag_false>::value); CGAL_USE_TYPE(Is_real_embeddable); } @@ -254,13 +254,13 @@ void test_not_real_embeddable() { //template //void test_rounded_log2_abs(Type zero, CGAL::Null_functor, CeilLog2Abs) { // typedef CGAL::Null_functor Null_functor; -// CGAL_static_assertion(( ::std::is_same< CeilLog2Abs, Null_functor>::value)); +// static_assert(::std::is_same< CeilLog2Abs, Null_functor>::value); //} // //template //void test_rounded_log2_abs(Type zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { // typedef CGAL::Null_functor Null_functor; -// CGAL_static_assertion((!::std::is_same< CeilLog2Abs, Null_functor>::value)); +// static_assert(!::std::is_same< CeilLog2Abs, Null_functor>::value); // // assert( fl_log(Type( 7)) == 2 ); // assert( cl_log(Type( 7)) == 3 ); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp index 87e5235cfe1..95c89235190 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp @@ -9,21 +9,21 @@ int main(){ typedef AET::Type Type; CGAL_USE_TYPE(Type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef AET::Is_extended Is_extended; CGAL_USE_TYPE(Is_extended); - CGAL_static_assertion( + static_assert( (::std::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; CGAL_USE_TYPE(argument_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef Normalization_factor::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); Normalization_factor nfac; assert(nfac(3)==1); } @@ -31,10 +31,10 @@ int main(){ { typedef DFAI::argument_type argument_type; CGAL_USE_TYPE(argument_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef DFAI::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); DFAI dfai; assert(dfai(3)==1); } @@ -45,21 +45,21 @@ int main(){ typedef AET::Type Type; CGAL_USE_TYPE(Type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef AET::Is_extended Is_extended; CGAL_USE_TYPE(Is_extended); - CGAL_static_assertion( + static_assert( (::std::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; CGAL_USE_TYPE(argument_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef Normalization_factor::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); Normalization_factor nfac; assert(nfac(EXT(3))==1); assert(nfac(EXT(3,0,5))==1); @@ -69,10 +69,10 @@ int main(){ { typedef DFAI::argument_type argument_type; CGAL_USE_TYPE(argument_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef DFAI::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); DFAI dfai; assert(dfai(EXT(3))==1); assert(dfai(EXT(3,0,5))==1); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp index bc1e4b85bb0..efd31636c51 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp @@ -7,7 +7,7 @@ { \ typedef AST::NAME NAME; \ CGAL_USE_TYPE(NAME); \ - CGAL_static_assertion( \ + static_assert( \ (::std::is_same::value)); \ } @@ -16,19 +16,19 @@ int main(){ typedef AST::Type Type; CGAL_USE_TYPE(Type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef AST::Algebraic_category Algebraic_category; CGAL_USE_TYPE(Algebraic_category); - CGAL_static_assertion( + static_assert( (::std::is_same::value)); typedef AST::Is_exact Is_exact; CGAL_USE_TYPE(Is_exact); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef AST::Is_numerical_sensitive Is_sensitive; CGAL_USE_TYPE(Is_sensitive); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); CGAL_IS_AST_NULL_FUNCTOR ( Simplify); CGAL_IS_AST_NULL_FUNCTOR ( Unit_part); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp index 7deecf693cc..a0ec9d741a4 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp @@ -6,22 +6,17 @@ int main(){ { typedef CGAL::Coercion_traits CT; CGAL_USE_TYPE(CT); - CGAL_static_assertion(( std::is_same::value)); - CGAL_static_assertion( - ( std::is_same::value)); - CGAL_static_assertion( - ( std::is_same::value)); + static_assert( std::is_same::value); + static_assert( std::is_same::value); + static_assert( std::is_same::value); assert( 5 == CT::Cast()(5)); } { typedef CGAL::Coercion_traits CT; CGAL_USE_TYPE(CT); -// CGAL_static_assertion(( std::is_same::value)); - CGAL_static_assertion( - ( std::is_same::value)); - CGAL_static_assertion( - ( std::is_same::value)); - CGAL_static_assertion( - ( std::is_same::value)); +// static_assert( std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); } } diff --git a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp index f9288c9eefd..f215c848458 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp @@ -7,7 +7,7 @@ { \ typedef RET::NAME NAME; \ CGAL_USE_TYPE(NAME); \ - CGAL_static_assertion( \ + static_assert( \ (::std::is_same::value)); \ } @@ -16,11 +16,11 @@ int main(){ typedef RET::Type Type; CGAL_USE_TYPE(Type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef RET::Is_real_embeddable Is_real_embeddable; CGAL_USE_TYPE(Is_real_embeddable); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); CGAL_IS_RET_NULL_FUNCTOR(Abs); CGAL_IS_RET_NULL_FUNCTOR(Sgn); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp index b2b6ffd0bf3..1fe2fcf620d 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp @@ -7,33 +7,31 @@ int main(){ typedef CGAL::Scalar_factor_traits SFT; CGAL_USE_TYPE(SFT); - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); typedef SFT::Scalar_factor Scalar_factor; { typedef Scalar_factor::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef Scalar_factor::argument_type argument_type; CGAL_USE_TYPE(argument_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); } typedef SFT::Scalar_div Scalar_div; { typedef Scalar_div::result_type result_type; CGAL_USE_TYPE(result_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef Scalar_div::first_argument_type first_argument_type; CGAL_USE_TYPE(first_argument_type); - CGAL_static_assertion( - (::std::is_same::value)); + static_assert(::std::is_same::value); typedef Scalar_div::second_argument_type second_argument_type; CGAL_USE_TYPE(second_argument_type); - CGAL_static_assertion( - (::std::is_same::value)); + static_assert(::std::is_same::value); } int i; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index 002e108b0ec..e92e01e0669 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -481,18 +481,18 @@ public: Curve_analysis_2 _construct_defining_polynomial_from(Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - CGAL_static_assertion((::std::is_same + static_assert(::std::is_same ::value)); + typename Num_coercion::Type>::value); typedef CGAL::Coercion_traits Denom_coercion; - CGAL_static_assertion((::std::is_same + static_assert(::std::is_same ::value)); + typename Denom_coercion::Type>::value); typename Num_coercion::Cast num_cast; typename Denom_coercion::Cast denom_cast; typename FT::Decompose decompose; @@ -2541,18 +2541,18 @@ public: Polynomial_1 operator() (const Polynomial_2& f, Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - CGAL_static_assertion((::std::is_same + static_assert(::std::is_same ::value)); + typename Num_coercion::Type>::value); typedef CGAL::Coercion_traits Denom_coercion; - CGAL_static_assertion((::std::is_same + static_assert(::std::is_same ::value)); + typename Denom_coercion::Type>::value); typename Num_coercion::Cast num_cast; typename Denom_coercion::Cast denom_cast; typename FT::Decompose decompose; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h index 54fcec0b3f5..2b5a30867ce 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h @@ -71,7 +71,7 @@ class Algebraic_real_d_1 : public ::CGAL::Handle_with_policy< AlgebraicRealRep_d_1, HandlePolicy > { // currently Rational is the only supported Bound type. - CGAL_static_assertion( + static_assert( ( ::std::is_same ::Arithmetic_kernel::Rational>::value)); diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h index 1609fdbaa6b..e9ff71e3e66 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h @@ -186,7 +186,7 @@ template::value_type >::value)); @@ -224,14 +224,14 @@ template void cast_back_utcf(const Poly_coer_1& p,Polynomial_1& q) { // We can assume that both template arguments are polynomial types typedef CGAL::Fraction_traits FT; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - CGAL_static_assertion((::std::is_same + static_assert(::std::is_same ::value)); + typename Num_coercion::Type>::value); Numerator p_num; Denominator p_denom; typename FT::Decompose()(p,p_num,p_denom); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp index 2e06d3b6aec..d5917a016e5 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp @@ -47,8 +47,8 @@ void test_real_embeddable_extension(const NT_&){ typedef typename Floor::result_type Result_type; CGAL_USE_TYPE(Argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion(( ::std::is_same::value)); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); assert(Integer(42) == floor(NT(42))); assert(Integer(-42) == floor(NT(-42))); } @@ -59,8 +59,8 @@ void test_real_embeddable_extension(const NT_&){ typedef typename Floor_log2_abs::result_type Result_type; CGAL_USE_TYPE(Argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion(( ::std::is_same::value)); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); assert(long(0) == floor_log2_abs(NT(1))); assert(long(0) == floor_log2_abs(NT(-1))); @@ -86,8 +86,8 @@ void test_real_embeddable_extension(const NT_&){ typedef typename Ceil::result_type Result_type; CGAL_USE_TYPE(Argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion(( ::std::is_same::value)); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); assert(Integer(42) == ceil(NT(42))); assert(Integer(-42) == ceil(NT(-42))); } @@ -98,8 +98,8 @@ void test_real_embeddable_extension(const NT_&){ typedef typename Ceil_log2_abs::result_type Result_type; CGAL_USE_TYPE(Argument_type); CGAL_USE_TYPE(Result_type); - CGAL_static_assertion(( ::std::is_same::value)); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); assert(long(0) == ceil_log2_abs(NT(1))); assert(long(0) == ceil_log2_abs(NT(-1))); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h index 01a27244d74..f3332c1a4d2 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h @@ -62,20 +62,20 @@ void test_algebraic_curve_kernel_2() { typedef AlgebraicCurveKernel_2 AK_2; - /* CGAL_static_assertion( (::std::is_same< - Algebraic_real_1, typename AK::Algebraic_real_1 >::value) ); + /* static_assert(::std::is_same< + Algebraic_real_1, typename AK::Algebraic_real_1 >::value); - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< Isolator, - typename AK::Isolator >::value) ); + typename AK::Isolator >::value); - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< Coefficient, - typename AK::Coefficient >::value)); + typename AK::Coefficient >::value); - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< Polynomial_1, - typename AK::Polynomial_1 >::value));*/ + typename AK::Polynomial_1 >::value);*/ typedef typename AK_2::Polynomial_2 Poly_2; typedef typename AK_2::Curve_analysis_2 Curve_analysis_2; diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h index 20ecd337223..abe5ebfd32d 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h @@ -109,8 +109,8 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){ typedef typename Name::result_type RT_; \ CGAL_USE_TYPE(AT_); \ CGAL_USE_TYPE(RT_); \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ @@ -120,9 +120,9 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){ CGAL_USE_TYPE(AT1_); \ CGAL_USE_TYPE(AT2_); \ CGAL_USE_TYPE(RT_); \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ } // TODO: missing check for Construct_algebraic_real_1 diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h index ff04c8f8c9d..bebcd0118e7 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h @@ -93,8 +93,8 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { typedef typename Name::result_type RT_; \ CGAL_USE_TYPE(AT_); \ CGAL_USE_TYPE(RT_); \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ @@ -104,22 +104,22 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_USE_TYPE(AT1_); \ CGAL_USE_TYPE(AT2_); \ CGAL_USE_TYPE(RT_); \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ - {CGAL_static_assertion(( ::std::is_same::value));} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ + {static_assert(::std::is_same::value);} \ } - CGAL_static_assertion(( ::std::is_same + static_assert(::std::is_same - ::value)); + ::value); CGAL_CHECK_UFUNCTION(Is_square_free_2,Polynomial_2,bool); CGAL_CHECK_UFUNCTION(Make_square_free_2,Polynomial_2,Polynomial_2); // TODO: missing check for Square_free_factorize_2 CGAL_CHECK_BFUNCTION(Is_coprime_2,Polynomial_2,Polynomial_2,bool); - CGAL_static_assertion(( ::std::is_same - ::value)); + static_assert(::std::is_same + ::value); CGAL_CHECK_BFUNCTION(Number_of_solutions_2,Polynomial_2,Polynomial_2, size_type); CGAL_CHECK_UFUNCTION(Compute_x_2,Algebraic_real_2,Algebraic_real_1); @@ -128,8 +128,8 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_CHECK_UFUNCTION(Compute_polynomial_y_2,Algebraic_real_2,Polynomial_1); CGAL_CHECK_BFUNCTION(Isolate_x_2,Algebraic_real_2,Polynomial_1,BInterval); CGAL_CHECK_BFUNCTION(Isolate_y_2,Algebraic_real_2,Polynomial_1,BInterval); - CGAL_static_assertion(( ::std::is_same - < BArray,typename Isolate_2::result_type>::value)); + static_assert(::std::is_same + < BArray,typename Isolate_2::result_type>::value); CGAL_CHECK_BFUNCTION(Sign_at_2,Polynomial_2,Algebraic_real_2,Sign); CGAL_CHECK_BFUNCTION(Is_zero_at_2,Polynomial_2,Algebraic_real_2,bool); CGAL_CHECK_BFUNCTION(Compare_x_2,Algebraic_real_2,Algebraic_real_2,Sign); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h index a393abe3653..fa5bd929abe 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h @@ -39,8 +39,8 @@ namespace internal { void operator() (ToDouble to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); assert(42.0 == to_double(NT(42))); } }; @@ -59,8 +59,8 @@ namespace internal { void operator() (ToInterval to_Interval) { typedef typename ToInterval::argument_type Argument_type; typedef typename ToInterval::result_type Result_type; - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same< typename Argument_type::Interval, Result_type>::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same< typename Argument_type::Interval, Result_type>::value); // TODO: NiX::in not available!? //assert(NiX::in(42.0,to_Interval(NT(42)))); @@ -99,7 +99,7 @@ void test_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_true; - CGAL_static_assertion((::std::is_same< Is_real_comparable, Tag_true>::value)); + static_assert(::std::is_same< Is_real_comparable, Tag_true>::value); typename Traits::Compare compare; typename Traits::Sign sign; typename Traits::Abs abs; @@ -168,20 +168,20 @@ void test_not_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_false; - CGAL_static_assertion((::std::is_same< Is_real_comparable, Tag_false>::value)); + static_assert(::std::is_same< Is_real_comparable, Tag_false>::value); } template void test_rounded_log2_abs(NT zero, ::CGAL::Null_functor, CeilLog2Abs) { typedef ::CGAL::Null_functor Nulltype; - CGAL_static_assertion((::std::is_same< CeilLog2Abs, Nulltype>::value)); + static_assert(::std::is_same< CeilLog2Abs, Nulltype>::value); } template void test_rounded_log2_abs(NT zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { typedef ::CGAL::Null_functor Null_functor; - CGAL_static_assertion((!::std::is_same< CeilLog2Abs, Null_functor>::value)); + static_assert(!::std::is_same< CeilLog2Abs, Null_functor>::value); assert( fl_log(NT( 7)) == 2 ); assert( cl_log(NT( 7)) == 3 ); diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h index 3c4cb4b7d30..43be2407022 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h @@ -61,7 +61,7 @@ public: // because the periodic triangulations' point() function returns a temporary // value while the lazy predicate evaluations that are used when the Exact tag // is set to true rely on a permanent and safe access to the points. - CGAL_static_assertion( + static_assert( (std::is_same::value) || (std::is_same::value)); @@ -76,8 +76,8 @@ public: typedef Type_of_alpha FT; // check that simplices are correctly instantiated - CGAL_static_assertion( (std::is_same::value) ); - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); + static_assert(std::is_same::value); typedef typename Dt::Point Point; diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shape_vertex_base_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_vertex_base_2.h index e96dfaa5fcb..919fec145ec 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_vertex_base_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_vertex_base_2.h @@ -19,6 +19,7 @@ #include #include #include +#include //------------------------------------------------------------------- namespace CGAL { diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h index cc734b7f4b6..7ce92e13c34 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h @@ -148,8 +148,8 @@ class Lazy_alpha_nt_2 Approx_point to_approx(const Input_point& wp) const { // The traits class' Point_2 must be convertible using the Cartesian converter - CGAL_static_assertion((Is_traits_point_convertible_2< - Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value)); + static_assert(Is_traits_point_convertible_2< + Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value); To_approx converter; return converter(wp); @@ -158,8 +158,8 @@ class Lazy_alpha_nt_2 Exact_point to_exact(const Input_point& wp) const { // The traits class' Point_2 must be convertible using the Cartesian converter - CGAL_static_assertion((Is_traits_point_convertible_2< - Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value)); + static_assert(Is_traits_point_convertible_2< + Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value); To_exact converter; return converter(wp); diff --git a/Alpha_shapes_2/package_info/Alpha_shapes_2/dependencies b/Alpha_shapes_2/package_info/Alpha_shapes_2/dependencies index eee8e076278..6c159737638 100644 --- a/Alpha_shapes_2/package_info/Alpha_shapes_2/dependencies +++ b/Alpha_shapes_2/package_info/Alpha_shapes_2/dependencies @@ -2,7 +2,6 @@ Algebraic_foundations Alpha_shapes_2 Arithmetic_kernel Cartesian_kernel -Filtered_kernel Hash_map Homogeneous_kernel Installation diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h index be6849a5886..a4a93f82515 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h @@ -97,7 +97,7 @@ public: // because the periodic triangulations' point() function returns a temporary // value while the lazy predicate evaluations that are used when the Exact tag // is set to true rely on a permanent and safe access to the points. - CGAL_static_assertion( + static_assert( (std::is_same::value) || (std::is_same::value)); @@ -108,8 +108,8 @@ public: typedef typename Gt::FT Coord_type; //checks whether tags are correctly set in Vertex and Cell classes - CGAL_static_assertion( (std::is_same::value) ); - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); + static_assert(std::is_same::value); typedef typename Dt::Point Point; diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h index cd853624378..cf732c40d67 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h @@ -139,8 +139,8 @@ class Lazy_alpha_nt_3{ Approx_point to_approx(const Input_point& wp) const { // The traits class' Point_3 must be convertible using the Cartesian converter - CGAL_static_assertion((Is_traits_point_convertible_3< - Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value)); + static_assert(Is_traits_point_convertible_3< + Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value); To_approx converter; return converter(wp); @@ -149,8 +149,8 @@ class Lazy_alpha_nt_3{ Exact_point to_exact(const Input_point& wp) const { // The traits class' Point_3 must be convertible using the Cartesian converter - CGAL_static_assertion((Is_traits_point_convertible_3< - Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value)); + static_assert(Is_traits_point_convertible_3< + Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value); To_exact converter; return converter(wp); diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp index eca3fa1654e..be64a8febbd 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp @@ -25,8 +25,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the inputs const std::string ts_filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); // triangle soup const std::string ss_filename = (argc > 2) ? argv[2] : CGAL::data_file_path("images/420.polylines.txt"); // segment soup diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp index feaa9c804af..8742a2a2001 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp @@ -8,8 +8,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; - using K = CGAL::Exact_predicates_inexact_constructions_kernel; using Point_3 = K::Point_3; @@ -18,8 +16,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/oni.pwn"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp index 5aa8deeb4de..00e2e4fd9fc 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp @@ -9,7 +9,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; namespace PMP = CGAL::Polygon_mesh_processing; using K = CGAL::Exact_predicates_inexact_constructions_kernel; @@ -19,8 +18,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp index 2eb3f9c4155..1c1d6c7b3d7 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp @@ -8,7 +8,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; namespace PMP = CGAL::Polygon_mesh_processing; using K = CGAL::Exact_predicates_inexact_constructions_kernel; @@ -18,8 +17,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h index 20982e9beaa..648835842e3 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h @@ -193,7 +193,7 @@ public: { // Due to the Steiner point computation being a dichotomy, the algorithm is inherently inexact // and passing exact kernels is explicitly disabled to ensure no misunderstanding. - CGAL_static_assertion((std::is_floating_point::value)); + static_assert(std::is_floating_point::value); } public: diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h index 6d0f65142f6..c87f82ac75f 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h @@ -146,7 +146,7 @@ public: VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, tmesh)); - CGAL_static_assertion((std::is_same::value_type, Point_3>::value)); + static_assert(std::is_same::value_type, Point_3>::value); Splitter_base::reserve(num_faces(tmesh)); diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h index 57f936306da..0a8f589fc2d 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h @@ -143,7 +143,7 @@ public: #endif PPM pm = choose_parameter(get_parameter(np, internal_np::point_map)); - CGAL_static_assertion((std::is_same::value_type, Point_3>::value)); + static_assert(std::is_same::value_type, Point_3>::value); Splitter_base::reserve(faces.size()); diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp index f8b373c9764..7c48e66a2c1 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp +++ b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp @@ -18,17 +18,17 @@ int main() { { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; CGAL_USE_TYPE(AK_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; CGAL_USE_TYPE(AK_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; CGAL_USE_TYPE(AK_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } return 0; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index e1582795054..8686132cc41 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -90,10 +90,10 @@ public: typedef typename Gt_adaptor_2::Top_side_category Top_side_category; typedef typename Gt_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((std::is_same< Left_side_category, Arr_oblivious_side_tag >::value)); - CGAL_static_assertion((std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value)); - CGAL_static_assertion((std::is_same< Top_side_category, Arr_oblivious_side_tag >::value)); - CGAL_static_assertion((std::is_same< Right_side_category, Arr_oblivious_side_tag >::value)); + static_assert(std::is_same< Left_side_category, Arr_oblivious_side_tag >::value); + static_assert(std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value); + static_assert(std::is_same< Top_side_category, Arr_oblivious_side_tag >::value); + static_assert(std::is_same< Right_side_category, Arr_oblivious_side_tag >::value); //@} /*! \struct diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index 39a618a754d..af2ea182fa7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -38,7 +38,7 @@ namespace CGAL { inline void* _clean_pointer(const void* p) { - CGAL_static_assertion(sizeof(void*) == sizeof(size_t)); + static_assert(sizeof(void*) == sizeof(size_t)); const size_t mask = ~1; const size_t val = (reinterpret_cast(p) & mask); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index 83358c14b12..19a95a662f6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -172,14 +172,14 @@ overlay(const Arrangement_on_surface_2& arr1 typedef typename Agt2::Point_2 A_point; typedef typename Bgt2::Point_2 B_point; typedef typename Rgt2::Point_2 Res_point; - CGAL_static_assertion((boost::is_convertible::value)); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(std::is_convertible::value); + static_assert(std::is_convertible::value); typedef typename Agt2::X_monotone_curve_2 A_xcv; typedef typename Bgt2::X_monotone_curve_2 B_xcv; typedef typename Rgt2::X_monotone_curve_2 Res_xcv; - CGAL_static_assertion((boost::is_convertible::value)); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(std::is_convertible::value); + static_assert(std::is_convertible::value); typedef Arr_traits_basic_adaptor_2 Gt_adaptor_2; typedef Arr_overlay_traits_2 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h index 7ebec8a5eb6..f0ff24f1291 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h @@ -62,9 +62,9 @@ public: typedef std::vector > Root_multiplicity_vector; - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h index ef568ab6cad..8b076506227 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -100,9 +100,9 @@ public: typedef Algebraic_point_2 Point_2; - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); public: const Rational_function& get_rational_function(const Polynomial_1& numerator, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 9b4ea137450..67202ce862f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -91,14 +91,14 @@ public: typedef typename Gt_adaptor_2::Top_side_category Top_side_category; typedef typename Gt_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Left_side_category, Arr_identified_side_tag >::value)); - CGAL_static_assertion((std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Bottom_side_category, Arr_contracted_side_tag >::value)); - CGAL_static_assertion((std::is_same< Top_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Top_side_category, Arr_contracted_side_tag >::value)); - CGAL_static_assertion((std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Right_side_category, Arr_identified_side_tag >::value)); + static_assert(std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Left_side_category, Arr_identified_side_tag >::value); + static_assert(std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Bottom_side_category, Arr_contracted_side_tag >::value); + static_assert(std::is_same< Top_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Top_side_category, Arr_contracted_side_tag >::value); + static_assert(std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Right_side_category, Arr_identified_side_tag >::value); //@} /*! \struct diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index 355dd76641e..09cc7c94710 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -87,14 +87,14 @@ public: typedef typename Gt_adaptor_2::Top_side_category Top_side_category; typedef typename Gt_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Left_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Bottom_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Top_side_category, Arr_oblivious_side_tag>::value || - std::is_same< Top_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Right_side_category, Arr_open_side_tag >::value)); + static_assert(std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Left_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Bottom_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Top_side_category, Arr_oblivious_side_tag>::value || + std::is_same< Top_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Right_side_category, Arr_open_side_tag >::value); //@} /*! \struct diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h index 438f46ced1c..ae87c8ddb28 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h @@ -77,10 +77,10 @@ public: typedef typename Traits_adaptor_2::Top_side_category Top_side_category; typedef typename Traits_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((Arr_sane_identified_tagging::value)); + Right_side_category>::value); public: typedef Arrangement_on_surface_2 diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h index 36f83a0e6a1..81f1c8bad04 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -67,10 +67,10 @@ protected: typedef typename Traits_adaptor_2::Top_side_category Top_side_category; typedef typename Traits_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((Arr_sane_identified_tagging::value)); + Right_side_category>::value); public: typedef ZoneVisitor_ Visitor; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp index 84896d26a68..81eae420496 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp @@ -272,38 +272,38 @@ int main () assert(ident12() == false); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_left_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_left_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same::Category, CGAL::Arr_oblivious_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same::Category, CGAL::Arr_open_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_top_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_top_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_right_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - CGAL_static_assertion( + static_assert( (std::is_same< CGAL::internal::Arr_complete_right_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); diff --git a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_builder.h b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_builder.h index 331f8a0f44b..1dd6235a28c 100644 --- a/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_builder.h +++ b/BGL/include/CGAL/boost/graph/IO/Generic_facegraph_builder.h @@ -49,10 +49,10 @@ public: typedef typename CGAL::GetVertexPointMap::type VPM; // usually will be true, but might not be the case if using custom type points -// CGAL_static_assertion((std::is_same::value_type>::value)); -// CGAL_static_assertion((std::is_same::type>::value)); +// static_assert(std::is_same::value_type>::value); +// static_assert(std::is_same::type>::value); typedef typename internal_np::Lookup_named_param_def< internal_np::vertex_normal_map_t, NamedParameters, diff --git a/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h b/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h index 9d0288d1171..c0e284b6574 100644 --- a/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h +++ b/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h @@ -29,7 +29,7 @@ public: }; template -CGAL_CPP17_INLINE constexpr bool Has_member_clear_v = Has_member_clear::value; +inline constexpr bool Has_member_clear_v = Has_member_clear::value; } // internal } // cgal diff --git a/BGL/test/BGL/test_Has_member_clear.cpp b/BGL/test/BGL/test_Has_member_clear.cpp index 5a78d9a2d7e..b8adc423eb7 100644 --- a/BGL/test/BGL/test_Has_member_clear.cpp +++ b/BGL/test/BGL/test_Has_member_clear.cpp @@ -19,13 +19,13 @@ struct with_clear_const { int main() { using namespace CGAL::internal; - CGAL_static_assertion(Has_member_clear::value); + static_assert(Has_member_clear::value); - CGAL_static_assertion(!Has_member_clear::value); + static_assert(!Has_member_clear::value); - CGAL_static_assertion(!Has_member_clear::value); + static_assert(!Has_member_clear::value); - CGAL_static_assertion(Has_member_clear::value); + static_assert(Has_member_clear::value); return 0; } diff --git a/BGL/test/BGL/test_Has_member_id.cpp b/BGL/test/BGL/test_Has_member_id.cpp index 6ff478d04c2..7cfec0bf8bd 100644 --- a/BGL/test/BGL/test_Has_member_id.cpp +++ b/BGL/test/BGL/test_Has_member_id.cpp @@ -28,17 +28,17 @@ int main() { using namespace CGAL::internal; - CGAL_static_assertion(!Has_member_id::value); - CGAL_static_assertion(Has_member_id::value); - CGAL_static_assertion(!Has_member_id::value); - CGAL_static_assertion(Has_member_id::value); - CGAL_static_assertion(Has_member_id::value); - CGAL_static_assertion( + static_assert(!Has_member_id::value); + static_assert(Has_member_id::value); + static_assert(!Has_member_id::value); + static_assert(Has_member_id::value); + static_assert(Has_member_id::value); + static_assert( (Has_member_id::Face>::value)); - CGAL_static_assertion(!Has_member_id >::value); - CGAL_static_assertion(Has_member_id >::value); - CGAL_static_assertion(Has_member_id >::value); + static_assert(!Has_member_id >::value); + static_assert(Has_member_id >::value); + static_assert(Has_member_id >::value); return 0; } diff --git a/BGL/test/BGL/test_Properties.cpp b/BGL/test/BGL/test_Properties.cpp index ca63a2f7803..04c8ae7beb6 100644 --- a/BGL/test/BGL/test_Properties.cpp +++ b/BGL/test/BGL/test_Properties.cpp @@ -98,7 +98,7 @@ void test_vertex_index_map_uniqueness(const Graph& g, typedef typename CGAL::GetInitializedVertexIndexMap::const_type CVIM; // in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not - static_assert((std::is_same::value), "VIM, CVIM must be the same type"); + static_assert(std::is_same::value, "VIM, CVIM must be the same type"); VIM ivim = CGAL::get_initialized_vertex_index_map(g, np); @@ -114,7 +114,7 @@ void test_halfedge_index_map_uniqueness(const Graph& g, typedef typename CGAL::GetInitializedHalfedgeIndexMap::const_type CHIM; // in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not - static_assert((std::is_same::value), "HIM, CHIM must be the same type"); + static_assert(std::is_same::value, "HIM, CHIM must be the same type"); HIM ihim = CGAL::get_initialized_halfedge_index_map(g, np); @@ -130,7 +130,7 @@ void test_edge_index_map_uniqueness(const Graph& g, typedef typename CGAL::GetInitializedEdgeIndexMap::const_type CEIM; // in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not - static_assert((std::is_same::value), "EIM, CEIM must be the same type"); + static_assert(std::is_same::value, "EIM, CEIM must be the same type"); EIM ieim = CGAL::get_initialized_edge_index_map(g, np); @@ -146,7 +146,7 @@ void test_face_index_map_uniqueness(const Graph& g, typedef typename CGAL::GetInitializedFaceIndexMap::const_type CFIM; // in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not - static_assert((std::is_same::value), "FIM, CFIM must be the same type"); + static_assert(std::is_same::value, "FIM, CFIM must be the same type"); FIM ifim = CGAL::get_initialized_face_index_map(g, np); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h index eeb80bf655d..8a0744933e3 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h @@ -123,14 +123,14 @@ public: typedef typename Arr::Right_side_category Right_side_category; // a side is either oblivious or open (unbounded) - CGAL_static_assertion((std::is_same::value || - std::is_same::value)); - CGAL_static_assertion((std::is_same::value || - std::is_same::value)); - CGAL_static_assertion((std::is_same::value || - std::is_same::value)); - CGAL_static_assertion((std::is_same::value || - std::is_same::value)); + static_assert(std::is_same::value || + std::is_same::value); + static_assert(std::is_same::value || + std::is_same::value); + static_assert(std::is_same::value || + std::is_same::value); + static_assert(std::is_same::value || + std::is_same::value); typedef typename Arr::Halfedge_handle Halfedge_handle; typedef typename Arr::Vertex_handle Vertex_handle; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h index c260e4cf824..d9d6f19c1c9 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h @@ -53,14 +53,14 @@ public: typedef typename Base::Right_side_category Right_side_category; // a side is either oblivious or open (unbounded) - CGAL_static_assertion((std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Left_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Bottom_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Top_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Top_side_category, Arr_open_side_tag >::value)); - CGAL_static_assertion((std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || - std::is_same< Right_side_category, Arr_open_side_tag >::value)); + static_assert(std::is_same< Left_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Left_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Bottom_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Bottom_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Top_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Top_side_category, Arr_open_side_tag >::value); + static_assert(std::is_same< Right_side_category, Arr_oblivious_side_tag >::value || + std::is_same< Right_side_category, Arr_open_side_tag >::value); class Ex_point_2 { diff --git a/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h b/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h index 31b1fb23dd0..43f4061a449 100644 --- a/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h +++ b/Box_intersection_d/include/CGAL/Box_intersection_d/segment_tree.h @@ -326,7 +326,7 @@ public: }; template -CGAL_CPP17_INLINE constexpr bool Has_member_report_v = Has_member_report::value; +inline constexpr bool Has_member_report_v = Has_member_report::value; template inline diff --git a/Box_intersection_d/include/CGAL/box_intersection_d.h b/Box_intersection_d/include/CGAL/box_intersection_d.h index 94752c41462..1ac7a802d7d 100644 --- a/Box_intersection_d/include/CGAL/box_intersection_d.h +++ b/Box_intersection_d/include/CGAL/box_intersection_d.h @@ -63,7 +63,7 @@ void box_intersection_segment_tree_d( const NT sup = Box_intersection_d::box_limits::sup(); #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else // CGAL_LINKED_WITH_TBB if(boost::is_convertible::value) diff --git a/Box_intersection_d/test/Box_intersection_d/test_Has_member_report.cpp b/Box_intersection_d/test/Box_intersection_d/test_Has_member_report.cpp index 12f64d1bc11..d3d5368f965 100644 --- a/Box_intersection_d/test/Box_intersection_d/test_Has_member_report.cpp +++ b/Box_intersection_d/test/Box_intersection_d/test_Has_member_report.cpp @@ -18,8 +18,8 @@ struct With_report_as_a_template_member_function { int main() { using CGAL::Box_intersection_d::Has_member_report; - CGAL_static_assertion(!Has_member_report::value); - CGAL_static_assertion(Has_member_report::value); - CGAL_static_assertion(Has_member_report::value); + static_assert(!Has_member_report::value); + static_assert(Has_member_report::value); + static_assert(Has_member_report::value); return EXIT_SUCCESS; } diff --git a/Circulator/include/CGAL/circulator.h b/Circulator/include/CGAL/circulator.h index 2b1556218f0..2dcb0200ba6 100644 --- a/Circulator/include/CGAL/circulator.h +++ b/Circulator/include/CGAL/circulator.h @@ -193,45 +193,45 @@ template inline void Assert_circulator( const C &) { typedef typename Circulator_traits::category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_iterator( const I &) { typedef typename Circulator_traits::category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_input_category( const I &/*i*/) { typedef typename std::iterator_traits::iterator_category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_output_category( const I &/*i*/) { typedef typename std::iterator_traits::iterator_category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_forward_category( const IC &/*ic*/) { typedef typename std::iterator_traits::iterator_category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_bidirectional_category( const IC &/*ic*/) { typedef typename std::iterator_traits::iterator_category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } template inline void Assert_random_access_category( const IC &/*ic*/) { typedef typename std::iterator_traits::iterator_category category; CGAL_USE_TYPE(category); - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(boost::is_convertible::value); } // The assert at-least-category functions use the following // functions to resolve properly. Note the proper order of the diff --git a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/forest.hpp b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/forest.hpp index 4611becf711..4b8bff71481 100644 --- a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/forest.hpp +++ b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/forest.hpp @@ -164,7 +164,7 @@ public: f (seed_start, sample_idxes, trees, samples, labels, params.n_in_bag_samples, split_generator); #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (std::is_convertible::value) diff --git a/Classification/include/CGAL/Classification/Local_eigen_analysis.h b/Classification/include/CGAL/Classification/Local_eigen_analysis.h index 33e1d706599..78606ed2749 100644 --- a/Classification/include/CGAL/Classification/Local_eigen_analysis.h +++ b/Classification/include/CGAL/Classification/Local_eigen_analysis.h @@ -265,7 +265,7 @@ public: out.m_content->mean_range = 0.; #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (std::is_convertible::value) @@ -353,7 +353,7 @@ public: out.m_content->mean_range = 0.; #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (std::is_convertible::value) @@ -431,7 +431,7 @@ public: #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (std::is_convertible::value) diff --git a/Classification/include/CGAL/Classification/Sum_of_weighted_features_classifier.h b/Classification/include/CGAL/Classification/Sum_of_weighted_features_classifier.h index 2d30a534a42..7f16459723a 100644 --- a/Classification/include/CGAL/Classification/Sum_of_weighted_features_classifier.h +++ b/Classification/include/CGAL/Classification/Sum_of_weighted_features_classifier.h @@ -898,7 +898,7 @@ private: std::size_t gt = j; #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (std::is_convertible::value) diff --git a/Combinatorial_map/include/CGAL/Cell_iterators.h b/Combinatorial_map/include/CGAL/Cell_iterators.h index b54c12bf0c0..93104ba01e2 100644 --- a/Combinatorial_map/include/CGAL/Cell_iterators.h +++ b/Combinatorial_map/include/CGAL/Cell_iterators.h @@ -82,8 +82,8 @@ namespace CGAL { Ite(amap, adart, amap.get_new_mark()), mcell_mark_number(amap.get_new_mark()) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mcell_mark_number)); mark_cell(amap, adart, mcell_mark_number); @@ -196,8 +196,8 @@ namespace CGAL { Ite(amap, adart), mmark_number(amap.get_new_mark()) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); mark_cell(amap, adart, mmark_number); } @@ -303,8 +303,8 @@ namespace CGAL { Base(amap), mmark_number(amap.get_new_mark()) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); mark_cell(amap, (*this), mmark_number); } diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 229a8d1a47d..e2145afb1f3 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -185,7 +185,7 @@ namespace CGAL { */ Combinatorial_map_base() { - CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1, + static_assert(Helper::nb_attribs<=dimension+1, "Too many attributes in the tuple Attributes_enabled"); this->init_storage(); @@ -803,7 +803,7 @@ namespace CGAL { void restricted_set_dart_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "set_dart_attribute called but i-attributes are disabled."); if ( this->template attribute(dh)==ah ) return; @@ -826,7 +826,7 @@ namespace CGAL { void set_dart_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "set_dart_attribute called but i-attributes are disabled."); if ( this->template attribute(dh)==ah ) return; @@ -1524,8 +1524,8 @@ namespace CGAL { template < class Ite > std::ostream& display_orbits(std::ostream & aos) const { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); unsigned int nb = 0; size_type amark = get_new_mark(); for ( typename Dart_range::const_iterator it1(darts().begin()), @@ -1584,7 +1584,7 @@ namespace CGAL { template typename Attribute_descriptor::type create_attribute(const Args&... args) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "create_attribute but i-attributes are disabled"); typename Attribute_descriptor::type res= std::get::value> @@ -1602,7 +1602,7 @@ namespace CGAL { template void erase_attribute(typename Attribute_descriptor::type h) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "erase_attribute but i-attributes are disabled"); std::get::value> (mattribute_containers).erase(h); @@ -1612,7 +1612,7 @@ namespace CGAL { template bool is_attribute_used(typename Attribute_const_descriptor< i >::type ah) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "is_attribute_used but i-attributes are disabled"); return std::get::value> (mattribute_containers).is_used(ah); @@ -1622,7 +1622,7 @@ namespace CGAL { template size_type number_of_attributes() const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "number_of_attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers).size(); @@ -1636,8 +1636,8 @@ namespace CGAL { void set_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion(i<=dimension); - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(i<=dimension); + static_assert(Helper::template Dimension_index::value>=0, "set_attribute but i-attributes are disabled"); for ( typename Dart_of_cell_range::iterator it(*this, dh); it.cont(); ++it) @@ -1651,7 +1651,7 @@ namespace CGAL { template typename Attribute_range::type & attributes() { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers); @@ -1660,7 +1660,7 @@ namespace CGAL { template typename Attribute_const_range::type & attributes() const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers); @@ -1673,7 +1673,7 @@ namespace CGAL { typename Attribute_type::type&)>& onsplit_functor() { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1689,7 +1689,7 @@ namespace CGAL { typename Attribute_type::type&)>& onsplit_functor() const { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1705,7 +1705,7 @@ namespace CGAL { typename Attribute_type::type&)>& onmerge_functor() { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1720,7 +1720,7 @@ namespace CGAL { typename Attribute_type::type&)>& onmerge_functor() const { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h index 06f3c4f4dc3..2b55a2c21c9 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_group_functors.h @@ -64,9 +64,9 @@ struct Group_nonvoid_attribute_functor_of_dart_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2) { - CGAL_static_assertion( 1<=i && i<=CMap::dimension ); - CGAL_static_assertion( i!=j && (i!=1 || j!=0) ); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert( 1<=i && i<=CMap::dimension ); + static_assert( i!=j && (i!=1 || j!=0) ); + static_assert(CMap::Helper::template Dimension_index::value>=0, "Group_attribute_functor_of_dart_run but " "i-attributes are disabled"); @@ -90,8 +90,8 @@ struct Group_nonvoid_attribute_functor_of_dart_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2) { - CGAL_static_assertion(j!=0 && j!=1); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(j!=0 && j!=1); + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_of_dart_run<0> but " "0-attributes are disabled"); @@ -127,7 +127,7 @@ struct Group_nonvoid_attribute_functor_of_dart_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_of_dart_run<0> but " "0-attributes are disabled"); @@ -152,7 +152,7 @@ struct Group_nonvoid_attribute_functor_of_dart_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_of_dart_run<0> but " "0-attributes are disabled"); @@ -240,9 +240,9 @@ struct Group_nonvoid_attribute_functor_run typename CMap::Dart_descriptor adart1, typename CMap::Dart_descriptor adart2) { - CGAL_static_assertion( 1<=i && i<=CMap::dimension ); - CGAL_static_assertion( i!=j ); - CGAL_static_assertion_msg + static_assert( 1<=i && i<=CMap::dimension ); + static_assert( i!=j ); + static_assert ( CMap::Helper::template Dimension_index::value>=0, "Group_attribute_functor_run but i-attributes are disabled" ); typename CMap::template Attribute_descriptor::type @@ -279,10 +279,10 @@ struct Group_nonvoid_attribute_functor_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2 ) { - CGAL_static_assertion_msg + static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_run<0> but 0-attributes are disabled" ); - CGAL_static_assertion(j!=0 && j!=1); + static_assert(j!=0 && j!=1); typename CMap::template Attribute_descriptor<0>::type a1=CMap::null_descriptor, a2=CMap::null_descriptor; @@ -340,7 +340,7 @@ struct Group_nonvoid_attribute_functor_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2 ) { - CGAL_static_assertion_msg + static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_run<0> but 0-attributes are disabled" ); typename CMap::Dart_descriptor od=amap.other_extremity(dh2); @@ -377,7 +377,7 @@ struct Group_nonvoid_attribute_functor_run typename CMap::Dart_descriptor dh1, typename CMap::Dart_descriptor dh2 ) { - CGAL_static_assertion_msg + static_assert ( CMap::Helper::template Dimension_index<0>::value>=0, "Group_attribute_functor_run<0> but 0-attributes are disabled" ); typename CMap::Dart_descriptor od =amap.other_extremity(dh1); @@ -474,9 +474,9 @@ struct Degroup_nonvoid_attribute_functor_run typename CMap::Dart_descriptor adart1, typename CMap::Dart_descriptor adart2) { - CGAL_static_assertion( i<=CMap::dimension ); - CGAL_static_assertion( i!=j ); - CGAL_static_assertion_msg + static_assert( i<=CMap::dimension ); + static_assert( i!=j ); + static_assert ( CMap::Helper::template Dimension_index::value>=0, "Degroup_attribute_functor_run but i-attributes are disabled" ); @@ -549,7 +549,7 @@ void test_split_attribute_functor_one_dart unsigned int, typename CMap::Hash_function> & found_attributes, typename CMap::size_type mark ) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Test_split_attribute_functor_one_dart but " "i-attributes are disabled"); @@ -615,9 +615,9 @@ struct Test_split_nonvoid_attribute_functor_run &modified_darts, typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { - CGAL_static_assertion( 1<=i && i<=CMap::dimension ); + static_assert( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Test_split_attribute_functor_run but " "i-attributes are disabled"); @@ -658,9 +658,9 @@ struct Test_split_nonvoid_attribute_functor_run &modified_darts2, typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { - CGAL_static_assertion( 1<=i && i<=CMap::dimension ); + static_assert( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Test_split_attribute_functor_run but " "i-attributes are disabled"); @@ -720,7 +720,7 @@ struct Test_split_nonvoid_attribute_functor_run typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Test_split_attribute_functor_run<0> but " "0-attributes are disabled"); @@ -772,7 +772,7 @@ struct Test_split_nonvoid_attribute_functor_run typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Test_split_attribute_functor_run<0> but " "0-attributes are disabled"); @@ -858,7 +858,7 @@ struct Test_split_nonvoid_attribute_functor_run &modified_darts2, typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index<0>::value>=0, "Test_split_attribute_functor_run<0> but " "0-attributes are disabled"); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h index 3e0b147942c..c76a210ae6f 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h @@ -220,7 +220,7 @@ struct Test_is_valid_attribute_functor typename CMap::Dart_const_descriptor adart, std::vector& marks, bool& ares) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Test_is_valid_attribute_functor but " " i-attributes are disabled"); @@ -304,7 +304,7 @@ struct Correct_invalid_attributes_functor typename CMap::Dart_descriptor adart, std::vector& marks) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Correct_invalid_attributes_functor but " " i-attributes are disabled"); @@ -362,7 +362,7 @@ struct Cleanup_useless_attributes template static void run(CMap& amap) { - CGAL_static_assertion_msg(CMap::Helper::template + static_assert(CMap::Helper::template Dimension_index::value>=0, "Cleanup_useless_attributes but " " i-attributes are disabled"); @@ -707,7 +707,7 @@ struct Test_is_same_attribute_point_functor typename Map1::Dart_const_descriptor dh1, typename Map2::Dart_const_descriptor dh2) { - CGAL_static_assertion( Withpoint1==true && Withpoint2==true ); + static_assert( Withpoint1==true && Withpoint2==true ); if (m1.template attribute(dh1)==Map1::null_descriptor && m2.template attribute(dh2)==Map2::null_descriptor) return true; diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h index b7974062ae0..7cb121ff1d8 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -34,8 +34,8 @@ namespace CGAL typename Map::Dart_const_descriptor adart1, typename Map::Dart_const_descriptor adart2) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); bool found=false; for (Iterator it(amap, adart1); !found && it.cont(); ++it) @@ -57,8 +57,8 @@ namespace CGAL typename Map::Dart_const_descriptor adart, typename Map::size_type amark) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); bool res=true; for ( Iterator it(amap, adart); res && it.cont(); ++it ) @@ -98,8 +98,8 @@ namespace CGAL typename Map::Dart_const_descriptor adart, typename Map::size_type amark) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion( (is_whole_orbit_unmarked > (amap, adart, amark)) ); @@ -305,8 +305,8 @@ namespace CGAL typename Map::size_type amark, typename Map::size_type amark2=Map::INVALID_MARK) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion( (is_whole_orbit_unmarked > (amap, adart, amark)) ); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h index 0b2c39bc720..a50266f7659 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h @@ -305,8 +305,8 @@ namespace CGAL { typedef typename Map::size_type size_type; - CGAL_static_assertion( (Bi<=Map::dimension && - std::is_same::value) ); + static_assert(Bi<=Map::dimension && + std::is_same::value); public: /// Main constructor. @@ -493,8 +493,8 @@ namespace CGAL { typedef typename Map::size_type size_type; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); /// Main constructor. CMap_non_basic_iterator(Map& amap, Dart_descriptor adart1): @@ -579,8 +579,8 @@ namespace CGAL { /// True iff this iterator is basic typedef Tag_false Basic_iterator; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); /// Main constructor. CMap_non_basic_iterator(Map& amap, Dart_descriptor adart): diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h index 2ba09b32650..6a7a1b6f271 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h @@ -77,7 +77,7 @@ namespace CGAL static size_t run(CMap& amap, typename CMap::Dart_descriptor adart, bool update_attributes) { - CGAL_static_assertion ( 1<=i && i(adart)) ); size_t res = 0; @@ -493,7 +493,7 @@ namespace CGAL static size_t run(CMap& amap, typename CMap::Dart_descriptor adart, bool update_attributes) { - CGAL_static_assertion ( 2<=i && i<=CMap::dimension ); + static_assert ( 2<=i && i<=CMap::dimension ); CGAL_assertion( (amap.template is_contractible(adart)) ); size_t res = 0; diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h index cde06788e0d..8de6b7c1f7f 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h @@ -64,7 +64,7 @@ namespace CGAL { typedef typename Dart_container::size_type size_type; typedef std::nullptr_t Null_descriptor_type; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_descriptor=nullptr; + inline static constexpr Null_descriptor_type null_descriptor=nullptr; using Type_for_compact_container=void*; @@ -107,7 +107,7 @@ namespace CGAL { template using Attribute_const_handle=Attribute_const_descriptor; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_handle=null_descriptor; + inline static constexpr Null_descriptor_type null_handle=null_descriptor; /// Number of marks static const size_type NB_MARKS = 32; @@ -232,7 +232,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -241,7 +241,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -252,7 +252,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); typename Attribute_descriptor::type res= std::get::value> @@ -467,16 +467,6 @@ namespace CGAL { typename Helper::Attribute_containers mattribute_containers; }; -#ifndef CGAL_CXX17 - template - constexpr typename Combinatorial_map_storage_1::Null_descriptor_type - Combinatorial_map_storage_1::null_descriptor; - - template - constexpr typename Combinatorial_map_storage_1::Null_descriptor_type - Combinatorial_map_storage_1::null_handle; -#endif - } // namespace CGAL #if defined(BOOST_GCC) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h index 584442412c5..f1e3d62cbab 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h @@ -266,7 +266,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -275,7 +275,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -286,7 +286,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); // We need to do a reserve before the emplace in order to avoid a bug of // invalid reference when the container is reallocated. diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index 3308def6103..17ffde4b294 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -226,7 +226,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute() { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mattribute_descriptors); @@ -234,7 +234,7 @@ namespace CGAL { template typename Attribute_const_descriptor::type attribute() const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mattribute_descriptors); diff --git a/Combinatorial_map/include/CGAL/Dart_iterators.h b/Combinatorial_map/include/CGAL/Dart_iterators.h index c73a32b383e..2e552f25950 100644 --- a/Combinatorial_map/include/CGAL/Dart_iterators.h +++ b/Combinatorial_map/include/CGAL/Dart_iterators.h @@ -295,13 +295,13 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_descriptor adart): Base(amap, adart) - { CGAL_static_assertion( Bi>=2 && Bi<=Map::dimension ); } + { static_assert( Bi>=2 && Bi<=Map::dimension ); } /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_descriptor adart, size_type /*amark*/): Base(amap, adart) - { CGAL_static_assertion( Bi>=2 && Bi<=Map::dimension ); } + { static_assert( Bi>=2 && Bi<=Map::dimension ); } /// Prefix ++ operator. Self& operator++() @@ -346,7 +346,7 @@ namespace CGAL { typedef Tag_false Use_mark; - CGAL_static_assertion( Bi>1 && delta>1 && Bi+delta<=Map::dimension ); + static_assert( Bi>1 && delta>1 && Bi+delta<=Map::dimension ); public: /// Main constructor. @@ -460,7 +460,7 @@ namespace CGAL { typedef Tag_true Use_mark; - CGAL_static_assertion( 2<=Map::dimension ); + static_assert( 2<=Map::dimension ); public: /// Main constructor. @@ -493,7 +493,7 @@ namespace CGAL { typedef Tag_true Use_mark; - CGAL_static_assertion( 2<=Map::dimension ); + static_assert( 2<=Map::dimension ); public: /// Main constructor. @@ -524,7 +524,7 @@ namespace CGAL { typedef Tag_false Use_mark; - CGAL_static_assertion( delta>1 && delta<=Map::dimension ); + static_assert( delta>1 && delta<=Map::dimension ); public: /// Main constructor. @@ -625,7 +625,7 @@ namespace CGAL { typedef Tag_false Use_mark; - CGAL_static_assertion( delta>1 && delta+1<=Map::dimension ); + static_assert( delta>1 && delta+1<=Map::dimension ); public: /// Main constructor. @@ -726,7 +726,7 @@ namespace CGAL { typedef Tag_false Use_mark; - CGAL_static_assertion( Bi>1 && Bi+1<=Map::dimension ); + static_assert( Bi>1 && Bi+1<=Map::dimension ); public: /// Main constructor. @@ -1026,7 +1026,7 @@ namespace CGAL { typedef Tag_true Use_mark; - CGAL_static_assertion( i>1 && i<=Map::dimension+1 ); + static_assert( i>1 && i<=Map::dimension+1 ); public: /// Main constructor. diff --git a/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h b/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h index 2ec965bb809..cef5f5eeac8 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_vertex_base_2.h @@ -18,6 +18,7 @@ #include #include +#include #include @@ -77,7 +78,7 @@ template std::ostream& operator<<(std::ostream &os, const Convex_hull_vertex_base_2& v) { - return os << static_cast(v) << v.point(); + return os << static_cast(v) << IO::serialize(v.point()); } } //namespace CGAL diff --git a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp index d1bca0f468f..c52ef82bf22 100644 --- a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp @@ -23,12 +23,12 @@ using namespace CGAL::Convex_hull_3::internal; int main() { - CGAL_static_assertion( (std::is_same::type>::value) ); - CGAL_static_assertion( (std::is_same::type>::value) ); - CGAL_static_assertion( (std::is_same::type>::value) ); - CGAL_static_assertion( (std::is_same::type>::value) ); - CGAL_static_assertion( (std::is_same::type>::value) ); - CGAL_static_assertion( (std::is_same,Default_traits_for_Chull_3::type>::value) ); - CGAL_static_assertion( (std::is_same, boost::true_type >::Protector,CGAL::Protect_FPU_rounding >::value) ); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same, boost::true_type >::Protector,CGAL::Protect_FPU_rounding >::value); return 0; } diff --git a/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt b/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt index 64ce1695e41..7b451bf8178 100644 --- a/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt +++ b/Documentation/doc/Documentation/Developer_manual/cmakelist_script.txt @@ -31,7 +31,7 @@ linked. Valid options are, for instance, "filesystem" or "program_options". -This options should suffice to create `CMakeLists.txt` script +These options should suffice to create a `CMakeLists.txt` script for most directories containing programs. However, in some special cases, it might still be required to create the script manually, for instance, if some source files/executables need a different linking than diff --git a/Documentation/doc/Documentation/Preliminaries.txt b/Documentation/doc/Documentation/Preliminaries.txt index 1fccdc134f9..2e2ae95e661 100644 --- a/Documentation/doc/Documentation/Preliminaries.txt +++ b/Documentation/doc/Documentation/Preliminaries.txt @@ -39,10 +39,9 @@ If you are using CMake, then you can set the CMake option `CGAL_HAS_NO_THREADS` `TRUE`. In addition to defining the preprocessor macro `CGAL_HAS_NO_THREADS`, it will also avoid CMake to link with the native threads support library on your system. -\section Preliminaries_cc0x C++14 Support +\section Preliminaries_cc0x C++17 Support -After being based on the \CC standard released in 1998 (and later refined in 2003) for a long time, -\cgal is now based on a newer major version of the standard, C++14. +\cgal is based on the version C++17 of the C++ standard. \section preliminaries_secchecks Checks diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index 1e3fe07e9ba..d55d10c2cbe 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -6,16 +6,16 @@ \section seccompilers Supported Compilers In order to build a program using \cgal, you need a \cpp compiler -supporting C++14 or later. +supporting C++17 or later. \cgal \cgalReleaseNumber is supported (continuously tested) for the following compilers/operating systems: | Operating System | Compiler | | :---------- | :--------------- | -| Linux | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | -| | `Clang` \cgalFootnote{\cgalFootnoteCode{https://clang.llvm.org/}} compiler version 13.0.1 | +| Linux | \gnu `g++` 11.3.0 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | +| | `Clang` \cgalFootnote{\cgalFootnoteCode{https://clang.llvm.org/}} compiler version 15.0.7 | | \ms Windows | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | -| | \ms Visual `C++` 14.0, 15.9, 16.10, 17.0 (\visualstudio 2015, 2017, 2019, and 2022)\cgalFootnote{\cgalFootnoteCode{https://visualstudio.microsoft.com/}} | -| MacOS X | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | +| | \ms Visual `C++` 15.9, 16.10, 17.0 (\visualstudio 2017, 2019, and 2022)\cgalFootnote{\cgalFootnoteCode{https://visualstudio.microsoft.com/}} | +| MacOS X | \gnu `g++` 11.3.0 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | | | Apple `Clang` compiler versions 10.0.1, 12.0.5, and 13.0.0 | diff --git a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt index 4ec56ab4be3..8fbc5618881 100644 --- a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt +++ b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt @@ -290,7 +290,7 @@ by the user at runtime with the second argument. \section TutorialsReconstruction_pipeline Full Pipeline Images -The following figure an example of a full reconstruction pipeline +The following figures show a full reconstruction pipeline applied to a bear statue (courtesy _EPFL Computer Graphics and Geometry Laboratory_ \cgalCite{cgal:e-esmr}). Two mesh processing algorithms (hole filling and isotropic remeshing) are also applied diff --git a/Documentation/doc/Documentation/windows.txt b/Documentation/doc/Documentation/windows.txt index c4daa8fc380..d40059d76cd 100644 --- a/Documentation/doc/Documentation/windows.txt +++ b/Documentation/doc/Documentation/windows.txt @@ -3,7 +3,7 @@ \cgalAutoToc \cgal \cgalReleaseNumber is supported for the following \ms Visual `C++` compilers: -14.0, 15.9, 16.0, 17.0 (\visualstudio 2015, 2017, 2019, and 2022). +15.9, 16.0, 17.0 (\visualstudio 2017, 2019, and 2022). \cgal is a library that has mandatory dependencies that must be first installed: \ref thirdpartyBoost and \ref thirdpartyMPFR. diff --git a/Documentation/doc/resources/1.8.13/menu_version.js b/Documentation/doc/resources/1.8.13/menu_version.js index a66903b10fe..f3b20c2fe00 100644 --- a/Documentation/doc/resources/1.8.13/menu_version.js +++ b/Documentation/doc/resources/1.8.13/menu_version.js @@ -6,7 +6,8 @@ var current_version_local = 'master' var all_versions = [ 'master', - '5.6-beta1', + '6.0-beta1', + '5.6', 'latest', '5.5.2', '5.4.4', diff --git a/Documentation/doc/resources/1.9.6/menu_version.js b/Documentation/doc/resources/1.9.6/menu_version.js index a66903b10fe..f3b20c2fe00 100644 --- a/Documentation/doc/resources/1.9.6/menu_version.js +++ b/Documentation/doc/resources/1.9.6/menu_version.js @@ -6,7 +6,8 @@ var current_version_local = 'master' var all_versions = [ 'master', - '5.6-beta1', + '6.0-beta1', + '5.6', 'latest', '5.5.2', '5.4.4', diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 182ba3c4d99..3a41cabf3f0 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -21,10 +21,6 @@ #include #include -#include -#include -#include - #include #include diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 08a6ebb41a0..183c322257e 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -31,6 +31,7 @@ #include #include #include +#include #if defined(BOOST_MSVC) # pragma warning(push) diff --git a/Generalized_map/include/CGAL/GMap_cell_iterators.h b/Generalized_map/include/CGAL/GMap_cell_iterators.h index a3851f2c297..55dbbff8308 100644 --- a/Generalized_map/include/CGAL/GMap_cell_iterators.h +++ b/Generalized_map/include/CGAL/GMap_cell_iterators.h @@ -70,8 +70,8 @@ namespace CGAL { Base(amap), mmark_number(amap.get_new_mark()) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); mark_cell(amap, (*this), mmark_number); } @@ -183,8 +183,8 @@ namespace CGAL { Base(amap), mmark_number(amap.get_new_mark()) { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); mark_cell(amap, (*this), mmark_number); } diff --git a/Generalized_map/include/CGAL/GMap_dart_iterators.h b/Generalized_map/include/CGAL/GMap_dart_iterators.h index 600288df844..b2eaaf97b70 100644 --- a/Generalized_map/include/CGAL/GMap_dart_iterators.h +++ b/Generalized_map/include/CGAL/GMap_dart_iterators.h @@ -96,7 +96,7 @@ namespace CGAL { typedef Tag_false Use_mark; ///< True iff this iterator uses mark - CGAL_static_assertion( Ai>=0 && Ai<=Map::dimension ); + static_assert( Ai>=0 && Ai<=Map::dimension ); public: /// Main constructor. @@ -154,7 +154,7 @@ namespace CGAL { typedef Tag_false Use_mark; ///< True iff this iterator uses mark typedef Tag_true Basic_iterator; ///< True iff this iterator is basic - CGAL_static_assertion( (0<=Ai && Ai+delta<=Map::dimension && delta>1) ); + static_assert(0<=Ai && Ai+delta<=Map::dimension && delta>1); public: /// Main constructor. @@ -269,7 +269,7 @@ namespace CGAL { typedef Tag_false Use_mark; ///< True iff this iterator uses mark typedef Tag_true Basic_iterator; ///< True iff this iterator is basic - CGAL_static_assertion(0<=Ai && Ai+1<=Map_::dimension); + static_assert(0<=Ai && Ai+1<=Map_::dimension); public: /// Main constructor. @@ -468,9 +468,9 @@ namespace CGAL { typedef Tag_false Use_mark; ///< True iff this iterator uses mark typedef Tag_true Basic_iterator; ///< True iff this iterator is basic - CGAL_static_assertion( (0<=Ai && delta11) ); + delta1>1); public: /// Main constructor. @@ -508,7 +508,7 @@ namespace CGAL { typedef Tag_true Basic_iterator; ///< True iff this iterator is basic - CGAL_static_assertion( Ai=0 && i<=Map::dimension+1 ); + static_assert( i>=0 && i<=Map::dimension+1 ); public: /// Main constructor. diff --git a/Generalized_map/include/CGAL/Generalized_map.h b/Generalized_map/include/CGAL/Generalized_map.h index 3e0f077a989..d7f75bd151a 100644 --- a/Generalized_map/include/CGAL/Generalized_map.h +++ b/Generalized_map/include/CGAL/Generalized_map.h @@ -161,7 +161,7 @@ namespace CGAL { */ Generalized_map_base() { - CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1, + static_assert(Helper::nb_attribs<=dimension+1, "Too many attributes in the tuple Attributes_enabled"); this->init_storage(); @@ -689,7 +689,7 @@ namespace CGAL { void restricted_set_dart_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "set_dart_attribute called but i-attributes are disabled."); if ( this->template attribute(dh)==ah ) return; @@ -712,7 +712,7 @@ namespace CGAL { void set_dart_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "set_dart_attribute called but i-attributes are disabled."); if ( this->template attribute(dh)==ah ) return; @@ -1347,8 +1347,8 @@ namespace CGAL { template < class Ite > std::ostream& display_orbits(std::ostream & aos) const { - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); unsigned int nb = 0; size_type amark = get_new_mark(); for ( typename Dart_range::const_iterator it1(darts().begin()), @@ -1409,7 +1409,7 @@ namespace CGAL { template typename Attribute_descriptor::type create_attribute(const Args&... args) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "create_attribute but i-attributes are disabled"); typename Attribute_descriptor::type res= std::get::value> @@ -1427,7 +1427,7 @@ namespace CGAL { template void erase_attribute(typename Attribute_descriptor::type h) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "erase_attribute but i-attributes are disabled"); std::get::value> (mattribute_containers).erase(h); @@ -1437,7 +1437,7 @@ namespace CGAL { template bool is_attribute_used(typename Attribute_const_descriptor< i >::type ah) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "is_attribute_used but i-attributes are disabled"); return std::get::value> (mattribute_containers).is_used(ah); @@ -1447,7 +1447,7 @@ namespace CGAL { template size_type number_of_attributes() const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "number_of_attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers).size(); @@ -1461,8 +1461,8 @@ namespace CGAL { void set_attribute(Dart_descriptor dh, typename Attribute_descriptor::type ah) { - CGAL_static_assertion(i<=dimension); - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(i<=dimension); + static_assert(Helper::template Dimension_index::value>=0, "set_attribute but i-attributes are disabled"); for ( typename Dart_of_cell_range::iterator it(*this, dh); it.cont(); ++it) @@ -1476,7 +1476,7 @@ namespace CGAL { template typename Attribute_range::type & attributes() { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers); @@ -1485,7 +1485,7 @@ namespace CGAL { template typename Attribute_const_range::type & attributes() const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attributes but i-attributes are disabled"); return std::get::value> (mattribute_containers); @@ -1498,7 +1498,7 @@ namespace CGAL { typename Attribute_type::type&)>& onsplit_functor() { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1514,7 +1514,7 @@ namespace CGAL { typename Attribute_type::type&)>& onsplit_functor() const { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1530,7 +1530,7 @@ namespace CGAL { typename Attribute_type::type&)>& onmerge_functor() { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); @@ -1545,7 +1545,7 @@ namespace CGAL { typename Attribute_type::type&)>& onmerge_functor() const { - CGAL_static_assertion_msg + static_assert (Helper::template Dimension_index::value>=0, "onsplit_functor but " "i-attributes are disabled"); diff --git a/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h b/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h index 4a15c8ea733..4b3c17816e4 100644 --- a/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h +++ b/Generalized_map/include/CGAL/Generalized_map/internal/Generalized_map_group_functors.h @@ -65,9 +65,9 @@ struct GMap_group_attribute_functor_of_dart_run typename GMap::Dart_descriptor dh1, typename GMap::Dart_descriptor dh2) { - CGAL_static_assertion( i<=GMap::dimension ); - CGAL_static_assertion( i!=j ); - CGAL_static_assertion_msg(GMap::Helper::template + static_assert( i<=GMap::dimension ); + static_assert( i!=j ); + static_assert(GMap::Helper::template Dimension_index::value>=0, "GMap_group_attribute_functor_of_dart_run but " "i-attributes are disabled"); @@ -134,9 +134,9 @@ struct GMap_group_attribute_functor_run typename GMap::Dart_descriptor adart1, typename GMap::Dart_descriptor adart2) { - CGAL_static_assertion( i<=GMap::dimension ); - CGAL_static_assertion( i!=j ); - CGAL_static_assertion_msg + static_assert( i<=GMap::dimension ); + static_assert( i!=j ); + static_assert ( GMap::Helper::template Dimension_index::value>=0, "GMap_group_attribute_functor_run but i-attributes are disabled" ); typename GMap::template Attribute_descriptor::type @@ -212,9 +212,9 @@ struct GMap_degroup_attribute_functor_run typename GMap::Dart_descriptor adart1, typename GMap::Dart_descriptor adart2) { - CGAL_static_assertion( i<=GMap::dimension ); - CGAL_static_assertion( i!=j ); - CGAL_static_assertion_msg + static_assert( i<=GMap::dimension ); + static_assert( i!=j ); + static_assert ( GMap::Helper::template Dimension_index::value>=0, "GMap_degroup_attribute_functor_run but i-attributes are disabled" ); @@ -276,7 +276,7 @@ void GMap_test_split_attribute_functor_one_dart unsigned int, typename GMap::Hash_function> & found_attributes, typename GMap::size_type mark ) { - CGAL_static_assertion_msg(GMap::Helper::template + static_assert(GMap::Helper::template Dimension_index::value>=0, "GMap_test_split_attribute_functor_one_dart but " "i-attributes are disabled"); @@ -340,9 +340,9 @@ struct GMap_test_split_attribute_functor_run &modified_darts, typename GMap::size_type mark_modified_darts=GMap::INVALID_MARK) { - CGAL_static_assertion( i<=GMap::dimension ); + static_assert( i<=GMap::dimension ); CGAL_assertion( i!=j ); - CGAL_static_assertion_msg(GMap::Helper::template + static_assert(GMap::Helper::template Dimension_index::value>=0, "GMap_test_split_attribute_functor_run but " "i-attributes are disabled"); @@ -383,9 +383,9 @@ struct GMap_test_split_attribute_functor_run &modified_darts2, typename GMap::size_type mark_modified_darts=GMap::INVALID_MARK) { - CGAL_static_assertion( i<=GMap::dimension ); + static_assert( i<=GMap::dimension ); CGAL_assertion( i!=j ); - CGAL_static_assertion_msg(GMap::Helper::template + static_assert(GMap::Helper::template Dimension_index::value>=0, "GMap_test_split_attribute_functor_run but " "i-attributes are disabled"); diff --git a/Generalized_map/include/CGAL/Generalized_map_iterators_base.h b/Generalized_map/include/CGAL/Generalized_map_iterators_base.h index 15f5bb484bf..034b1600f93 100644 --- a/Generalized_map/include/CGAL/Generalized_map_iterators_base.h +++ b/Generalized_map/include/CGAL/Generalized_map_iterators_base.h @@ -59,8 +59,8 @@ namespace CGAL { typedef Tag_true Use_mark; - CGAL_static_assertion( (Ai<=Map::dimension && - std::is_same::value) ); + static_assert(Ai<=Map::dimension && + std::is_same::value); public: /// Main constructor. diff --git a/Generalized_map/include/CGAL/Generalized_map_operations.h b/Generalized_map/include/CGAL/Generalized_map_operations.h index 8366f3495df..0ebec7a7c5c 100644 --- a/Generalized_map/include/CGAL/Generalized_map_operations.h +++ b/Generalized_map/include/CGAL/Generalized_map_operations.h @@ -73,7 +73,7 @@ namespace CGAL static size_t run(GMap& amap, typename GMap::Dart_descriptor adart, bool update_attributes) { - CGAL_static_assertion ( i(adart)) ); size_t res = 0; @@ -292,7 +292,7 @@ namespace CGAL static size_t run(GMap& amap, typename GMap::Dart_descriptor adart, bool update_attributes) { - CGAL_static_assertion ( 1<=i && i<=GMap::dimension ); + static_assert ( 1<=i && i<=GMap::dimension ); CGAL_assertion( (amap.template is_contractible(adart)) ); size_t res = 0; diff --git a/Generalized_map/include/CGAL/Generalized_map_storages.h b/Generalized_map/include/CGAL/Generalized_map_storages.h index d628b153a5e..469741cbb16 100644 --- a/Generalized_map/include/CGAL/Generalized_map_storages.h +++ b/Generalized_map/include/CGAL/Generalized_map_storages.h @@ -64,7 +64,7 @@ namespace CGAL { typedef typename Dart_container::size_type size_type; typedef std::nullptr_t Null_descriptor_type; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_descriptor=nullptr; + inline static constexpr Null_descriptor_type null_descriptor=nullptr; using Type_for_compact_container=void*; @@ -107,7 +107,7 @@ namespace CGAL { template using Attribute_const_handle=Attribute_const_descriptor; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_handle=null_descriptor; + inline static constexpr Null_descriptor_type null_handle=null_descriptor; /// Number of marks static const size_type NB_MARKS = 32; @@ -229,7 +229,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -238,7 +238,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -249,7 +249,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); typename Attribute_descriptor::type res= std::get::value> @@ -457,17 +457,6 @@ namespace CGAL { /// Tuple of attributes containers typename Helper::Attribute_containers mattribute_containers; }; - -#ifndef CGAL_CXX17 - template - constexpr typename Generalized_map_storage_1::Null_descriptor_type - Generalized_map_storage_1::null_descriptor; - - template - constexpr typename Generalized_map_storage_1::Null_descriptor_type - Generalized_map_storage_1::null_handle; -#endif - } // namespace CGAL #if defined(BOOST_GCC) diff --git a/Generalized_map/include/CGAL/Generalized_map_storages_with_index.h b/Generalized_map/include/CGAL/Generalized_map_storages_with_index.h index 828004b8416..ffd867477f2 100644 --- a/Generalized_map/include/CGAL/Generalized_map_storages_with_index.h +++ b/Generalized_map/include/CGAL/Generalized_map_storages_with_index.h @@ -220,7 +220,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -229,7 +229,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -240,7 +240,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); // We need to do a reserve before the emplace in order to avoid a bug of // invalid reference when the container is reallocated. diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index 0dead11c3ca..330e5005d53 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -752,8 +752,8 @@ class Surface_mesh_geodesic_distances_3 > #endif { - CGAL_static_assertion((std::is_same::value) || - (std::is_same::value)); + static_assert(std::is_same::value || + std::is_same::value); // extract real types from Default #ifdef CGAL_EIGEN3_ENABLED diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index e909d9ea8f5..42c4ca9f341 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -1,6 +1,17 @@ Release History =============== +======= +[Release 6.0](https://github.com/CGAL/cgal/releases/tag/v6.0) +----------- + +Release date: October 2023 + +### General Changes + +- **Breaking change**: C++17 is now required +- Support for Visual `C++` 14.0 (Visual studio 2015) is dropped. + ### [3D Mesh Generation](https://doc.cgal.org/6.0/Manual/packages.html#PkgMesh3) - **Breaking change**: Removed the concept `TriangleAccessor`, the template parameter `TriangleAccessor`, as well @@ -10,6 +21,7 @@ Release History which are deprecated since CGAL-4.13. + [Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6) ----------- @@ -17,129 +29,31 @@ Release date: June 2023 ### General Changes -- **Breaking change**: The per package assertions, pre- and postconditions are no longer supported. +- **Breaking change**: Package-specific assertions, preconditions, and postconditions (such as + `CGAL_triangulation_assertion`) have been removed. Corresponding CGAL-wide versions (such as + `CGAL_assertion`) should be used instead. -### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.6/Manual/packages.html#PkgKernel23) -- Added the functor - [`CompareAngle_3`](https://doc.cgal.org/5.6/Kernel_23/classKernel_1_1CompareAngle__3.html) - to the concept [`Kernel`](https://doc.cgal.org/5.6/Kernel_23/classKernel.html) to compare - an angle defined by three points to the cosinus of another angle. +### [Shape Detection](https://doc.cgal.org/5.6/Manual/packages.html#PkgShapeDetection) (major changes) -### [Combinatorial Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgCombinatorialMaps) [Generalized Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgGeneralizedMaps) [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) - -- Added a version that uses indices instead of handles as dart and attribute descriptors. As the indices are integers convertible from and to `std::size_t`, they can be used as index into vectors which store properties. To use the index version, `Use_index` must be defined and be equal to `CGAL::Tag_true` in the item class. - -### [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) -- Added the class `Linear_cell_complex_incremental_builder_3`. - -### [Polygon Mesh Processing](https://doc.cgal.org/5.6/Manual/packages.html#PkgPolygonMeshProcessing) - -- **Breaking change**: Deprecated the overloads of functions `CGAL::Polygon_mesh_processing::triangulate_hole()`, - `CGAL::Polygon_mesh_processing::triangulate_and_refine_hole()`, and `CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole()` - which have output iterators for vertices and faces as parameter. They are replaced by overloads with two additional named parameters. - -- added functions `CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()` and `CGAL::Polygon_mesh_processing::detect_corners_of_regions()` - that allow to have a partition into planar regions of a mesh using the region growing algorithm from the [Shape Detection](https://doc.cgal.org/5.6/Manual/packages.html#PkgShapeDetection) package. - -- Added the function `CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing()`, that remeshes a surface triangle mesh following the -CGAL tetrahedral Delaunay refinement algorithm. - -- Added the function `CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing()`, that remeshes a surface triangle mesh using - the Delaunay refinement algorithm from the 3D Mesh Generation package. - -- Added the function `CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces()` to remove badly shaped triangles faces in a mesh. - -- Added the function `CGAL::Polygon_mesh_processing::triangulate_polygons()`, which allows users to triangulate polygon soups. - -- Added the functions `CGAL::Polygon_mesh_processing::remesh_planar_patches()` and - `CGAL::Polygon_mesh_processing::remesh_almost_coplanar_patches()` to retriangulate patches of coplanar faces in a mesh. - -- Added a named parameter to `CGAL::Polygon_mesh_processing::smooth_shape()` to disable scaling to compensate volume loss. - -- Added the functions `CGAL::Polygon_mesh_processing::does_triangle_soup_self_intersect()` and `CGAL::Polygon_mesh_processing::triangle_soup_self_intersections()` to identify and report self-intersections in a triangle soup, similarly to existing functions on triangle meshes. - -### [3D Simplicial Mesh Data Structure](https://doc.cgal.org/5.6/Manual/packages.html#PkgSMDS3) (new package) - -- This new package wraps all the existing code that deals with a `MeshComplex_3InTriangulation_3` to describe 3D simplicial meshes, and makes the data structure independent from the tetrahedral mesh generation package. - -### [Shape Detection](https://doc.cgal.org/5.6/Manual/packages.html#PkgShapeDetection) (breaking change, major changes) - -- **Breaking change**: The region growing part of the package have been reworked to fix design issues introduced with the handling `FaceGraph` models. - In particular, the notion of `Item` has been introduced to reference an element in the input range of elements. Region maps now operates on `Item` and no longer on the value type - of the input range. -- **Breaking change**: The method `update()` in the concept `RegionType` returns now - a `boolean` instead of `void` that is used inside the class `Region_growing` for detecting if - the input conditions for the new region are satisfied. This change affects only user-defined - types of regions. -- **Breaking change**: The constructors of all models used together with the region growing algorithm now enable users - to provide parameters through the named parameters mechanism. +- **Breaking change**: The region growing part of the package have been reworked to fix design + issues introduced with the handling of `FaceGraph` models. In particular, the notion of `Item` + has been introduced to reference an element in the input range of elements. Region maps now + operates on `Item` and no longer on the value type of the input range. +- **Breaking change**: The method `update()` in the concept `RegionType` now returns a `Boolean` + instead of `void`, that is used inside the class `Region_growing` for detecting if the input + conditions for the new region are satisfied. This change affects only user-defined types of regions. +- **Breaking change**: The constructors of all models used together with the region growing algorithm + now enable users to provide parameters through the [named parameters](https://doc.cgal.org/latest/BGL/group__bgl__namedparameters.html) mechanism. - All fitting classes in the region growing framework are now using better versions of the region conditions, more precise and faster, including the correct normal orientations. - Added new models of the concept `RegionType` for getting linear regions in a set of 2D and 3D segments and on 2D and 3D polylines. -- Added the `Polyline_graph` class for extracting a set of polylines from a face graph, which splits +- Added the class `Polyline_graph` for extracting a set of polylines from a face graph, which splits this graph into a set of user-defined regions. - Added new shapes to the Region Growing algorithm on a point set: circles in 2D, spheres in 3D, and cylinders in 3D. -### [2D Arrangements](https://doc.cgal.org/5.6/Manual/packages.html#PkgArrangementOnSurface2) - -- Fixed some code that handles geodesic-curves on spheres that compare x- and y-coordinates on the boundary of the parameter space. It mainly effected the naive point-location. -- Introduced an overload function template, namely `draw(arr)`, that renders arrangements based on the `Basic_viewer_qt` class template. At this point only 2D arrangements on the plane induced by (i) segments, (ii) conics, and (iii) circular arcs or (linear) segments are supported. -- Improved the traits class template that handles conics, namely `Arr_conic_traits_2`. This includes the following: - 1. Fixed a couple of bugs and slightly optimized some functions. - 2. Introduced functionality that approximates conics with polylines. (This is used to draw conic curves.) - 3. **Breaking change**: Changed the interface to generate conic curves. In the past, curves where generated directly using the constructors of the conic and x-monotone conic constructs. Now, they are constructed via function objects provided by the traits. This eliminates the constructions of temporary kernels. The old functionality is obsolete, but still supported for a limited number of versions. It depends on a static member function of the traits. In a future version this function will no longer be static, implying that the old functionality will no longer be supported. -- Introduced functionality that approximates circular segments with polylines. (This is used to draw conic curves.) - -### [2D Convex Hulls](https://doc.cgal.org/5.6/Manual/packages.html#PkgConvexHull2) - -- **Breaking change**: The concept `ConvexHullTraits_2` no longer requires the functor - `Less_signed_distance_to_line_2`, but requires the functor `Compare_signed_distance_to_line_2` instead. -- The long-deprecated classes `Convex_hull_projective_xy_traits_2`, `Convex_hull_projective_xz_traits_2`, - and `Convex_hull_projective_yz_traits_2` have been removed. Users should use `Projection_traits_xy_3`, - `Projection_traits_xz_3`, and `Projection_traits_yz_3` instead. - -### [2D Triangulations](https://doc.cgal.org/5.6/Manual/packages.html#PkgTriangulation2) - -- Added function `mark_domains_in_triangulation()` to mark faces connected with non constrained edges as inside of the domain based on the nesting level. - -### [2D Conforming Triangulations and Meshes](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh2) - -- Deprecated usage of boost parameters in favor of function named parameters in `CGAL::lloyd_optimize_mesh_2()`. -- Deprecated two overloads of Function `refine_Delaunay_mesh()` and replaced them with versions using function named parameters. -- Add overloads of function `write_VTU()` with property maps for specifying the domain. - -### [3D Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh3) -- Deprecated usage of boost parameters in favor of function named parameters. -- Added two new named parameters to the named constructor `CGAL::create_labeled_image_mesh_domain()` -for automatic detection and protection -of 1D-curves that lie at the intersection of three or more subdomains, -extracted from labeled images. -- Added `CGAL::Sizing_field_with_aabb_tree`, a geometry-aware sizing field for feature edges in polyhedral domains. -- Added new meshing criterion `edge_min_size` to avoid subdividing sharp edges that are shorter than the prescribed size bound. -- Added new meshing criteria `facet_min_size` and `cell_min_size` to prevent Delaunay refinement from creating simplices smaller than the prescribed bound. - -### [3D Periodic Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgPeriodic3Mesh3) -- Periodic Mesh Generation now supports non-cubic domains. -- Deprecated usage of boost parameters in favor of function named parameters. - -### [2D Hyperbolic Triangulations](https://doc.cgal.org/5.6/Manual/packages.html#PkgHyperbolicTriangulation2) - -- **Breaking change**: the concept `HyperbolicTriangulationFaceBase_2` has been modified to - better reflect the triangulation's requirements and avoid a conflict with the requirements - described by the concept `TriangulationDataStructure_2::Face`. The model `CGAL::Hyperbolic_triangulation_face_base_2` - has been adapted correspondingly. - -### [Surface Mesh Simplification](https://doc.cgal.org/5.6/Manual/packages.html#PkgSurfaceMeshSimplification) -- The stop predicates `Count_stop_predicate` and `Count_ratio_stop_predicate` are renamed to `Edge_count_stop_predicate` and `Edge_count_ratio_stop_predicate`. Older versions have been deprecated. -- Introduce `Face_count_stop_predicate` and `Face_count_ratio_stop_predicate` that can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers. - -### [2D Minkowski Sums](https://doc.cgal.org/5.6/Manual/packages.html#PkgMinkowskiSum2) -- Fixed a bug that made holes in the Minkowski sum disappear -- Fixed hole filtering. The code used to erroneously remove holes from the container of holes of polygons with holes that did not affect the minkowsi sum. Now it simply adds those that do affect it. - -### [2D Straight Skeleton and Polygon Offsetting (breaking change)](https://doc.cgal.org/5.6/Manual/packages.html#PkgStraightSkeleton2) (major changes) +### [2D Straight Skeleton and Polygon Offsetting](https://doc.cgal.org/5.6/Manual/packages.html#PkgStraightSkeleton2) (major changes) - Added weighted straight skeletons: weighted straight skeletons are a generalization of straight skeletons. Contour edges are assigned a positive weight, which can be understood as assigning a speed to the wavefront spawned from the contour edge. @@ -147,18 +61,197 @@ extracted from labeled images. straight skeletons of polygons with holes. The output is a closed, combinatorially 2-manifold surface triangle mesh. -### [2D Regularized Boolean Set Operations](https://doc.cgal.org/5.6/Manual/packages.html#PkgBooleanSetOperations2) -- Exposed all required member functions of the `GeneralPolygonWithHoles_2` concept (e.g., `clear_outer_boundary()`, `clear_holes()`, and `clear()`). + See also the [news entry](https://www.cgal.org/2023/05/09/improved_straight_skeleton/). -### [Polygon](https://doc.cgal.org/5.6/Manual/packages.html#PkgPolygon2) -- Fixed the function `draw(const CGAL::Polygon_with_holes_2& pwh, const char* title)` to enable the correct drawing of unbounded polygons with holes. +### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.6/Manual/packages.html#PkgKernel23) + +- Added the functor + [`CompareAngle_3`](https://doc.cgal.org/5.6/Kernel_23/classKernel_1_1CompareAngle__3.html) + to the concept + [`Kernel`](https://doc.cgal.org/5.6/Kernel_23/classKernel.html) to compare + an angle defined by three points to the cosinus of another angle. + +### [Combinatorial Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgCombinatorialMaps), [Generalized Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgGeneralizedMaps), and [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) + +- Added a version that uses indices instead of handles as dart and attribute descriptors. + As the indices are integers convertible from and to `std::size_t`, they can be used as index + into vectors which store properties. To use the index version, `Use_index` must be defined + and be equal to `CGAL::Tag_true` in the item class. + +### [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) + +- Added the class + [`Linear_cell_complex_incremental_builder_3`](https://doc.cgal.org/5.6/Linear_cell_complex/classCGAL_1_1Linear__cell__complex__incremental__builder__3.html). + +### [2D Arrangements](https://doc.cgal.org/5.6/Manual/packages.html#PkgArrangementOnSurface2) + +- Introduced an overload function template, namely `draw(arr)`, that renders arrangements based + on the `Basic_viewer_qt` class template. As of now, only 2D arrangements on the plane induced + by (i) segments, (ii) conics, and (iii) circular arcs or (linear) segments are supported. +- Improved the traits class template that handles conics, namely + [`Arr_conic_traits_2`](https://doc.cgal.org/5.6/Arrangement_on_surface_2/classCGAL_1_1Arr__conic__traits__2.html). + This includes the following: + 1. Fixed a couple of bugs and slightly optimized some functions. + 2. Introduced functionality that approximates conics with polylines. (This is used to draw conic curves.) + 3. **Breaking change**: Changed the interface to generate conic curves. In the past, curves where + generated directly using the constructors of the conic and x-monotone conic constructs. Now, + they are constructed via function objects provided by the traits. This eliminates the constructions + of temporary kernels. The old functionality is obsolete, but still supported for a limited number + of versions. It depends on a static member function of the traits. In a future version this function + will no longer be static, implying that the old functionality will no longer be supported. +- Introduced functionality that approximates circular segments with polylines. (This is used to draw conic curves.) + +### [Polygon Mesh Processing](https://doc.cgal.org/5.6/Manual/packages.html#PkgPolygonMeshProcessing) + +- Added functions + [`CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PkgPolygonMeshProcessingRef.html#ga50dcd2f6295f584d2e378b57290ae2af) + and + [`CGAL::Polygon_mesh_processing::detect_corners_of_regions()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PkgPolygonMeshProcessingRef.html#gac8e445730d718a2fc49604e865017d2e), + which enable partitioning a mesh into planar regions using the region growing algorithm + from the [Shape Detection](https://doc.cgal.org/5.6/Manual/packages.html#PkgShapeDetection) package. + +- Added the functions + [`CGAL::Polygon_mesh_processing::remesh_planar_patches()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__meshing__grp.html#ga7fca6fa2db94560ab6d32e6a77fc35b6) + and + [`CGAL::Polygon_mesh_processing::remesh_almost_planar_patches()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__meshing__grp.html#ga0e6da479548199a5d82c3cf0ed36e8a0), + which can be used to remesh patches of coplanar faces in a mesh. + +- Added the function + [`CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__meshing__grp.html#gaff62f9415d2fe96d1d3095351f156ced), + which can be used to remesh a surface triangle mesh using the Delaunay refinement algorithm + from the [3D Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh3) package. + +- Added the function + [`CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__geometric__repair__grp.html#ga48008d2b66de8a68a7068f29db15dad6), + which can be used to remove badly shaped triangles faces in a mesh. + +- Added the functions + [`CGAL::Polygon_mesh_processing::does_triangle_soup_self_intersect()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__intersection__grp.html#ga4909920dc48b8285e69feb845feb1e53) + and + [`CGAL::Polygon_mesh_processing::triangle_soup_self_intersections()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__intersection__grp.html#ga1c5fee17bd0d92d5a2fba77ed94d4b4d) + to identify and report self-intersections in a triangle soup, similarly to existing functions on triangle meshes. + +- Added the function + [`CGAL::Polygon_mesh_processing::triangulate_polygons()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__meshing__grp.html#ga8b7db6aa8c3e79526b594739ba926d82), + which allows users to triangulate polygon soups. + +- Added a named parameter to + [`CGAL::Polygon_mesh_processing::smooth_shape()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__meshing__grp.html#ga57fa999abe8dc557003482444df2a189) + to disable the scaling, which otherwise aims to compensate volume loss during smoothing. + +- Deprecated the overloads of functions + [`CGAL::Polygon_mesh_processing::triangulate_hole()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__hole__filling__grp.html#ga3abdf2d0558822e85f060966b69cae98), + [`CGAL::Polygon_mesh_processing::triangulate_and_refine_hole()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__hole__filling__grp.html#ga9868fac4d9dca77462ad7828bc99d8a1), + and + [`CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole()`](https://doc.cgal.org/5.6/Polygon_mesh_processing/group__PMP__hole__filling__grp.html#ga18eac756a8f8e5d5f73e645fd4e26cad) + which have output iterators for vertices and faces as parameter. They are replaced by overloads + with two additional named parameters. + +### [2D Convex Hulls](https://doc.cgal.org/5.6/Manual/packages.html#PkgConvexHull2) + +- **Breaking change**: The concept + [`ConvexHullTraits_2`](https://doc.cgal.org/5.6/Convex_hull_2/classConvexHullTraits__2.html) + no longer requires the functor `Less_signed_distance_to_line_2`, but requires the functor + `Compare_signed_distance_to_line_2` + instead. +- The long-deprecated classes `Convex_hull_projective_xy_traits_2`, `Convex_hull_projective_xz_traits_2`, + and `Convex_hull_projective_yz_traits_2` have been removed. Users should use + [`Projection_traits_xy_3`](https://doc.cgal.org/5.6/Kernel_23/classCGAL_1_1Projection__traits__xy__3.html), + [`Projection_traits_xz_3`](https://doc.cgal.org/5.6/Kernel_23/classCGAL_1_1Projection__traits__xz__3.html), + and + [`Projection_traits_yz_3`](https://doc.cgal.org/5.6/Kernel_23/classCGAL_1_1Projection__traits__yz__3.html) + instead. + +### [2D Triangulations](https://doc.cgal.org/5.6/Manual/packages.html#PkgTriangulation2) + +- Added the function + [`CGAL::mark_domain_in_triangulation()`](https://doc.cgal.org/5.6/Triangulation_2/group__PkgTriangulation2Miscellaneous.html#ga0409755d0eb89100810230443a85e7eb) + to mark faces connected with non-constrained edges as inside of the domain based on the nesting level. + +### [2D Conforming Triangulations and Meshes](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh2) + +- Added new overloads to the function + [`write_VTU()`](https://doc.cgal.org/5.6/Mesh_2/group__PkgMesh2IO.html), + with property maps for specifying the domain. +- Deprecated usage of boost parameters in favor of function named parameters in + [`CGAL::lloyd_optimize_mesh_2()`](https://doc.cgal.org/5.6/Mesh_2/group__PkgMesh2Functions.html#gafeaf59d3fa014da287f8514913b38d05). +- Deprecated two overloads of the function + [`refine_Delaunay_mesh()`](https://doc.cgal.org/5.6/Mesh_2/group__PkgMesh2Functions.html), + and replaced them with versions using function named parameters. + +### [2D Hyperbolic Triangulations](https://doc.cgal.org/5.6/Manual/packages.html#PkgHyperbolicTriangulation2) + +- **Breaking change**: the concept + [`HyperbolicTriangulationFaceBase_2`](https://doc.cgal.org/5.6/Hyperbolic_triangulation_2/classHyperbolicTriangulationFaceBase__2.html) + has been modified to + better reflect the triangulation's requirements and avoid a conflict with the requirements + described by the concept `TriangulationDataStructure_2::Face`. The model + [`CGAL::Hyperbolic_triangulation_face_base_2`](https://doc.cgal.org/5.6/Hyperbolic_triangulation_2/classCGAL_1_1Hyperbolic__triangulation__face__base__2.html) + has been adapted correspondingly. + +### [3D Simplicial Mesh Data Structure](https://doc.cgal.org/5.6/Manual/packages.html#PkgSMDS3) (new package) + +- This new package wraps all the existing code that deals with a + [`MeshComplex_3InTriangulation_3`](https://doc.cgal.org/5.6/SMDS_3/classMeshComplex__3InTriangulation__3.html) + to describe 3D simplicial meshes, and makes the data structure independent + from the [tetrahedral mesh generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh3) package. + +### [3D Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh3) + +- Added two new named parameters to the named constructor + [`CGAL::create_labeled_image_mesh_domain()`](https://doc.cgal.org/5.6/Mesh_3/classCGAL_1_1Labeled__mesh__domain__3.html#aec3f58e9883a8036a1b3e379df7d8fa9) + for automatic detection and protection of 1D-curves that lie at the intersection of + three or more subdomains extracted from labeled images. +- Added + [`CGAL::Sizing_field_with_aabb_tree`](https://doc.cgal.org/5.6/Mesh_3/structCGAL_1_1Sizing__field__with__aabb__tree.html), + a geometry-aware sizing field for feature edges in polyhedral domains. +- Added new meshing criterion + [`edge_min_size`](https://doc.cgal.org/5.6/Mesh_3/classCGAL_1_1Mesh__criteria__3.html#a5f1c2649cb7ea346a3b6a2a8724b4df1) + to avoid subdividing sharp edges that are shorter than a prescribed size bound. +- Added new meshing criteria + [`facet_min_size`](https://doc.cgal.org/5.6/Mesh_3/classCGAL_1_1Mesh__criteria__3.html#a5f1c2649cb7ea346a3b6a2a8724b4df1) + and + [`cell_min_size`](https://doc.cgal.org/5.6/Mesh_3/classCGAL_1_1Mesh__criteria__3.html#a5f1c2649cb7ea346a3b6a2a8724b4df1) + to prevent Delaunay refinement from creating simplices smaller than a prescribed bound. +- Deprecated usage of boost parameters in favor of function named parameters. + +### [3D Periodic Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgPeriodic3Mesh3) + +- Periodic Mesh Generation now supports non-cubic domains. +- Deprecated usage of boost parameters in favor of function named parameters. + +### [Surface Mesh Simplification](https://doc.cgal.org/5.6/Manual/packages.html#PkgSurfaceMeshSimplification) +- The stop predicates + [`Count_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Count__stop__predicate.html) + and + [`Count_ratio_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Count__ratio__stop__predicate.html) + are renamed to + [`Edge_count_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Edge__count__stop__predicate.html) + and + [`Edge_count_ratio_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Edge__count__ratio__stop__predicate.html). + Older versions have been deprecated. +- Introduced + [`Face_count_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Face__count__stop__predicate.html) + and + [`Face_count_ratio_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Face__count__ratio__stop__predicate.html), + which can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers. + +### [2D Regularized Boolean Set Operations](https://doc.cgal.org/5.6/Manual/packages.html#PkgBooleanSetOperations2) +- Exposed all required member functions of the + [`GeneralPolygonWithHoles_2`](https://doc.cgal.org/5.6/Polygon/classGeneralPolygonWithHoles__2.html) + concept (e.g., + [`clear_outer_boundary()`](https://doc.cgal.org/5.6/Polygon/classGeneralPolygonWithHoles__2.html#a9f5f035047505a2ccab3e68770f51bc6), + [`clear_holes()`](https://cgal.geometryfactory.com/CGAL/doc/master/Polygon/classGeneralPolygonWithHoles__2.html#a2a507be648f127ac605da8c670ea2580), + and + [`clear()`](https://doc.cgal.org/5.6/Polygon/classGeneralPolygonWithHoles__2.html#a2ca4d9b43cc9216c1b2cdb080a915944) + ). [Release 5.5](https://github.com/CGAL/cgal/releases/tag/v5.5) ----------- Release date: June 2022 -### [3D Alpha Wrapping (new package)](https://doc.cgal.org/5.5/Manual/packages.html#PkgAlphaWrap3) +### [3D Alpha Wrapping](https://doc.cgal.org/5.5/Manual/packages.html#PkgAlphaWrap3) (new package) - This component takes a 3D triangle mesh, soup, or point set as input, and generates a valid (watertight, intersection-free, and combinatorially 2-manifold) surface triangle mesh @@ -172,7 +265,7 @@ Release date: June 2022 See also the [announcement page](https://www.cgal.org/2022/05/18/alpha_wrap/). -### [2D Straight Skeleton and Polygon Offsetting (breaking change)](https://doc.cgal.org/5.5/Manual/packages.html#PkgStraightSkeleton2) +### [2D Straight Skeleton and Polygon Offsetting](https://doc.cgal.org/5.5/Manual/packages.html#PkgStraightSkeleton2) (breaking change) - Fix the output of the function [CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()](https://doc.cgal.org/5.5/Straight_skeleton_2/group__PkgStraightSkeleton2OffsetFunctions.html#gaa159f093e5d6d7fdb62c1660a44f95fe) to not take into account the offset of the outer frame. - Fix the computation of the exterior offset of a polygon with holes that was not computing the offset of the holes diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index fd8997d5f0d..00ce9e422de 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -946,7 +946,7 @@ ${Qt5Widgets_DEFINITIONS} ${Qt5OpenGL_DEFINITIONS} ${Qt5Gui_DEFINITIONS} \ ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS} -fPIC \ ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS} \ ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt5_3RD_PARTY_DEFINITIONS} \ -${CGAL_DEFINITIONS}") +${CGAL_DEFINITIONS} -std=c++17") message("COMPILATION OPTIONS ARE : ${compile_options}") if(NOT RS_FOUND AND NOT RS3_FOUND) diff --git a/Installation/cmake/modules/CGAL_Eigen3_support.cmake b/Installation/cmake/modules/CGAL_Eigen3_support.cmake index cc0df0fad10..bfcf56c7c2f 100644 --- a/Installation/cmake/modules/CGAL_Eigen3_support.cmake +++ b/Installation/cmake/modules/CGAL_Eigen3_support.cmake @@ -1,9 +1,14 @@ -if(EIGEN3_FOUND AND NOT TARGET CGAL::Eigen3_support) +if((EIGEN3_FOUND OR Eigen3_FOUND) AND NOT TARGET CGAL::Eigen3_support) if(NOT TARGET Threads::Threads) find_package(Threads REQUIRED) endif() add_library(CGAL::Eigen3_support INTERFACE IMPORTED) set_target_properties(CGAL::Eigen3_support PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "CGAL_EIGEN3_ENABLED" - INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") + INTERFACE_COMPILE_DEFINITIONS "CGAL_EIGEN3_ENABLED") + if(TARGET Eigen3::Eigen) + target_link_libraries(CGAL::Eigen3_support INTERFACE Eigen3::Eigen) + else() + set_target_properties(CGAL::Eigen3_support PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") + endif() endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 7329be33116..355bde0dd6d 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -97,9 +97,6 @@ function(CGAL_setup_CGAL_dependencies target) target_compile_definitions(${target} INTERFACE CGAL_TEST_SUITE=1) endif() - # CGAL now requires C++14. `decltype(auto)` is used as a marker of C++14. - target_compile_features(${target} INTERFACE cxx_decltype_auto) - use_CGAL_Boost_support(${target} INTERFACE) # Make CGAL depend on threads-support (for Epeck and Epeck_d) @@ -119,6 +116,13 @@ function(CGAL_setup_CGAL_dependencies target) target_link_options(${target} INTERFACE -fsanitize=address) endif() # Now setup compilation flags + CGAL_setup_CGAL_flags(${target}) +endfunction() + +function(CGAL_setup_CGAL_flags target) + # CGAL now requires C++17 + target_compile_features(${target} INTERFACE cxx_std_17) + if(MSVC) target_compile_options(${target} INTERFACE "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS") @@ -127,11 +131,6 @@ function(CGAL_setup_CGAL_dependencies target) $<$:/fp:except-> $<$:/bigobj> # Use /bigobj by default ) - if(MSVC_TOOLSET_VERSION VERSION_LESS_EQUAL 140) # for MSVC 2015 - target_compile_options(${target} INTERFACE - $<$:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded" - ) - endif() elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.3) message(STATUS "Apple Clang version ${CMAKE_CXX_COMPILER_VERSION} compiler detected") diff --git a/Installation/cmake/modules/CGAL_pointmatcher_support.cmake b/Installation/cmake/modules/CGAL_pointmatcher_support.cmake index 19ca4ed14de..ed6aa479c70 100644 --- a/Installation/cmake/modules/CGAL_pointmatcher_support.cmake +++ b/Installation/cmake/modules/CGAL_pointmatcher_support.cmake @@ -9,7 +9,7 @@ if(libpointmatcher_FOUND AND NOT TARGET CGAL::pointmatcher_support) add_library(CGAL::pointmatcher_support INTERFACE IMPORTED) target_compile_definitions(CGAL::pointmatcher_support INTERFACE "CGAL_LINKED_WITH_POINTMATCHER") target_include_directories(CGAL::pointmatcher_support INTERFACE "${libpointmatcher_INCLUDE_DIR}") - target_link_libraries(CGAL::pointmatcher_support INTERFACE ${libpointmatcher_LIBRARIES}) + target_link_libraries(CGAL::pointmatcher_support INTERFACE ${libpointmatcher_LIBRARIES} libnabo::nabo) else() message(STATUS "NOTICE: the libpointmatcher library requires the following boost components: thread filesystem system program_options date_time chrono.") endif() diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 8b7aa08a92b..4e808b39eee 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -1,3 +1,5 @@ +# Copy of https://github.com/NVIDIA/thrust/blob/9f1cddc62b1bebbaeb8d07d4476c285be5aa0adc/thrust/cmake/FindTBB.cmake +# # - Find ThreadingBuildingBlocks include dirs and libraries # Use this module by invoking find_package with the form: # find_package(TBB @@ -11,6 +13,7 @@ # malloc proxy # TBB::tbb - imported target for the TBB library # +# TBB_VERSION - Product Version Number ("MAJOR.MINOR") # TBB_VERSION_MAJOR - Major Product Version Number # TBB_VERSION_MINOR - Minor Product Version Number # TBB_INTERFACE_VERSION - Engineering Focused Version Number @@ -107,48 +110,48 @@ endfunction() # Do the final processing for the package find. #=============================================== macro(findpkg_finish PREFIX TARGET_NAME) - # skip if already processed during this run - if (NOT ${PREFIX}_FOUND) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - else () - if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) - message(FATAL_ERROR "Required library ${PREFIX} not found.") - endif () - endif () - - if (NOT TARGET "TBB::${TARGET_NAME}") - if (${PREFIX}_LIBRARY_RELEASE) - tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) - endif () - if (${PREFIX}_LIBRARY_DEBUG) - tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) - endif () - add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") - if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}" - IMPORTED_LOCATION_DEBUG "${real_debug}" - IMPORTED_LOCATION_RELEASE "${real_release}") - elseif (${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}") - elseif (${PREFIX}_LIBRARY_DEBUG) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_debug}") - endif () - endif () - - #mark the following variables as internal variables - mark_as_advanced(${PREFIX}_INCLUDE_DIR - ${PREFIX}_LIBRARY - ${PREFIX}_LIBRARY_DEBUG - ${PREFIX}_LIBRARY_RELEASE) + if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + else () + if (${PREFIX}_FIND_REQUIRED) + message(FATAL_ERROR "Required library ${PREFIX} not found.") + elseif (NOT ${PREFIX}_FIND_QUIETLY) + message("Library ${PREFIX} not found.") + endif() + return() endif () + + if (NOT TARGET "TBB::${TARGET_NAME}") + if (${PREFIX}_LIBRARY_RELEASE) + tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) + endif () + if (${PREFIX}_LIBRARY_DEBUG) + tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) + endif () + add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") + if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}" + IMPORTED_LOCATION_DEBUG "${real_debug}" + IMPORTED_LOCATION_RELEASE "${real_release}") + elseif (${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}") + elseif (${PREFIX}_LIBRARY_DEBUG) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_debug}") + endif () + endif () + + #mark the following variables as internal variables + mark_as_advanced(${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE) endmacro() #=============================================== @@ -188,6 +191,10 @@ endmacro() #============================================================================= # Now to actually find TBB # + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(TBB_ROOT) + #start with looking for TBB_DIR and TBB_ROOT if((TBB_ROOT OR "$ENV{TBB_ROOT}" OR "$ENV{TBB_DIR}" ) AND NOT TBB_FOUND) find_package(TBB QUIET NO_MODULE NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) @@ -202,9 +209,6 @@ if(TBB_FOUND) return() endif()#TBB_FOUND -# Get path, convert backslashes as ${ENV_${var}} -getenv_path(TBB_ROOT) - if(NOT ENV_TBB_ROOT) getenv_path(TBBROOT) set(ENV_TBB_ROOT ${ENV_TBBROOT}) @@ -253,8 +257,26 @@ if (WIN32 AND MSVC) set(COMPILER_PREFIX "vc11") elseif(MSVC_VERSION EQUAL 1800) set(COMPILER_PREFIX "vc12") - elseif(MSVC_VERSION EQUAL 1900) + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939) + # 1900-1925 actually spans three Visual Studio versions: + # 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015 + # 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017 + # 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019 + # 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022 + # + # But these are binary compatible and TBB's open source distribution only + # ships a single vs14 lib (as of 2020.0) set(COMPILER_PREFIX "vc14") + else() + # The next poor soul who finds themselves having to decode visual studio + # version conventions may find these helpful: + # - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + # - https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering + message(AUTHOR_WARNING + "Unrecognized MSVC version (${MSVC_VERSION}). " + "Please update FindTBB.cmake. " + "Some TBB_* CMake variables may need to be set manually." + ) endif () # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path @@ -351,7 +373,6 @@ endforeach () set(TBB_LIBRARY_NAMES tbb) get_debug_names(TBB_LIBRARY_NAMES) - find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS ${TBB_INC_SEARCH_PATH}) @@ -411,12 +432,18 @@ findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) #============================================================================= -#parse all the version numbers from tbb +# Parse all the version numbers from tbb. if(NOT TBB_VERSION) + if(EXISTS "${TBB_INCLUDE_DIR}/tbb/version.h") + # The newer oneTBB provides tbb/version.h but no tbb/tbb_stddef.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/version.h") + else() + # Older TBB provides tbb/tbb_stddef.h but no tbb/version.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h") + endif() - #only read the start of the file - file(STRINGS - "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" + file(STRINGS + "${version_file}" TBB_VERSION_CONTENTS REGEX "VERSION") @@ -436,4 +463,5 @@ if(NOT TBB_VERSION) ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") + set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") endif() diff --git a/Installation/include/CGAL/Installation/internal/deprecation_warning.h b/Installation/include/CGAL/Installation/internal/deprecation_warning.h index 0206b562974..6601ff23520 100644 --- a/Installation/include/CGAL/Installation/internal/deprecation_warning.h +++ b/Installation/include/CGAL/Installation/internal/deprecation_warning.h @@ -71,7 +71,7 @@ #endif #if defined(CGAL_NO_DEPRECATED_CODE) // No deprecated code. -CGAL_static_assertion_msg(false, CGAL_INTERNAL_DEPRECATED_MESSAGE); +static_assert(false, CGAL_INTERNAL_DEPRECATED_MESSAGE); #elif !defined(CGAL_NO_DEPRECATION_WARNINGS) // don't trigger on NO_DEPRECATION_WARNINGS # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) # pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index af4a81c8607..c7062d61cae 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -36,11 +36,6 @@ # define WIN64 #endif -#ifdef _MSC_VER -#define _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING 1 -#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING 1 -#endif - #ifdef CGAL_INCLUDE_WINDOWS_DOT_H // Mimic users including this file which defines min max macros // and other names leading to name clashes @@ -147,8 +142,8 @@ #endif // Same for C++17 -#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L -# define CGAL_CXX17 1 +#if !(__cplusplus >= 201703L || _MSVC_LANG >= 201703L) +#error "CGAL requires C++ 17" #endif // Same for C++20 #if __cplusplus >= 202002L || _MSVC_LANG >= 202002L @@ -491,12 +486,6 @@ namespace cpp11{ # define CGAL_FALLTHROUGH while(false){} #endif -#if CGAL_CXX17 -# define CGAL_CPP17_INLINE inline -#else -# define CGAL_CPP17_INLINE -#endif - #ifndef CGAL_NO_ASSERTIONS # define CGAL_NO_ASSERTIONS_BOOL false #else diff --git a/Installation/include/CGAL/version.h b/Installation/include/CGAL/version.h index d90474f8913..584452d7d67 100644 --- a/Installation/include/CGAL/version.h +++ b/Installation/include/CGAL/version.h @@ -17,12 +17,12 @@ #define CGAL_VERSION_H #ifndef SWIG -#define CGAL_VERSION 5.6-beta1 +#define CGAL_VERSION 6.0-dev #define CGAL_GIT_HASH abcdef #endif -#define CGAL_VERSION_NR 1050600910 +#define CGAL_VERSION_NR 1060000900 #define CGAL_SVN_REVISION 99999 -#define CGAL_RELEASE_DATE 20230430 +#define CGAL_RELEASE_DATE 20231001 #include diff --git a/Installation/lib/cmake/CGAL/CGALConfigVersion.cmake b/Installation/lib/cmake/CGAL/CGALConfigVersion.cmake index e71784c4c52..2687e75956e 100644 --- a/Installation/lib/cmake/CGAL/CGALConfigVersion.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfigVersion.cmake @@ -1,8 +1,8 @@ -set(CGAL_MAJOR_VERSION 5) -set(CGAL_MINOR_VERSION 6) +set(CGAL_MAJOR_VERSION 6) +set(CGAL_MINOR_VERSION 0) set(CGAL_BUGFIX_VERSION 0) include(${CMAKE_CURRENT_LIST_DIR}/CGALConfigBuildVersion.cmake) -set(CGAL_VERSION_PUBLIC_RELEASE_VERSION "5.6-beta1") +set(CGAL_VERSION_PUBLIC_RELEASE_VERSION "6.0-dev") set(CGAL_VERSION_PUBLIC_RELEASE_NAME "CGAL-${CGAL_VERSION_PUBLIC_RELEASE_VERSION}") if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0) diff --git a/Installation/test/Installation/test_configuration.cmake.in b/Installation/test/Installation/test_configuration.cmake.in index cbf99f3e44f..3bb9e263061 100644 --- a/Installation/test/Installation/test_configuration.cmake.in +++ b/Installation/test/Installation/test_configuration.cmake.in @@ -1,5 +1,5 @@ -project(test_configuration) cmake_minimum_required(VERSION 3.1...3.23) +project(test_configuration) find_package(CGAL) add_definitions(-DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_configuration_qt5.cmake.in b/Installation/test/Installation/test_configuration_qt5.cmake.in index 665ad5f610d..548c6fba2bf 100644 --- a/Installation/test/Installation/test_configuration_qt5.cmake.in +++ b/Installation/test/Installation/test_configuration_qt5.cmake.in @@ -1,5 +1,5 @@ -project(test_configuration) cmake_minimum_required(VERSION 3.1...3.23) +project(test_configuration) find_package(CGAL COMPONENTS Qt5) add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS) diff --git a/Installation/test/Installation/test_configuration_qt5.cpp b/Installation/test/Installation/test_configuration_qt5.cpp index af10e898b98..73206ca0b4f 100644 --- a/Installation/test/Installation/test_configuration_qt5.cpp +++ b/Installation/test/Installation/test_configuration_qt5.cpp @@ -13,7 +13,7 @@ template typename CGAL::Coercion_traits::Type binary_func(const A& a , const B& b){ typedef CGAL::Coercion_traits CT; - CGAL_static_assertion((CT::Are_explicit_interoperable::value)); + static_assert(CT::Are_explicit_interoperable::value); typename CT::Cast cast; return cast(a)*cast(b); } diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 9cc25059be9..67dc7512581 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -181,8 +181,8 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { // inline // typename Intersection_traits< typename Kernel_traits::Kernel, A, B>::result_type >::type // intersection(const A& a, const B& b) { -// CGAL_static_assertion_msg( (std::is_same::value), -// "intersection with objects of different dimensions not supported"); +// static_assert(std::is_same::value), +// "intersection with objects of different dimensions not supported"; // return internal::intersection_impl(a, b, typename A::Ambient_dimension()); // } @@ -190,7 +190,7 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { // inline // auto // K::Boolean // do_intersect(const A& a, const B& b) { -// CGAL_static_assertion_msg((std::is_same::value), +// static_assert(std::is_same::value, // "do_intersect with objects of different dimensions not supported"); // return internal::do_intersect_impl(a, b, typename A::Ambient_dimension()); // } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index f7ebc70d25e..b62510e7892 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -66,7 +66,7 @@ class Do_intersect_bbox_segment_aux_is_greater double dmax; public: - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); Do_intersect_bbox_segment_aux_is_greater() : error(0.), tmax(0.), dmax(0.) {} diff --git a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h index 11342ed5963..ba0ac8f14e7 100644 --- a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h @@ -41,7 +41,7 @@ void test_bigfloat_interval_traits() { typedef typename BFIT::Is_bigfloat_interval Is_bigfloat_interval; CGAL_USE_TYPE(Is_bigfloat_interval); // using CGAL::Tag_true; - CGAL_static_assertion(( ::std::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value)); + static_assert(::std::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value); const typename BFIT::Construct construct = typename BFIT::Construct(); const typename BFIT::Set_precision set_precision = typename BFIT::Set_precision(); diff --git a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h index 34e731dae1a..8235c825644 100644 --- a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h +++ b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h @@ -41,7 +41,7 @@ template void test_convert_to_bfi_from(BFI,From){ typedef typename CGAL::Coercion_traits::Type CT_type; CGAL_USE_TYPE(CT_type); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); assert(CGAL::convert_to_bfi(From(0)) == BFI(0)); assert(CGAL::convert_to_bfi(From(1)) == BFI(1)); assert(CGAL::convert_to_bfi(From(2)) == BFI(2)); diff --git a/Interval_support/include/CGAL/Test/_test_interval_traits.h b/Interval_support/include/CGAL/Test/_test_interval_traits.h index d44384dff79..e90f8616ff2 100644 --- a/Interval_support/include/CGAL/Test/_test_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_interval_traits.h @@ -36,7 +36,7 @@ void test_with_empty_interval(CGAL::Tag_false) { typedef CGAL::Interval_traits IT; typedef typename IT::Empty Empty; CGAL_USE_TYPE(Empty); - CGAL_static_assertion( + static_assert( (::std::is_same< Empty, CGAL::Null_functor>::value)); // this part changes in case we allow empty intersection @@ -74,8 +74,8 @@ void test_interval_traits() { typedef typename IT::With_empty_interval With_empty_interval; CGAL_USE_TYPE(Is_interval); using CGAL::Tag_true; - CGAL_static_assertion(( ::std::is_same< Is_interval, Tag_true>::value)); - CGAL_static_assertion(( ::std::is_same< Interval_, Interval>::value)); + static_assert(::std::is_same< Is_interval, Tag_true>::value); + static_assert(::std::is_same< Interval_, Interval>::value); test_with_empty_interval(With_empty_interval()); diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index 921a30d2206..b6020ff7528 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -35,7 +35,7 @@ class Circle_2 : public R_::Kernel_base::Circle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Circle_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 3030977c225..b23e651e9fc 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -43,7 +43,7 @@ template typedef typename R_::Direction_3 Direction_3; typedef Circle_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index e3478708354..407d4e31ed1 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -38,7 +38,7 @@ class Direction_2 : public R_::Kernel_base::Direction_2 typedef typename R_::Kernel_base::Direction_2 RDirection_2; typedef Direction_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 6e0eb4930ab..18a88f7954d 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -37,7 +37,7 @@ class Direction_3 : public R_::Kernel_base::Direction_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Direction_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Has_conversion.h b/Kernel_23/include/CGAL/Has_conversion.h index 8e500c916d2..4e5d4603254 100644 --- a/Kernel_23/include/CGAL/Has_conversion.h +++ b/Kernel_23/include/CGAL/Has_conversion.h @@ -23,9 +23,9 @@ namespace internal { template struct Converter_selector { - CGAL_static_assertion_msg((std::is_same::value), - "Kernels must have the same representation"); + static_assert(std::is_same::value, + "Kernels must have the same representation"); typedef CGAL::Cartesian_converter type; }; @@ -33,9 +33,9 @@ struct Converter_selector template struct Converter_selector { - CGAL_static_assertion_msg((std::is_same::value), - "Kernels must have the same representation"); + static_assert(std::is_same::value, + "Kernels must have the same representation"); typedef CGAL::Homogeneous_converter type; }; diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 057c6519ecd..d279426727f 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -35,7 +35,7 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Iso_cuboid_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 1d27f73f4e2..7d3dc5a4709 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -33,7 +33,7 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Iso_rectangle_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Line_2.h b/Kernel_23/include/CGAL/Line_2.h index 3f757981eb2..33406d119a5 100644 --- a/Kernel_23/include/CGAL/Line_2.h +++ b/Kernel_23/include/CGAL/Line_2.h @@ -41,7 +41,7 @@ class Line_2 : public R_::Kernel_base::Line_2 typedef typename R_::Kernel_base::Line_2 RLine_2; typedef Line_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Line_3.h b/Kernel_23/include/CGAL/Line_3.h index 53f902c2104..ebfb32c7972 100644 --- a/Kernel_23/include/CGAL/Line_3.h +++ b/Kernel_23/include/CGAL/Line_3.h @@ -38,7 +38,7 @@ class Line_3 : public R_::Kernel_base::Line_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Line_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index 104191a5d64..b391b4388d2 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -41,7 +41,7 @@ class Plane_3 : public R_::Kernel_base::Plane_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Plane_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index 87728264781..96bffa243e2 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -37,7 +37,7 @@ class Point_2 : public R_::Kernel_base::Point_2 typedef typename R_::Kernel_base::Point_2 RPoint_2; typedef Point_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 03d00f78f3f..f2444a9506c 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -34,7 +34,7 @@ class Point_3 : public R_::Kernel_base::Point_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Point_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index d9dae50482e..626730bbc86 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -42,7 +42,7 @@ class Ray_2 : public R_::Kernel_base::Ray_2 typedef typename R_::Kernel_base::Ray_2 RRay_2; typedef Ray_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index b35ae5e78a9..b415af7ad01 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -36,7 +36,7 @@ class Ray_3 : public R_::Kernel_base::Ray_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Ray_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index 6209c3a8139..d5d89246f3b 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -40,7 +40,7 @@ class Segment_2 : public R_::Kernel_base::Segment_2 typedef typename R_::Kernel_base::Segment_2 RSegment_2; typedef Segment_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index 7023f5fe3fe..61e02d657db 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -38,7 +38,7 @@ class Segment_3 : public R_::Kernel_base::Segment_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Segment_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index 310303fed64..b0a7c271e24 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -37,7 +37,7 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Sphere_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index a8768746f58..549680d2554 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -33,7 +33,7 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Tetrahedron_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index cf35524a6a4..8deabe91f6e 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -35,7 +35,7 @@ class Triangle_2 : public R_::Kernel_base::Triangle_2 typedef typename R_::Kernel_base::Triangle_2 RTriangle_2; typedef Triangle_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 92adba1fb86..19bbd8064ec 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -36,7 +36,7 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Triangle_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index 6e62f77fa5d..4449fc3ef9f 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -42,7 +42,7 @@ class Vector_2 : public R_::Kernel_base::Vector_2 typedef typename R_::Kernel_base::Vector_2 RVector_2; typedef Vector_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index f81aee480f4..9220f3e8527 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -42,7 +42,7 @@ class Vector_3 : public R_::Kernel_base::Vector_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Vector_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index ea4364644a8..32ca07df153 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -34,7 +34,7 @@ class Weighted_point_2 : public R_::Kernel_base::Weighted_point_2 typedef typename R_::FT RT; typedef Weighted_point_2 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: typedef Dimension_tag<2> Ambient_dimension; diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index c57467fb17a..28e8f9489a5 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -34,7 +34,7 @@ class Weighted_point_3 : public R_::Kernel_base::Weighted_point_3 typedef typename R_::FT FT; typedef Weighted_point_3 Self; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); public: diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h index 6ea80be2a41..c6d25336aa2 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h @@ -60,9 +60,9 @@ _test_cls_point_2(const R& ) CGAL::Weighted_point_2 wp(p1); CGAL::Point_2 p7(wp); - CGAL_static_assertion(!(boost::is_convertible, + static_assert(!(boost::is_convertible, CGAL::Point_2 >::value)); - CGAL_static_assertion(!(boost::is_convertible, + static_assert(!(boost::is_convertible, CGAL::Weighted_point_2 >::value)); std::cout << '.'; diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h index b09c11e47a7..f96de09c0d9 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h @@ -58,9 +58,9 @@ _test_cls_point_3(const R& ) CGAL::Weighted_point_3 wp(p1); CGAL::Point_3 p7(wp); - CGAL_static_assertion(!(boost::is_convertible, + static_assert(!(boost::is_convertible, CGAL::Point_3 >::value)); - CGAL_static_assertion(!(boost::is_convertible, + static_assert(!(boost::is_convertible, CGAL::Weighted_point_3 >::value)); std::cout << '.'; diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index 03b2787cc0b..b0771f329ca 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -229,12 +229,12 @@ void generate_atomic_compilation_test(const std::string& FT_name, if(check != NO_CHECK) { - out << " static_assert((std::is_same::value));\n"; diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h index e43fb279038..525c35eaec7 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages.h @@ -74,7 +74,7 @@ namespace CGAL { typedef typename Dart_container::size_type size_type; typedef std::nullptr_t Null_descriptor_type; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_descriptor=nullptr; + inline static constexpr Null_descriptor_type null_descriptor=nullptr; using Type_for_compact_container=void*; @@ -128,7 +128,7 @@ namespace CGAL { using Vertex_attribute_handle=Vertex_attribute_descriptor; using Vertex_attribute_const_handle=Vertex_attribute_const_descriptor; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_handle=null_descriptor; + inline static constexpr Null_descriptor_type null_handle=null_descriptor; /// Number of marks static const size_type NB_MARKS = 32; @@ -253,7 +253,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -262,7 +262,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -273,7 +273,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); typename Attribute_descriptor::type res= std::get::value> @@ -502,17 +502,6 @@ namespace CGAL { typename Helper::Attribute_containers mattribute_containers; }; -#ifndef CGAL_CXX17 - template - constexpr typename CMap_linear_cell_complex_storage_1::Null_descriptor_type - CMap_linear_cell_complex_storage_1::null_descriptor; - - template - constexpr typename CMap_linear_cell_complex_storage_1::Null_descriptor_type - CMap_linear_cell_complex_storage_1::null_handle; -#endif } // namespace CGAL #if defined(BOOST_GCC) diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h index 8417e20b226..56010ad433a 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h @@ -287,7 +287,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -296,7 +296,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -307,7 +307,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); // We need to do a reserve before the emplace in order to avoid a bug of // invalid reference when the container is reallocated. diff --git a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h index 3b90e193fa2..2d4b0f67537 100644 --- a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages.h @@ -74,7 +74,7 @@ namespace CGAL { typedef typename Dart_container::size_type size_type; typedef std::nullptr_t Null_descriptor_type; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_descriptor=nullptr; + inline static constexpr Null_descriptor_type null_descriptor=nullptr; using Type_for_compact_container=void*; @@ -128,7 +128,7 @@ namespace CGAL { using Vertex_attribute_handle=Vertex_attribute_descriptor; using Vertex_attribute_const_handle=Vertex_attribute_const_descriptor; - CGAL_CPP17_INLINE static constexpr Null_descriptor_type null_handle=null_descriptor; + inline static constexpr Null_descriptor_type null_handle=null_descriptor; /// Number of marks static const size_type NB_MARKS = 32; @@ -250,7 +250,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -259,7 +259,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (ADart->mattribute_descriptors); @@ -270,7 +270,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); typename Attribute_descriptor::type res= std::get::value> @@ -493,18 +493,6 @@ namespace CGAL { typename Helper::Attribute_containers mattribute_containers; }; -#ifndef CGAL_CXX17 - template - constexpr typename GMap_linear_cell_complex_storage_1::Null_descriptor_type - GMap_linear_cell_complex_storage_1::null_descriptor; - - template - constexpr typename GMap_linear_cell_complex_storage_1::Null_descriptor_type - GMap_linear_cell_complex_storage_1::null_handle; -#endif - } // namespace CGAL #if defined(BOOST_GCC) diff --git a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages_with_index.h b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages_with_index.h index 27d58a7651a..5d260bee1ec 100644 --- a/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages_with_index.h +++ b/Linear_cell_complex/include/CGAL/GMap_linear_cell_complex_storages_with_index.h @@ -239,7 +239,7 @@ namespace CGAL { template typename Attribute_descriptor::type attribute(Dart_descriptor ADart) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -248,7 +248,7 @@ namespace CGAL { typename Attribute_const_descriptor::type attribute(Dart_const_descriptor ADart) const { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mdarts[ADart].mattribute_descriptors); @@ -259,7 +259,7 @@ namespace CGAL { typename Attribute_descriptor::type copy_attribute (typename Attribute_const_descriptor::type ah) { - CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + static_assert(Helper::template Dimension_index::value>=0, "copy_attribute called but i-attributes are disabled."); // We need to do a reserve before the emplace in order to avoid a bug of // invalid reference when the container is reallocated. diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h index 4569404479d..4669765f493 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h @@ -775,7 +775,7 @@ namespace CGAL { Dart_descriptor insert_point_in_cell(Dart_descriptor dh, const Point& p, bool update_attributes=true) { - CGAL_static_assertion(1<=i && i<=2); + static_assert(1<=i && i<=2); if (i==1) return insert_point_in_cell_1(dh, p, update_attributes); return insert_point_in_cell_2(dh, p, update_attributes); } diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h index 1bdac283a67..e770c67e86c 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h @@ -48,7 +48,7 @@ namespace CGAL { typedef typename std::list::iterator List_iterator; typedef typename LCC::Point Point; - CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 ); + static_assert( LCC::dimension>=2 && LCC::ambient_dimension==2 ); CGAL_assertion(edge_indices.size() % 2 == 0); std::vector< typename LCC::Vertex_attribute_descriptor > initVertices; diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_operations.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_operations.h index 4728c9bf2f3..a895b915b78 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_operations.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_operations.h @@ -120,7 +120,7 @@ namespace CGAL { static typename LCC::Point run(const LCC& amap, typename LCC::Dart_const_descriptor adart) { - CGAL_static_assertion(0| done diff --git a/Matrix_search/include/CGAL/Cartesian_matrix.h b/Matrix_search/include/CGAL/Cartesian_matrix.h index 1aa192ab2c8..be3dba778b4 100644 --- a/Matrix_search/include/CGAL/Cartesian_matrix.h +++ b/Matrix_search/include/CGAL/Cartesian_matrix.h @@ -28,11 +28,7 @@ template < class Operation, class Cartesian_matrix { public: -#if CGAL_CXX17 && __has_cpp_attribute(nodiscard) typedef typename std::invoke_result::value_type, typename std::iterator_traits::value_type>::type Value; -#else - typedef typename Operation::result_type Value; -#endif Cartesian_matrix(RandomAccessIC_row r_f, RandomAccessIC_row r_l, diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index 4b4a6743270..a802ac4df08 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -422,7 +422,7 @@ Specifically, it is either a constant or a spatially variable scalar field. It provides an upper bound for the distance between the circumcenter of a surface facet and the center of a surface Delaunay ball of this facet. -
  • `facet_topology`. This parameters controls the set of topological constraints +
  • `facet_topology`. This parameter controls the set of topological constraints which have to be verified by each surface facet. By default, each vertex of a surface facet has to be located on a surface patch, on a curve, or on a corner. It can also be set to check whether the three vertices of a surface facet belongs to the same diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index c66d416841c..d30acbcb141 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -485,8 +485,8 @@ public: template const Point_3& weighted_circumcenter(const GT_& gt) const { - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); if (internal_tbb::is_null(weighted_circumcenter_)) { this->try_to_set_circumcenter( new Point_3(gt.construct_weighted_circumcenter_3_object() diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 395697353af..86458a472ef 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -1572,17 +1572,10 @@ private: Cell_vector c3t3_cells(const Cell_vector& cells) const { Cell_vector c3t3_cells; -#ifdef CGAL_CXX17 std::remove_copy_if(cells.begin(), cells.end(), std::back_inserter(c3t3_cells), std::not_fn(Is_in_c3t3(c3t3_))); -#else - std::remove_copy_if(cells.begin(), - cells.end(), - std::back_inserter(c3t3_cells), - std::not1(Is_in_c3t3(c3t3_)) ); -#endif return c3t3_cells; } @@ -3663,17 +3656,10 @@ incident_slivers(const Vertex_handle& v, std::vector incident_cells_; tr_.incident_cells(v, std::back_inserter(incident_cells_)); -#ifdef CGAL_CXX17 std::remove_copy_if(incident_cells_.begin(), incident_cells_.end(), out, std::not_fn(Is_sliver(c3t3_, criterion, sliver_bound))); -#else - std::remove_copy_if(incident_cells_.begin(), - incident_cells_.end(), - out, - std::not1(Is_sliver(c3t3_,criterion,sliver_bound))); -#endif return out; } diff --git a/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h b/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h index 1c0adbcd617..8f2f6a17e7c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h +++ b/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h @@ -116,9 +116,9 @@ public: { return static_cast(transform( r_im_.template labellized_trilinear_interpolation( - CGAL::to_double(p.x()), - CGAL::to_double(p.y()), - CGAL::to_double(p.z()), + CGAL::to_double(p.x() - r_im_.image()->tx), + CGAL::to_double(p.y() - r_im_.image()->ty), + CGAL::to_double(p.z() - r_im_.image()->tz), value_outside, indicator_factory))); } diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 5358e813742..0fa4cf43902 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -101,19 +101,19 @@ public: template void add_facet_criterion(Facet_criterion* criterion) { - CGAL_static_assertion((boost::is_base_of< + static_assert(boost::is_base_of< typename Facet_criteria::Abstract_criterion, Facet_criterion - >::value)); + >::value); facet_criteria_.add(criterion); } template void add_cell_criterion(Cell_criterion* criterion) { - CGAL_static_assertion((boost::is_base_of< + static_assert(boost::is_base_of< typename Cell_criteria::Abstract_criterion, Cell_criterion - >::value)); + >::value); cell_criteria_.add(criterion); } diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp index 091611ddfb8..379e1e5453d 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp @@ -69,7 +69,7 @@ public: this->verify(c3t3,domain,criteria, Bissection_tag()); typedef typename Mesh_domain::Surface_patch_index Patch_id; - CGAL_static_assertion(CGAL::Output_rep::is_specialized); + static_assert(CGAL::Output_rep::is_specialized); CGAL_USE_TYPE(Patch_id); } diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_image_with_features.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_image_with_features.cpp index 1c9607d45cc..15682e0429b 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_image_with_features.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_image_with_features.cpp @@ -85,7 +85,7 @@ struct Image_tester : public Tester this->verify(c3t3, domain, criteria, Bissection_tag()); typedef typename Mesh_domain::Surface_patch_index Patch_id; - CGAL_static_assertion(CGAL::Output_rep::is_specialized); + static_assert(CGAL::Output_rep::is_specialized); CGAL_USE_TYPE(Patch_id); } diff --git a/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp b/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp index c44966f9cce..1af7e47b9d4 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_polyhedron.cpp @@ -35,10 +35,10 @@ struct Polyhedron_tester : public Tester typedef CGAL::Polyhedron_3 Polyhedron; typedef CGAL::Polyhedral_mesh_domain_3 Mesh_domain; - CGAL_static_assertion((std::is_same< + static_assert(std::is_same< typename Mesh_domain::Surface_patch_index, std::pair - >::value)); + >::value); typedef typename CGAL::Mesh_triangulation_3< Mesh_domain, diff --git a/Nef_2/include/CGAL/Nef_2/PM_overlayer.h b/Nef_2/include/CGAL/Nef_2/PM_overlayer.h index a28160ed477..a1aced0e3ff 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_overlayer.h +++ b/Nef_2/include/CGAL/Nef_2/PM_overlayer.h @@ -959,7 +959,7 @@ bool is_forward_edge(const Const_decorator& N, void assert_type_precondition() const { typename PM_decorator_::Point p1; Point p2; - CGAL_static_assertion((std::is_same::value)); } + static_assert(std::is_same::value); } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index 50ac9fbedf8..31f86c5c43a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -135,8 +135,8 @@ template struct Kernel_d_interface : public Base_ { typedef typename Base::Point_cartesian_const_iterator result_type; // Kernel_d requires a common iterator type for points and vectors // TODO: provide this mixed functor in preKernel? - // CGAL_static_assertion((std::is_same::type>::type, result_type>::value)); - // CGAL_static_assertion((std::is_same::type, result_type>::value)); + // static_assert(std::is_same::type>::type, result_type>::value); + // static_assert(std::is_same::type, result_type>::value); template auto operator()(Point_d const&p, Tag_ t)const{ return CPI(this->kernel())(p,t); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h index 26741caf72a..6e6b496840e 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h index 88a4ed421a9..be1b2b3a6f0 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Vector/array.h @@ -41,7 +41,7 @@ template struct Array_vector { template struct Property : boost::false_type {}; static const unsigned d_=Max_dim_::value; - CGAL_static_assertion(d_ != (unsigned)UNKNOWN_DIMENSION); + static_assert(d_ != (unsigned)UNKNOWN_DIMENSION); typedef std::array Vector; struct Construct_vector { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h index 2eae60f5576..4efc63d87a6 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Hyperplane_d.h @@ -32,7 +32,7 @@ class Hyperplane_d : public Get_type:: typedef typename Get_functor::type HTBase; typedef Hyperplane_d Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 42d94a93c73..af2d970f3f2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -40,7 +40,7 @@ class Point_d : public Get_type::type typedef Point_d Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h index fefbca812b7..097a41f9755 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Ref_count_obj.h @@ -33,7 +33,7 @@ class Ref_count_obj typedef typename Get_functor >::type CBase; typedef Ref_count_obj Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: typedef R_ R; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h index 28bd4e8a8a3..c450300b587 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Segment_d.h @@ -35,7 +35,7 @@ class Segment_d : public Get_type::type typedef typename Get_functor::type CSEBase; typedef Segment_d Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h index 7bcd8568dcc..611217e9acd 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Sphere_d.h @@ -32,7 +32,7 @@ class Sphere_d : public Get_type::type typedef typename Get_functor::type SRBase; typedef Sphere_d Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h index 6d47e86d2f3..1b150be0aae 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h @@ -39,7 +39,7 @@ class Vector_d : public Get_type::type typedef typename Get_functor::type SLBase; typedef Vector_d Self; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); public: diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index bbc3b6a128c..18ac1657ee6 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -740,11 +740,11 @@ template struct CGAL::Epick_d; typedef CGAL::Epick_d > Ker2; typedef CGAL::Epick_d > Ker3; typedef CGAL::Epick_d Kerd; -CGAL_static_assertion((std::is_same,Ker2::Dimension>::value)); -CGAL_static_assertion((std::is_same,Ker3::Dimension>::value)); -CGAL_static_assertion((std::is_same::value)); -CGAL_static_assertion((std::is_same,CGAL::Ambient_dimension::type>::value)); -CGAL_static_assertion((std::is_same,CGAL::Ambient_dimension::type>::value)); +static_assert(std::is_same,Ker2::Dimension>::value); +static_assert(std::is_same,Ker3::Dimension>::value); +static_assert(std::is_same::value); +static_assert(std::is_same,CGAL::Ambient_dimension::type>::value); +static_assert(std::is_same,CGAL::Ambient_dimension::type>::value); int main(){ //Broken with Linear_base_d (output iterator) //test2 >(); diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 38c55c62d32..d3b31c57689 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -34,6 +34,8 @@ #include #include #include +#include + #include @@ -944,9 +946,9 @@ struct Div_mod_selector { void operator()( const NT1& x, const NT2& y, NT& q, NT& r ) const { - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< typename Coercion_traits< NT1, NT2 >::Type, NT - >::value)); + >::value); typename Coercion_traits< NT1, NT2 >::Cast cast; operator()( cast(x), cast(y), q, r ); @@ -1029,8 +1031,8 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt > : public INTERN_RET::Real_embeddable_traits_base< Lazy_exact_nt , CGAL::Tag_true > { // Every type ET of Lazy_exact_nt has to be real embeddable. - CGAL_static_assertion((::std::is_same< typename Real_embeddable_traits< ET > - ::Is_real_embeddable, Tag_true >::value)); + static_assert(::std::is_same< typename Real_embeddable_traits< ET > + ::Is_real_embeddable, Tag_true >::value); public: typedef Lazy_exact_nt Type; @@ -1427,7 +1429,24 @@ class Modular_traits > #undef CGAL_int #undef CGAL_To_interval -} //namespace CGAL +namespace internal { + +template < typename ET > +struct Exact_field_selector > +: Exact_field_selector +{ + // We have a choice here : + // - using ET gets rid of the DAG computation as well as redoing the interval + // - using Lazy_exact_nt might use sharper intervals. + // typedef ET Type; + // typedef Lazy_exact_nt Type; +}; +template < typename ET > +struct Exact_ring_selector > +: Exact_ring_selector +{}; + +} } //namespace CGAL::internal namespace Eigen { template struct NumTraits; diff --git a/Number_types/include/CGAL/Mpzf.h b/Number_types/include/CGAL/Mpzf.h index c2689f3ee45..daa0d9222b5 100644 --- a/Number_types/include/CGAL/Mpzf.h +++ b/Number_types/include/CGAL/Mpzf.h @@ -148,7 +148,7 @@ template struct pool2 { static bool empty() { return data() == 0; } static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t private: - CGAL_static_assertion(sizeof(T) >= sizeof(T*)); + static_assert(sizeof(T) >= sizeof(T*)); static T& data () { static CGAL_MPZF_TLS T data_ = 0; return data_; @@ -162,7 +162,7 @@ template struct pool3 { static bool empty() { return data() == 0; } static const int extra = 1; // TODO: handle the case where a pointer is larger than a mp_limb_t private: - CGAL_static_assertion(sizeof(T) >= sizeof(T*)); + static_assert(sizeof(T) >= sizeof(T*)); struct cleaner { T data_ = 0; ~cleaner(){ @@ -455,7 +455,7 @@ struct Mpzf { } int e1 = (int)dexp+13; // FIXME: make it more general! But not slower... - CGAL_static_assertion(GMP_NUMB_BITS == 64); + static_assert(GMP_NUMB_BITS == 64); int e2 = e1 % 64; exp = e1 / 64 - 17; // 52+1023+13==17*64 ? diff --git a/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h b/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h index f69df29f2bf..f0d8e961c32 100644 --- a/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h +++ b/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -280,21 +279,6 @@ struct Exact_ring_selector::Rational> { typedef Exact_NT_backend::Rational Type; }; #endif -template < typename ET > -struct Exact_field_selector > -: Exact_field_selector -{ - // We have a choice here : - // - using ET gets rid of the DAG computation as well as redoing the interval - // - using Lazy_exact_nt might use sharper intervals. - // typedef ET Type; - // typedef Lazy_exact_nt Type; -}; -template < typename ET > -struct Exact_ring_selector > -: Exact_ring_selector -{}; - #ifndef CGAL_NO_DEPRECATED_CODE // Added for backward compatibility template < typename ET > diff --git a/Number_types/include/CGAL/Root_of_traits.h b/Number_types/include/CGAL/Root_of_traits.h index a1a941277bc..32d81e481a9 100644 --- a/Number_types/include/CGAL/Root_of_traits.h +++ b/Number_types/include/CGAL/Root_of_traits.h @@ -150,7 +150,7 @@ private: // We have the typedef as VC10 fails with // static_assert(FrT::Is_fraction::value) typedef typename FrT::Is_fraction ISF; - CGAL_static_assertion((ISF::value)); + static_assert(ISF::value); typedef typename FrT::Numerator_type RT; diff --git a/Number_types/include/CGAL/Test/test_root_of_traits.h b/Number_types/include/CGAL/Test/test_root_of_traits.h index ae1c7768852..58c1340335f 100644 --- a/Number_types/include/CGAL/Test/test_root_of_traits.h +++ b/Number_types/include/CGAL/Test/test_root_of_traits.h @@ -28,8 +28,8 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename RoT::Make_sqrt Make_sqrt; @@ -41,10 +41,10 @@ void test_root_of_traits(){ const Inverse& inverse = Inverse(); const Square& square = Square(); - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); { diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index a651b674202..7348097644e 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -35,7 +35,7 @@ // while ::__gmp_expr is the others "expressions". #define CGAL_CHECK_GMP_EXPR_MPQ_CLASS \ - CGAL_static_assertion( \ + static_assert( \ (::std::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/mpz_class.h b/Number_types/include/CGAL/mpz_class.h index 9b868199f9f..c8899fc1b97 100644 --- a/Number_types/include/CGAL/mpz_class.h +++ b/Number_types/include/CGAL/mpz_class.h @@ -38,7 +38,7 @@ #include #define CGAL_CHECK_GMP_EXPR \ - CGAL_static_assertion( \ + static_assert( \ (::std::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/simplest_rational_in_interval.h b/Number_types/include/CGAL/simplest_rational_in_interval.h index 374d89e1fd2..fbb5206ffbe 100644 --- a/Number_types/include/CGAL/simplest_rational_in_interval.h +++ b/Number_types/include/CGAL/simplest_rational_in_interval.h @@ -43,10 +43,10 @@ simplest_rational_in_interval(double x, double y) { // Must be a fraction CGAL_USE_TYPE(Is_fraction); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); // Numerator_type,Denominator_type must be the same CGAL_USE_TYPE(Denominator_type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); if(x == y){ diff --git a/Number_types/include/CGAL/to_rational.h b/Number_types/include/CGAL/to_rational.h index add67aeb6cc..3ce75dd8032 100644 --- a/Number_types/include/CGAL/to_rational.h +++ b/Number_types/include/CGAL/to_rational.h @@ -34,9 +34,9 @@ to_rational(double x) typedef typename FT::Denominator_type Denominator_type; typename FT::Compose compose; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); CGAL_USE_TYPE(Is_fraction); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); CGAL_USE_TYPE(Denominator_type); Numerator_type num(0),den(1); diff --git a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp index 54a1ea8581e..fffb0108143 100644 --- a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp +++ b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp @@ -81,9 +81,9 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt< typename AK::Integer > LI; typedef CGAL::Lazy_exact_nt< typename AK::Rational > LR; typedef CGAL::Coercion_traits CT; - CGAL_static_assertion((std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - CGAL_static_assertion((std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - CGAL_static_assertion((std::is_same< typename CT::Type,LR>::value)); + static_assert(std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value); + static_assert(std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value); + static_assert(std::is_same< typename CT::Type,LR>::value); LI i(4); LR r(4); @@ -99,8 +99,8 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt T1; typedef CGAL::Lazy_exact_nt T2; typedef CGAL::Coercion_traits CT; - CGAL_static_assertion((std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); - CGAL_static_assertion((std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); + static_assert(std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value); + static_assert(std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value); #endif #endif } diff --git a/Number_types/test/Number_types/Quotient_new.cpp b/Number_types/test/Number_types/Quotient_new.cpp index 65450205e87..dfa2c37da05 100644 --- a/Number_types/test/Number_types/Quotient_new.cpp +++ b/Number_types/test/Number_types/Quotient_new.cpp @@ -62,9 +62,9 @@ void test_quotient() { typedef CGAL::Quotient QI; typedef CGAL::Coercion_traits CT; CGAL_USE_TYPE(CT); - CGAL_static_assertion((std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - CGAL_static_assertion((std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - CGAL_static_assertion((std::is_same< typename CT::Type,QI>::value)); + static_assert(std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value); + static_assert(std::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value); + static_assert(std::is_same< typename CT::Type,QI>::value); } } diff --git a/Number_types/test/Number_types/Sqrt_extension.h b/Number_types/test/Number_types/Sqrt_extension.h index b2c8f42d47d..825ba19d252 100644 --- a/Number_types/test/Number_types/Sqrt_extension.h +++ b/Number_types/test/Number_types/Sqrt_extension.h @@ -24,7 +24,7 @@ void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Type Type; CGAL_USE_TYPE(Type); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); r = typename CT::Cast()(x); } } //namespace CGAL @@ -700,17 +700,17 @@ void test_get_arithmetic_kernel(){ typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; CGAL_USE_TYPE(AT_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; CGAL_USE_TYPE(AT_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; CGAL_USE_TYPE(AT_); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } } diff --git a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h index bb979e588f3..2ffb9133345 100644 --- a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h +++ b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h @@ -7,12 +7,12 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - CGAL_static_assertion((::std::is_same::value)); - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); + static_assert(::std::is_same::value); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename Make_root_of_2::result_type result_type; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); const Make_root_of_2& make_root_of_2 = Make_root_of_2(); Root_of_2 r = make_root_of_2(T(0),T(-1),T(2)); //-sqrt(2) diff --git a/Number_types/test/Number_types/ioformat.cpp b/Number_types/test/Number_types/ioformat.cpp index 4d9a6656321..54eaa26bf22 100644 --- a/Number_types/test/Number_types/ioformat.cpp +++ b/Number_types/test/Number_types/ioformat.cpp @@ -106,7 +106,7 @@ int main() // CORE #ifdef CGAL_USE_CORE - CGAL_static_assertion(CGAL::Output_rep::is_specialized == true); + static_assert(CGAL::Output_rep::is_specialized == true); //bug in io for CORE. test_it("CORE::BigInt"); test_it("CORE::BigRat"); @@ -116,7 +116,7 @@ int main() // LEDA based NTs #ifdef CGAL_USE_LEDA - CGAL_static_assertion(CGAL::Output_rep::is_specialized == true); + static_assert(CGAL::Output_rep::is_specialized == true); test_it("leda_integer"); test_it("leda_rational"); test_it("leda_bigfloat"); diff --git a/Number_types/test/Number_types/known_bit_size_integers.cpp b/Number_types/test/Number_types/known_bit_size_integers.cpp index 0172db54dac..fce35d25f64 100644 --- a/Number_types/test/Number_types/known_bit_size_integers.cpp +++ b/Number_types/test/Number_types/known_bit_size_integers.cpp @@ -7,18 +7,18 @@ int main() std::cout << "Verifying the sizes of boost::[u]int{8,16,32,64}_t" << std::endl; - CGAL_static_assertion(sizeof(boost::int8_t) == 1); - CGAL_static_assertion(sizeof(boost::int16_t) == 2); - CGAL_static_assertion(sizeof(boost::int32_t) == 4); + static_assert(sizeof(boost::int8_t) == 1); + static_assert(sizeof(boost::int16_t) == 2); + static_assert(sizeof(boost::int32_t) == 4); #ifndef BOOST_NO_INT64_T - CGAL_static_assertion(sizeof(boost::int64_t) == 8); + static_assert(sizeof(boost::int64_t) == 8); #endif - CGAL_static_assertion(sizeof(boost::uint8_t) == 1); - CGAL_static_assertion(sizeof(boost::uint16_t) == 2); - CGAL_static_assertion(sizeof(boost::uint32_t) == 4); + static_assert(sizeof(boost::uint8_t) == 1); + static_assert(sizeof(boost::uint16_t) == 2); + static_assert(sizeof(boost::uint32_t) == 4); #ifndef BOOST_NO_INT64_T - CGAL_static_assertion(sizeof(boost::uint64_t) == 8); + static_assert(sizeof(boost::uint64_t) == 8); #endif return 0; diff --git a/Number_types/test/Number_types/test_nt_Coercion_traits.cpp b/Number_types/test/Number_types/test_nt_Coercion_traits.cpp index ad73c7555c6..bb7d28b3eab 100644 --- a/Number_types/test/Number_types/test_nt_Coercion_traits.cpp +++ b/Number_types/test/Number_types/test_nt_Coercion_traits.cpp @@ -144,9 +144,9 @@ void AT_coercion_test_for_cgal_types_rat(){ typedef typename AT::Bigfloat_interval Bigfloat_interval; CGAL_USE_TYPE(Bigfloat_interval); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); CGAL::test_explicit_interoperable_from_to(); CGAL::test_explicit_interoperable_from_to(); @@ -205,10 +205,10 @@ void AT_coercion_test_for_cgal_types_fws(){ typedef typename AT::Field_with_sqrt Real; CGAL_USE_TYPE(Bigfloat_interval); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); - CGAL_static_assertion(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); + static_assert(!(::std::is_same::value)); typedef CGAL::Sqrt_extension Extn_1; diff --git a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h index 4ff08af8d1d..ae450d781e8 100644 --- a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h +++ b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h @@ -119,7 +119,7 @@ void optimize_along_OBB_axes(typename Traits::Matrix& rot, typedef typename Traits::Matrix Matrix; typedef typename Traits::Vector Vector; - CGAL_static_assertion((std::is_same::type, Point>::value)); + static_assert(std::is_same::type, Point>::value); std::vector rotated_points; rotated_points.reserve(points.size()); diff --git a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h index 037df452478..d64b73e699b 100644 --- a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h +++ b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h @@ -202,7 +202,7 @@ void construct_oriented_bounding_box(const PointRange& points, { typedef typename Traits::Point_3 Point; - CGAL_static_assertion((std::is_same::type, Point>::value)); + static_assert(std::is_same::type, Point>::value); if(use_ch) // construct the convex hull to reduce the number of points { @@ -341,7 +341,7 @@ void oriented_bounding_box(const PointRange& points, NamedParameters, Default_traits>::type Geom_traits; - CGAL_static_assertion_msg(!(std::is_same::value), + static_assert(!(std::is_same::value), "You must provide a traits class or have Eigen enabled!"); Geom_traits traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); @@ -361,7 +361,7 @@ void oriented_bounding_box(const PointRange& points, // @todo handle those cases (or call min_rectangle_2 with a projection) if(points.size() <= 3) { - std::cerr << "The oriented bounding box cannot (yet) be computed for a mesh with fewer than 4 vertices!\n"; + std::cerr << "The oriented bounding box cannot be computed with fewer than 4 vertices!\n"; return; } diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt index 42596b249c3..af9f3482326 100644 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt +++ b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt @@ -375,7 +375,7 @@ Specifically, it is either a constant or a spatially variable scalar field. It provides an upper bound for the distance between the circumcenter of a surface facet and the center of a surface Delaunay ball of this facet. -
  • `facet_topology`. This parameters controls the set of topological constraints +
  • `facet_topology`. This parameter controls the set of topological constraints which have to be verified by each surface facet. By default, each vertex of a surface facet has to be located on a surface patch, on a curve, or on a corner. It can also be set to check whether the three vertices of a surface facet belongs to the same diff --git a/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h b/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h index dcda82d9555..229ceab85ff 100644 --- a/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h +++ b/Point_set_processing_3/include/CGAL/OpenGR/compute_registration_transformation.h @@ -309,14 +309,14 @@ compute_registration_transformation (const PointRange1& point_set_1, const Point typedef Point_set_processing_3_np_helper NP_helper2; typedef typename NP_helper1::Const_point_map PointMap1; typedef typename NP_helper2::Const_point_map PointMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The point type of input ranges must be the same"); typedef typename NP_helper1::Normal_map NormalMap1; typedef typename NP_helper2::Normal_map NormalMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The vector type of input ranges must be the same"); typedef typename NP_helper1::Geom_traits Kernel; diff --git a/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h b/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h index 5e5d7853bee..5f45ba40acb 100644 --- a/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h +++ b/Point_set_processing_3/include/CGAL/OpenGR/register_point_sets.h @@ -222,14 +222,14 @@ register_point_sets (const PointRange1& point_set_1, PointRange2& point_set_2, typedef Point_set_processing_3_np_helper NP_helper2; typedef typename NP_helper1::Const_point_map PointMap1; typedef typename NP_helper2::Const_point_map PointMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The point type of input ranges must be the same"); typedef typename NP_helper1::Normal_map NormalMap1; typedef typename NP_helper2::Normal_map NormalMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The vector type of input ranges must be the same"); typedef typename NP_helper1::Geom_traits Kernel; diff --git a/Point_set_processing_3/include/CGAL/cluster_point_set.h b/Point_set_processing_3/include/CGAL/cluster_point_set.h index c79cd850df1..6381c456917 100644 --- a/Point_set_processing_3/include/CGAL/cluster_point_set.h +++ b/Point_set_processing_3/include/CGAL/cluster_point_set.h @@ -145,7 +145,7 @@ std::size_t cluster_point_set (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetAdjacencies::type Adjacencies; - CGAL_static_assertion_msg(!(std::is_same::type, + static_assert(!(std::is_same::type, typename GetSvdTraits::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index d808a6ee46f..1465fc7e357 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -197,7 +197,7 @@ jet_estimate_normals( typedef typename GetSvdTraits::type SvdTraits; CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); - CGAL_static_assertion_msg(!(std::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h index c8982be7517..952f2c0d595 100644 --- a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h @@ -200,7 +200,7 @@ jet_smooth_point_set( typedef typename NP_helper::Geom_traits Kernel; typedef typename GetSvdTraits::type SvdTraits; - CGAL_static_assertion_msg(!(std::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h b/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h index e8dac2ddc2b..6130aadaaf1 100644 --- a/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h +++ b/Point_set_processing_3/include/CGAL/pointmatcher/compute_registration_transformation.h @@ -607,14 +607,14 @@ compute_registration_transformation (const PointRange1& point_set_1, const Point // property map types typedef typename NP_helper1::Const_point_map PointMap1; typedef typename NP_helper2::Const_point_map PointMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The point type of input ranges must be the same"); typedef typename NP_helper1::Normal_map NormalMap1; typedef typename NP_helper2::Normal_map NormalMap2; - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The vector type of input ranges must be the same"); typedef typename std::iterator_traits::value_type key_type1; @@ -630,8 +630,8 @@ compute_registration_transformation (const PointRange1& point_set_1, const Point NormalMap2 normal_map2 = NP_helper2::get_normal_map(point_set_2, np2); auto weight_map2 = choose_parameter(get_parameter(np2, internal_np::scalar_map), DefaultWeightMap2(Scalar(1))); - CGAL_static_assertion_msg((std::is_same< typename boost::property_traits::value_type, - typename boost::property_traits::value_type> ::value), + static_assert(std::is_same< typename boost::property_traits::value_type, + typename boost::property_traits::value_type> ::value, "The scalar type of input ranges must be the same"); // initial transformation diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 043001e3b04..0b517436394 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); - CGAL_static_assertion_msg((!is_default_parameter::value), + static_assert(!is_default_parameter::value, "Error: no plane index map"); PointMap point_map = NP_helper::get_const_point_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index 41412051408..149944d50a2 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -525,6 +525,7 @@ wlop_simplify_and_regularize_point_set( if (require_uniform_sampling)//default value is false { + original_density_weights.reserve(number_of_original); //todo: this part could also be parallelized if needed for (it = first_original_iter, i = 0; it != points.end() ; ++it, ++i) { @@ -552,6 +553,7 @@ wlop_simplify_and_regularize_point_set( // Compute sample density weight for sample points std::vector sample_density_weights; + sample_density_weights.reserve(number_of_sample); for (sample_iter = sample_points.begin(); sample_iter != sample_points.end(); ++sample_iter) @@ -602,9 +604,7 @@ wlop_simplify_and_regularize_point_set( if (interrupted) return output; - sample_iter = sample_points.begin(); - for (std::size_t i = 0; i < sample_points.size(); ++ i) - sample_points[i] = update_sample_points[i]; + sample_points.swap(update_sample_points); } // final output diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp index b67e90210b5..4f23a1eaf55 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp @@ -210,7 +210,7 @@ int main(int argc, char*argv[]) for (Point_set::Index idx : points) f << points.point (idx) << std::endl; for (const auto& facet : CGAL::make_range (reconstruct.facets_begin(), reconstruct.facets_end())) - f << "3 "<< facet << std::endl; + f << "3 "<< facet[0] << " " << facet[1] << " " << facet[2] << std::endl; f.close (); //! [Output scale space] diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index f414898362f..8d541588736 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -569,7 +569,7 @@ The following running times were observed: *************************************** \section PMPPredicates Predicates -This packages provides several predicates to be evaluated with respect to a triangle mesh. +This package provides several predicates to be evaluated with respect to a triangle mesh. \subsection PMPDoIntersect Intersections Detection Intersection tests between triangle meshes and/or polylines can be done using diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h index 03e9103df9e..e51999b9c54 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h @@ -31,9 +31,9 @@ namespace Polygon_mesh_processing { /*! * \ingroup PMP_meshing_grp * -* \short smooths a triangulated region of a polygon mesh. +* \brief smooths a triangulated region of a polygon mesh. * -* This function attempts to make the triangle angle and area distributions as uniform as possible +* This function aims to make the triangle angle and area distributions as uniform as possible * by moving (non-constrained) vertices. * * Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing @@ -329,13 +329,33 @@ void angle_and_area_smoothing(const FaceRange& faces, } } -///\cond SKIP_IN_MANUAL +/*! +* \ingroup PMP_meshing_grp +* +* \brief smooths a polygon mesh. +* +* This function aims to make the triangle angle and area distributions as uniform as possible +* by moving (non-constrained) vertices. +* +* Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing +* might change the combinatorial information, unless specified otherwise. It is also possible +* to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the +* quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or +* create self-intersections. +* +* Optionally, the points are reprojected after each iteration. +* +* See the overload which takes a face range as additonal parameter for a comprehensive description +* of the parameters. +*/ template void angle_and_area_smoothing(TriangleMesh& tmesh, const CGAL_NP_CLASS& np = parameters::default_values()) { angle_and_area_smoothing(faces(tmesh), tmesh, np); } + +///\cond SKIP_IN_MANUAL template void angles_evaluation(TriangleMesh& tmesh, GeomTraits traits, Stream& output) { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h index ee92e8e3640..988e6c3a7ee 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h @@ -444,8 +444,8 @@ generic_clip_impl( typedef typename GetVertexPointMap::type Vpm2; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); Vpm vpm1 = choose_parameter(get_parameter(np1, internal_np::vertex_point), get_property_map(boost::vertex_point, tm1)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h index 525f020a342..bffa8e6dca1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h @@ -553,7 +553,7 @@ std::size_t keep_large_connected_components(PolygonMesh& pmesh, >::type FaceSizeMap; typedef typename boost::property_traits::value_type Face_size; - CGAL_static_assertion((std::is_convertible::value)); + static_assert(std::is_convertible::value); typedef typename internal_np::Lookup_named_param_def::type VPM1; typedef typename GetVertexPointMap::type VPM2; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); VPM1 vpm1 = choose_parameter(get_parameter(np1, internal_np::vertex_point), get_property_map(boost::vertex_point, tm1)); @@ -694,8 +694,8 @@ corefine( TriangleMesh& tm1, typedef typename GetVertexPointMap::type VPM1; typedef typename GetVertexPointMap::type VPM2; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); VPM1 vpm1 = choose_parameter(get_parameter(np1, internal_np::vertex_point), get_property_map(boost::vertex_point, tm1)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h index 4237fa85b6f..21024ad5c04 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h @@ -155,7 +155,7 @@ double max_distance_to_mesh_impl(const PointRange& sample_points, using FT = typename Kernel::FT; #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if(boost::is_convertible::value) @@ -1037,7 +1037,7 @@ sample_triangle_soup(const PointRange& points, typedef typename PointRange::value_type Point_3; typedef typename Kernel_traits::Kernel GeomTraits; - CGAL_static_assertion_msg((std::is_same::value), "Wrong point type."); + static_assert(std::is_same::value, "Wrong point type."); CGAL_precondition(!triangles.empty()); @@ -1995,7 +1995,7 @@ bounded_error_squared_one_sided_Hausdorff_distance_impl(const TriangleMesh1& tm1 OutputIterator& out) { #if !defined(CGAL_LINKED_WITH_TBB) || !defined(CGAL_METIS_ENABLED) - CGAL_static_assertion_msg(!(boost::is_convertible::value), + static_assert(!(boost::is_convertible::value), "Parallel_tag is enabled but at least TBB or METIS is unavailable."); #endif @@ -2270,7 +2270,7 @@ bounded_error_squared_symmetric_Hausdorff_distance_impl(const TriangleMesh1& tm1 OutputIterator2& out2) { #if !defined(CGAL_LINKED_WITH_TBB) || !defined(CGAL_METIS_ENABLED) - CGAL_static_assertion_msg(!(boost::is_convertible::value), + static_assert(!(boost::is_convertible::value), "Parallel_tag is enabled but at least TBB or METIS is unavailable."); #endif diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index 28958df8ac0..60829f72623 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -151,11 +151,11 @@ bool fair(TriangleMesh& tmesh, #endif #if defined(CGAL_EIGEN3_ENABLED) - CGAL_static_assertion_msg( + static_assert( (!std::is_same::type, bool>::value) || EIGEN_VERSION_AT_LEAST(3, 2, 0), "The function `fair` requires Eigen3 version 3.2 or later."); #else - CGAL_static_assertion_msg( + static_assert( (!std::is_same::type, bool>::value), "The function `fair` requires Eigen3 version 3.2 or later."); #endif diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 89a3cd82904..c27ae2bda3a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1051,16 +1051,18 @@ public: previous_bitvalue[2] = is_patch_inside_tm1.test(patch_id_q1); previous_bitvalue[3] = is_patch_inside_tm1.test(patch_id_q2); -#ifndef CGAL_NDEBUG +/* + // Note that this code is commented as impossible_operation flag could be set thanks to + // another polyline and such a `continue` would make us miss it. if (is_tm1_closed && is_tm2_closed) { - if (!patch_status_was_not_already_set[0] && - !patch_status_was_not_already_set[1] && - !patch_status_was_not_already_set[2] && - !patch_status_was_not_already_set[3]) - continue; // all patches were already classified, no need to redo it + if (!patch_status_was_not_already_set[0] && + !patch_status_was_not_already_set[1] && + !patch_status_was_not_already_set[2] && + !patch_status_was_not_already_set[3]) + continue; // all patches were already classified, no need to redo it } -#endif +*/ // check incompatibility of patch classifications auto inconsistent_classification = [&]() @@ -1084,6 +1086,25 @@ public: } return false; }; +#ifndef CGAL_NDEBUG + auto debug_check_consistency = [&]() + { + if (!used_to_clip_a_surface && !used_to_classify_patches) + { + CGAL_assertion( patch_status_was_not_already_set[0] || (previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1]) ); + CGAL_assertion( patch_status_was_not_already_set[1] || (previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2]) ); + CGAL_assertion( patch_status_was_not_already_set[2] || (previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1]) ); + CGAL_assertion( patch_status_was_not_already_set[3] || (previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2]) ); + } + }; + is_patch_inside_tm2.reset(patch_id_p1); + is_patch_inside_tm2.reset(patch_id_p2); + is_patch_inside_tm1.reset(patch_id_q1); + is_patch_inside_tm1.reset(patch_id_q2); +#else + auto debug_check_consistency = [&](){}; + +#endif //indicates that patch status will be updated patch_status_not_set_tm1.reset(patch_id_p1); @@ -1140,6 +1161,7 @@ public: if ( q2_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q2); //case 1 else is_patch_inside_tm2.set(patch_id_p2); //case 2 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else{ @@ -1171,6 +1193,7 @@ public: is_patch_inside_tm2.set(patch_id_p2); } //else case 4 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else @@ -1202,6 +1225,7 @@ public: is_patch_inside_tm2.set(patch_id_p1); } // else case 6 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else{ @@ -1231,6 +1255,7 @@ public: if ( q1_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q1); //case 7 else is_patch_inside_tm2.set(patch_id_p1); //case 8 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } } @@ -1393,13 +1418,7 @@ public: } } if (inconsistent_classification()) return; - if (!used_to_clip_a_surface && !used_to_classify_patches) - { - CGAL_assertion( patch_status_was_not_already_set[0] || previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1] ); - CGAL_assertion( patch_status_was_not_already_set[1] || previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2] ); - CGAL_assertion( patch_status_was_not_already_set[2] || previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1] ); - CGAL_assertion( patch_status_was_not_already_set[3] || previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2] ); - } + debug_check_consistency(); } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h index 47be440cd3a..652d0b09952 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h @@ -98,7 +98,7 @@ intersection_type( typedef typename boost::property_traits::value_type Point_3; typedef typename Kernel_traits::Kernel Kernel; - CGAL_static_assertion((std::is_same::value_type>::value)); + static_assert(std::is_same::value_type>::value); halfedge_descriptor h_2=halfedge(f_2,tm2); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h index 64933af6b3b..38f137cad01 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h @@ -49,8 +49,8 @@ public: private: //typedefs typedef typename boost::property_traits::value_type Point_3; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); typedef typename Kernel_traits::Kernel Input_kernel; typedef std::vector Nodes_vector; @@ -151,8 +151,8 @@ public: private: typedef typename boost::property_traits::value_type Point_3; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); typedef typename Kernel_traits::Kernel Input_kernel; @@ -328,8 +328,8 @@ class Intersection_nodes::value_type Point_3; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); typedef typename Kernel_traits::Kernel Input_kernel; typedef std::vector Nodes_vector; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_of_coplanar_triangles_3.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_of_coplanar_triangles_3.h index 0e73d4be013..b2047d2627e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_of_coplanar_triangles_3.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_of_coplanar_triangles_3.h @@ -32,8 +32,8 @@ struct Intersect_coplanar_faces_3 // typedefs typedef typename boost::property_traits::value_type Point; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); typedef typename CGAL::Kernel_traits::Kernel Input_kernel; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index b7f158d6814..337cdcb0ad8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -960,7 +960,7 @@ std::size_t snap_non_conformal_one_way(const HalfedgeRange& halfedge_range_S, #endif #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else // CGAL_LINKED_WITH_TBB if(std::is_convertible::value) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h index b8edbdfd807..5adbf99ff6f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h @@ -371,7 +371,7 @@ void find_vertex_vertex_matches_with_kd_tree(Unique_positions& unique_positions_ tree.insert(unique_positions_Bv.begin(), unique_positions_Bv.end()); #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else // parallel @@ -596,7 +596,7 @@ void find_vertex_vertex_matches_with_box_d(const Unique_positions& unique_positi boxes_B_ptr.push_back(&b); #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else // CGAL_LINKED_WITH_TBB if(std::is_convertible::value) @@ -730,7 +730,7 @@ std::size_t snap_vertices_two_way(const HalfedgeRange_A& halfedge_range_A, using parameters::get_parameter; using parameters::get_parameter_reference; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); GT gt = choose_parameter(get_parameter(np_A, internal_np::geom_traits)); VPM_A vpm_A = choose_parameter(get_parameter(np_A, internal_np::vertex_point), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index 06ddc868f0d..98a80e05a8e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -42,6 +42,8 @@ template class Refine_Polyhedron_3 { //// typedefs typedef typename boost::property_traits::value_type Point_3; + typedef typename boost::property_traits::reference Point_3_ref; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -88,7 +90,6 @@ private: bool relax(halfedge_descriptor h) { #ifdef CGAL_PMP_REFINE_DEBUG_PP - typedef typename boost::property_traits::reference Point_3_ref; Point_3_ref p = get(vpmap, source(h,pmesh)); Point_3_ref q = get(vpmap, target(h,pmesh)); Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh)); @@ -227,7 +228,7 @@ private: const std::set& interior_map, bool accept_internal_facets) { - const Point_3& vp = get(vpmap, vh); + const Point_3_ref vp = get(vpmap, vh); Halfedge_around_target_circulator circ(halfedge(vh,pmesh),pmesh), done(circ); int deg = 0; double sum = 0; @@ -239,7 +240,7 @@ private: { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation } - const Point_3& vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); + const Point_3_ref vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq))); ++deg; } while(++circ != done); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index 7d1b1b6e6bf..d4fc6d730e4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -425,7 +425,7 @@ compute_face_face_intersection(const FaceRange& face_range1, get_const_property_map(boost::vertex_point, tm1)); VertexPointMap2 vpmap2 = choose_parameter(get_parameter(np2, internal_np::vertex_point), get_const_property_map(boost::vertex_point, tm2)); - CGAL_static_assertion( + static_assert( (std::is_same< typename boost::property_traits::value_type, typename boost::property_traits::value_type @@ -543,7 +543,7 @@ compute_face_polyline_intersection(const FaceRange& face_range, VertexPointMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(boost::vertex_point, tm)); typedef typename boost::property_traits::value_type Point; - CGAL_static_assertion( + static_assert( (std::is_same::type>::value)); @@ -681,7 +681,7 @@ compute_face_polylines_intersection(const FaceRange& face_range, get_const_property_map(boost::vertex_point, tm)); typedef typename boost::property_traits::value_type Point; typedef typename boost::range_value::type Polyline; - CGAL_static_assertion((std::is_same::type>::value)); + static_assert(std::is_same::type>::value); std::vector faces; faces.reserve(std::distance( boost::begin(face_range), boost::end(face_range) )); @@ -1742,8 +1742,8 @@ surface_intersection(const TriangleMesh& tm1, typedef typename GetVertexPointMap::const_type VPM1; typedef typename GetVertexPointMap::const_type VPM2; - CGAL_static_assertion((std::is_same::value_type, - typename boost::property_traits::value_type>::value)); + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value); VPM1 vpm1 = parameters::choose_parameter(parameters::get_parameter(np1, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, tm1)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 2d5d92374ba..26d0266e03a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -1661,12 +1661,12 @@ locate_with_AABB_tree(const typename internal::Location_traits AABB_traits; typedef typename Primitive::Point Point_3; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); typedef typename GetVertexPointMap::const_type VertexPointMap; typedef internal::Point_to_Point_3_VPM WrappedVPM; - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); typename AABB_tree::Point_and_primitive_id result = tree.closest_point_and_primitive(p3); typedef typename GetGeomTraits::type Geom_traits; @@ -1754,7 +1754,7 @@ locate(const typename internal::Location_traits:: using parameters::get_parameter; using parameters::choose_parameter; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); const VertexPointMap vpm = parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_point), get_const_property_map(boost::vertex_point, tm)); @@ -1763,7 +1763,7 @@ locate(const typename internal::Location_traits:: AABB_tree tree; build_AABB_tree(tm, tree, parameters::vertex_point_map(wrapped_vpm)); - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); return locate_with_AABB_tree(p3, tree, tm, parameters::vertex_point_map(wrapped_vpm)); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index ac5a340d816..8f1c60347ee 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -857,34 +857,38 @@ centroid(const TriangleMesh& tmesh, Vpm vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, tmesh)); - typedef typename GetGeomTraits::type Kernel; - typedef typename Kernel::Point_3 Point_3; + typedef typename GetGeomTraits::type Kernel; + Kernel k = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + typedef typename Kernel::FT FT; + typedef typename boost::property_traits::reference Point_3_ref; typedef typename Kernel::Vector_3 Vector_3; + typedef typename Kernel::Construct_translated_point_3 Construct_translated_point_3; typedef typename Kernel::Construct_vector_3 Construct_vector_3; typedef typename Kernel::Construct_normal_3 Construct_normal_3; typedef typename Kernel::Compute_scalar_product_3 Scalar_product; typedef typename Kernel::Construct_scaled_vector_3 Scale; typedef typename Kernel::Construct_sum_of_vectors_3 Sum; + typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename Kernel::FT FT; FT volume = 0; Vector_3 centroid(NULL_VECTOR); - Construct_translated_point_3 point; - Construct_vector_3 vector; - Construct_normal_3 normal; - Scalar_product scalar_product; - Scale scale; - Sum sum; + Construct_translated_point_3 point = k.construct_translated_point_3_object(); + Construct_vector_3 vector = k.construct_vector_3_object(); + Construct_normal_3 normal = k.construct_normal_3_object(); + Scalar_product scalar_product = k.compute_scalar_product_3_object(); + Scale scale = k.construct_scaled_vector_3_object(); + Sum sum = k.construct_sum_of_vectors_3_object(); for(face_descriptor fd : faces(tmesh)) { - const Point_3& p = get(vpm, target(halfedge(fd, tmesh), tmesh)); - const Point_3& q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); - const Point_3& r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh)); + const Point_3_ref q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); Vector_3 vp = vector(ORIGIN, p), vq = vector(ORIGIN, q), vr = vector(ORIGIN, r); @@ -985,8 +989,8 @@ void match_faces(const PolygonMesh1& m1, get_const_property_map(vertex_point, m1)); const VPMap2 vpm2 = choose_parameter(get_parameter(np2, internal_np::vertex_point), get_const_property_map(vertex_point, m2)); - CGAL_static_assertion_msg((std::is_same::value_type, - typename boost::property_traits::value_type>::value), + static_assert(std::is_same::value_type, + typename boost::property_traits::value_type>::value, "Both vertex point maps must have the same point type."); const VIMap1 vim1 = get_initialized_vertex_index_map(m1, np1); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h index 612620049a0..a7e9cf2480a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h @@ -159,7 +159,7 @@ void orient_triangle_soup_with_reference_triangle_soup(const ReferencePointRange typedef typename boost::property_traits::reference PM2_Point_ref; typedef typename boost::property_traits::value_type Point_3; - CGAL_static_assertion((std::is_same::value_type>::value)); + static_assert(std::is_same::value_type>::value); typedef typename CGAL::Kernel_traits::Kernel K; typedef typename K::Triangle_3 Triangle; @@ -215,7 +215,7 @@ void orient_triangle_soup_with_reference_triangle_soup(const ReferencePointRange }; #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if(std::is_convertible::value) @@ -309,7 +309,7 @@ void orient_triangle_soup_with_reference_triangle_mesh(const TriangleMesh& tm_re PointMap point_map = NP_helper::get_const_point_map(points, np2); - CGAL_static_assertion((std::is_same::value_type>::value)); + static_assert(std::is_same::value_type>::value); K k = choose_parameter(get_parameter(np1, internal_np::geom_traits)); @@ -352,7 +352,7 @@ void orient_triangle_soup_with_reference_triangle_mesh(const TriangleMesh& tm_re }; #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h index d0b22f7b5ef..eed98878632 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h @@ -39,7 +39,7 @@ struct PM_to_PS_point_converter { PS_Point operator()(const PM_Point& p) const { - CGAL_static_assertion((std::is_convertible::value)); + static_assert(std::is_convertible::value); return PS_Point(p); } }; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h index bd543f5d390..df32555bc53 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h @@ -43,7 +43,7 @@ namespace internal { template PM_Point convert_to_pm_point(const PS_Point& p) { - CGAL_static_assertion((std::is_convertible::value)); + static_assert(std::is_convertible::value); return PM_Point(p); } @@ -353,10 +353,10 @@ void polygon_soup_to_polygon_mesh(const PointRange& points, choose_parameter(get_parameter(np_ps, internal_np::polygon_to_face_output_iterator), impl::make_functor(get_parameter(np_ps, internal_np::polygon_to_face_map)))); - CGAL_static_assertion_msg( + static_assert( (parameters::is_default_parameter::value), "Named parameter vertex_to_vertex_map was renamed point_to_vertex_map"); - CGAL_static_assertion_msg( + static_assert( (parameters::is_default_parameter::value), "Named parameter face_to_face_map was renamed polygon_to_face_map"); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 798499f430b..40f480cbb7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -483,7 +483,7 @@ struct Filter_wrapper_for_cap_needle_removal link_faces; collect_link_faces(e, link_faces); - Functor f = std::move(m_make_envelope(link_faces)); + Functor f = m_make_envelope(link_faces); Base base(m_tm, m_vpm, f); return base.collapse(e); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h index 584358ccefa..3a5f9fca82f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h @@ -178,7 +178,7 @@ FaceOutputIterator replace_faces_with_patch(const std::vector::value_type, Point>::value)); + static_assert(std::is_same::value_type, Point>::value); typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h index 3524b46c775..3d085dbb27f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/self_intersections.h @@ -423,7 +423,7 @@ self_intersections_impl(const FaceRange& face_range, Throwing_filter throwing_filter(tmesh, vpmap, gt, Throwing_output_iterator()); #if !defined(CGAL_LINKED_WITH_TBB) - CGAL_static_assertion_msg (!(std::is_convertible::value), + static_assert (!(std::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if(std::is_convertible::value) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h index bd4e8ad8ab2..5fa0076b537 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h @@ -154,11 +154,11 @@ void smooth_shape(const FaceRange& faces, #endif #if defined(CGAL_EIGEN3_ENABLED) - CGAL_static_assertion_msg( + static_assert( (!std::is_same::type, bool>::value) || EIGEN_VERSION_AT_LEAST(3, 2, 0), "Eigen3 version 3.2 or later is required."); #else - CGAL_static_assertion_msg( + static_assert( (!std::is_same::type, bool>::value), "Eigen3 version 3.2 or later is required."); #endif diff --git a/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h b/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h index d6cbd420478..761ca6ec9bf 100644 --- a/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h +++ b/Polygon_mesh_processing/include/CGAL/Rigid_triangle_mesh_collision_detection.h @@ -250,7 +250,7 @@ public: { // handle vpm typedef typename CGAL::GetVertexPointMap::const_type Local_vpm; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); Vpm vpm = parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_point), @@ -562,7 +562,7 @@ public: parameters::get_parameter(np, internal_np::apply_per_connected_component), true); typedef typename CGAL::GetVertexPointMap::const_type Local_vpm; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); Vpm vpm = parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_point), diff --git a/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h b/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h index 00bc1225b14..458fc0a703c 100644 --- a/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h +++ b/Polygon_mesh_processing/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Polyhedral_envelope_filter.h @@ -58,7 +58,7 @@ private: template void initialize_envelope(const Profile& profile) const { - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); typedef typename Profile::Triangle_mesh Triangle_mesh; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh b/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh index 2cea97cfb6b..bf9b24931ba 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh @@ -14,6 +14,8 @@ for i in `seq 1 $k`; do ri=`echo $files | awk '{print $5}'` rm=`echo $files | awk '{print $6}'` rmr=`echo $files | awk '{print $7}'` + f1=`eval echo $f1` + f2=`eval echo $f2` echo -n "==== " $f1 $f2 " " if (./test_corefinement_bool_op $f1 $f2 ALL $ru $ri $rm $rmr|| false ) > /dev/null 2>&1; then diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd index c11009e6559..cc4c42e04cd 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd @@ -1,3 +1,21 @@ ${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1 ${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0 data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd index db4bb33152d..f506d796e9f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd @@ -29,21 +29,3 @@ data-coref/cube_meshed.off data-coref/cube.off ALL 1 1 1 1 data-coref/cube.off data-coref/cube_interior_tgt.off ALL 1 1 1 1 data-coref/cube.off data-coref/edge_tangent_to_cube.off ALL 1 1 0 1 data-coref/cube_dig.off data-coref/wedge.off ALL 1 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp index 2767dad9338..60c14ec9604 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_locate.cpp @@ -522,7 +522,7 @@ struct Locate_with_AABB_tree_Tester // 2D case typedef CGAL::AABB_face_graph_triangle_primitive AABB_face_graph_primitive; typedef CGAL::AABB_traits AABB_face_graph_traits; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); Intrinsic_point_to_Point_3 to_p3; @@ -633,7 +633,7 @@ struct Locate_with_AABB_tree_Tester // 3D typedef CGAL::AABB_traits AABB_face_graph_traits; typedef typename K::Point_3 Point_3; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); CGAL::AABB_tree tree_a; Point_reference p3_a = get(vpm, v); diff --git a/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/point_set_with_planes.h b/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/point_set_with_planes.h index 513438f8e29..09d628e7f4e 100644 --- a/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/point_set_with_planes.h +++ b/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/point_set_with_planes.h @@ -136,29 +136,23 @@ namespace CGAL { Base_class::resize(points.size()); Base_class::add_normal_map(); + std::map plane_index_remap; + // Gets to know the number of plane from the plane indices - int max_plane_index = 0; - for (typename PointRange::const_iterator it = points.begin(); it != points.end(); ++it) { - int plane_index = get(plane_index_map, *it); - if (plane_index > max_plane_index) - max_plane_index = plane_index; - } - std::size_t num_plane = max_plane_index + 1; // the first one has index 0 - - for (std::size_t i = 0; i < num_plane; ++i) - planar_segments_.push_back(new Planar_segment(this)); - std::size_t idx = 0; for (typename PointRange::const_iterator it = points.begin(); it != points.end(); ++it) { Base_class::m_points[idx] = get(point_map, *it); Base_class::m_normals[idx] = get(normal_map, *it); int plane_index = get(plane_index_map, *it); if (plane_index != -1) { - Planar_segment* ps = planar_segments_[plane_index]; - ps->push_back(idx); + auto it_and_bool = plane_index_remap.emplace(plane_index, planar_segments_.size()); + if (it_and_bool.second) { + planar_segments_.push_back(new Planar_segment(this)); + planar_segments_.back()->push_back(idx); + } + else planar_segments_[it_and_bool.first->second]->push_back(idx); } - - ++idx; + idx++; } } diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 9eb13d44e09..325a670e809 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -250,8 +250,20 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) add_item(scene_tetrahedra_item Scene_tetrahedra_item.cpp) target_link_libraries(scene_tetrahedra_item PUBLIC scene_c3t3_item) - add_item(scene_transform_item Plugins/PCA/Scene_facegraph_transform_item.cpp) + add_item(scene_aff_transformed_item Plugins/PCA/Scene_aff_transformed_item.cpp) + + add_item(scene_aff_transformed_point_set_item Plugins/PCA/Scene_aff_transformed_point_set_item.cpp) + target_link_libraries(scene_aff_transformed_point_set_item PUBLIC scene_points_with_normal_item + scene_aff_transformed_item) + add_item(scene_aff_transformed_polygon_soup_item Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp) + target_link_libraries(scene_aff_transformed_polygon_soup_item PUBLIC scene_polygon_soup_item + scene_aff_transformed_item) + add_item(scene_aff_transformed_surface_mesh_item Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp) + target_link_libraries(scene_aff_transformed_surface_mesh_item PUBLIC scene_surface_mesh_item + scene_aff_transformed_item) + add_item(scene_edit_box_item Plugins/PCA/Scene_edit_box_item.cpp) + add_item(scene_image_item Scene_image_item.cpp) add_item(scene_surface_mesh_item Scene_surface_mesh_item.cpp) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index b797ecf7a70..39c537dea5b 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -3191,8 +3191,8 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() tr("Enter the name of your scene file.")); if(path.isEmpty()) return; - if(!path.contains("Polyhedron_demo_")) - path.prepend("Polyhedron_demo_"); + if(!path.contains("/tmp/Polyhedron_demo_")) + path.prepend("/tmp/Polyhedron_demo_"); try{ ssh_session session = nullptr; bool res = establish_ssh_session_from_agent(session, diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp index fa09b603654..e500ffb92a8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp @@ -343,7 +343,7 @@ void Polyhedron_demo_polylines_io_plugin::simplify() { Scene_polylines_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); bool ok; - double err = QInputDialog::getDouble(mw, "Squared Frechet Distance", "Enter the squared approximation error:", pow(0.01*item->diagonalBbox(),2),0,999,8,&ok); + double err = QInputDialog::getDouble(mw, "Squared Frechet Distance", "Enter the squared approximation error:", pow(0.01*item->bboxDiagonal(),2),0,999,8,&ok); if(!ok) return; for(Scene_polylines_item::Polylines_container::iterator diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp index 7a889e4da14..9139fdd2590 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -138,7 +138,7 @@ Polyhedron_demo_c3t3_binary_io_plugin::load( item->set_valid(false); if(CGAL::SMDS_3::build_triangulation_from_file(in, item->c3t3().triangulation(), - /*verbose = */true, /*replace_subdomain_0 = */false, /*allow_non_manifold = */true)) + /*verbose = */false, /*replace_subdomain_0 = */false, /*allow_non_manifold = */true)) { update_c3t3(item->c3t3()); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt index eb4e9c5b57d..2cc3f58854f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt @@ -116,3 +116,16 @@ if(TBB_FOUND) target_link_libraries(c3t3_io_plugin PUBLIC CGAL::TBB_support) target_link_libraries(c3t3_rib_exporter_plugin PUBLIC CGAL::TBB_support) endif() + +qt5_wrap_ui(offsetMeshingUI_FILES Offset_meshing_dialog.ui) +polyhedron_demo_plugin(offset_meshing_plugin Offset_meshing_plugin + ${offsetMeshingUI_FILES}) +target_link_libraries(offset_meshing_plugin PUBLIC scene_surface_mesh_item + scene_polygon_soup_item + scene_polylines_item) +if(TARGET CGAL::Eigen3_support) + target_link_libraries(offset_meshing_plugin PUBLIC CGAL::Eigen3_support) +endif() +if(TARGET CGAL::TBB_support) + target_link_libraries(offset_meshing_plugin PUBLIC CGAL::TBB_support) +endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 59c687fb8a4..9a95dfc67bf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -685,9 +685,8 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, connect(ui.useWeights_checkbox, SIGNAL(toggled(bool)), ui.weightsSigma_label, SLOT(setEnabled(bool))); ui.labeledImgGroup->setVisible(input_is_labeled_img); - ui.weightsSigma->setValue((std::max)(image_item->image()->vx(), - (std::max)(image_item->image()->vy(), - image_item->image()->vz()))); + if(image_item != nullptr && input_is_labeled_img) + ui.weightsSigma->setValue(image_item->default_sigma_weights()); #ifndef CGAL_USE_ITK if (input_is_labeled_img) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_dialog.ui similarity index 81% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui rename to Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_dialog.ui index 37b9073000f..33df99c77bb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Remeshing_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_dialog.ui @@ -1,64 +1,70 @@ - Remeshing_dialog - + Offset_meshing_dialog + 0 0 - 376 - 216 + 413 + 294 Meshing criteria - + 25.0 - - - - 0.00 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + - Approximation &error: + Edge size Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - 0.00 - - - - - - - &Topological criterion: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - tags - - - + + + true + + + 0.00 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -77,43 +83,47 @@ - - - - Qt::Vertical + + + + Topological criterion - - - 20 - 40 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + tags - - - true - + 0.00 - - + + - &Edge size: + Approximation error + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0.00 + + + + + + + Size Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -121,22 +131,24 @@ - + - &Size: + Angle Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - &Angle: + + + + + 15 + - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Meshing Criteria @@ -154,7 +166,7 @@ buttonBox accepted() - Remeshing_dialog + Offset_meshing_dialog accept() @@ -170,7 +182,7 @@ buttonBox rejected() - Remeshing_dialog + Offset_meshing_dialog reject() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp new file mode 100644 index 00000000000..8b0e0bab57b --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp @@ -0,0 +1,765 @@ +#include "config.h" + +#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER + +#include +#include "ui_Offset_meshing_dialog.h" + +#include "C3t3_type.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "Scene_surface_mesh_item.h" +#include "Scene_polygon_soup_item.h" +#include "Scene_polylines_item.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace CGAL::Three; + +namespace CGAL { + +template +class Offset_function +{ + using Primitive = AABB_face_graph_triangle_primitive; + using Traits = AABB_traits; + using Tree = AABB_tree; + using Side_of = Side_of_triangle_mesh; + + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; + +public: + Offset_function(const TriangleMesh& tm, + double offset_distance) + : m_tree_ptr(std::make_shared(std::begin(faces(tm)), std::end(faces(tm)), tm)), + m_side_of_ptr(std::make_shared(*m_tree_ptr)), + m_is_inset(offset_distance < 0), + m_sq_offset_distance(CGAL::square(offset_distance)), + m_is_closed(is_closed(tm)) + { + CGAL_assertion(!m_tree_ptr->empty()); + } + + // we only need negative inside, and positive outside, so we can compare square roots + double operator()(const Point_3& p) const + { + const Bounded_side side = m_is_closed ? m_side_of_ptr->operator()(p) : ON_UNBOUNDED_SIDE; + + if(m_is_inset) // also means that the mesh is closed + { + // - ON_UNBOUNDED_SIDE is outside the offset since we are insetting + // - ON_BOUNDARY is outside the offset since we are insetting + if(side != ON_BOUNDED_SIDE) + return 1; + + // inside the offset if the distance to the input mesh is greater than the offset distance + const FT sq_distance = m_tree_ptr->squared_distance(p); + return (sq_distance > m_sq_offset_distance) ? -1 : 1; + } + else // outset + { + // - ON_BOUNDED_SIDE can only happen if it's a closed mesh, and in that case, being inside + // the mesh is being inside the offset + // - ON_BOUNDARY is in the offset whether the mesh is open or closed + if(side != ON_UNBOUNDED_SIDE) + return - 1; + + // inside the offset if the distance to the input mesh is smaller than the offset distance + const FT sq_distance = m_tree_ptr->squared_distance(p); + return (sq_distance < m_sq_offset_distance) ? -1 : 1; + } + } + +private: + std::shared_ptr m_tree_ptr; + std::shared_ptr m_side_of_ptr; + const bool m_is_inset; + const double m_sq_offset_distance; + const bool m_is_closed; +}; + +template +class Polygon_soup_offset_function +{ + using Polygon_iterator = typename Polygons::const_iterator; + + class Polygon_soup_point_property_map + { + const Points* points_vector_ptr; + + public: + using key_type = Polygon_iterator; + using value_type = EPICK::Point_3; + using reference = const value_type&; + using category = boost::readable_property_map_tag; + + Polygon_soup_point_property_map() = default; + Polygon_soup_point_property_map(const Points* ptr) : points_vector_ptr(ptr) { } + + friend reference get(Polygon_soup_point_property_map map, + key_type polygon_it) + { + return (*map.points_vector_ptr)[*polygon_it->begin()]; + } + }; + + class Polygon_soup_triangle_property_map + { + const Points* points_vector_ptr; + + public: + using key_type = Polygon_iterator; + using value_type = EPICK::Triangle_3; + using reference = value_type; + using category = boost::readable_property_map_tag; + + Polygon_soup_triangle_property_map() = default; + Polygon_soup_triangle_property_map(const Points* ptr) : points_vector_ptr(ptr) { } + + friend value_type get(Polygon_soup_triangle_property_map map, + key_type polygon_it) + { + auto it = polygon_it->begin(); + CGAL_assertion(it != polygon_it->end()); + const auto id0 = *it++; + CGAL_assertion(it != polygon_it->end()); + const auto id1 = *it++; + CGAL_assertion(it != polygon_it->end()); + const auto id2 = *it++; + CGAL_assertion(it == polygon_it->end()); + + return value_type((*map.points_vector_ptr)[id0], + (*map.points_vector_ptr)[id1], + (*map.points_vector_ptr)[id2]); + } + }; + + struct AABB_polygon_soup_triangle_primitive + : public CGAL::AABB_primitive + { + using Base = CGAL::AABB_primitive; + + using Id = Polygon_iterator; + + template + AABB_polygon_soup_triangle_primitive(Id id, + ObjectPmap&& opmap, + PointPmap&& ppmap) + : Base(id, std::forward(opmap), std::forward(ppmap)) + { + } + + template + AABB_polygon_soup_triangle_primitive(Iterator it, + ObjectPmap&& opmap, + PointPmap&& ppmap) + : Base(*it, std::forward(opmap), std::forward(ppmap)) + { + } + }; // struct template Polygon_soup_primitive + + using AABB_traits = CGAL::AABB_traits; + using AABB_tree = CGAL::AABB_tree; + + std::shared_ptr m_tree_ptr; + double m_sq_offset_distance; + +public: + Polygon_soup_offset_function(const Points& points, + const Polygons& polygons, + const double offset_distance) + : m_tree_ptr(std::make_shared(std::begin(polygons), + std::end(polygons), + Polygon_soup_triangle_property_map(&points), + Polygon_soup_point_property_map(&points))), + m_sq_offset_distance(square(offset_distance)) + { + CGAL_assertion(!m_tree_ptr->empty()); + } + + // we only need negative inside, and positive outside, so we can compare square roots + double operator()(const EPICK::Point_3& p) const + { + // it's a soup so it's open by definition ==> treat inset and outset identically + const double sq_distance = m_tree_ptr->squared_distance(p); + return sq_distance - m_sq_offset_distance; + } + +}; // class Polygon_soup_offset_function + +} // namespace CGAL + +CGAL::Offset_function +offset_function(Scene_surface_mesh_item* item, double offset_value) +{ + return { *(item->face_graph()), offset_value }; +} + +CGAL::Polygon_soup_offset_function +offset_function(Scene_polygon_soup_item* item, double offset_value) +{ + return { item->points(), item->polygons(), offset_value }; +} + +class MeshGuard +{ + SMesh* mesh; + bool done; + +public: + MeshGuard(SMesh* mesh) : mesh(mesh), done(false) { } + void setDone() { done = true; } + ~MeshGuard() + { + if(!done) + delete mesh; + } +}; + +// declare the CGAL function +template +SMesh* cgal_off_meshing(QWidget*, + SourceItem* source_item, + Scene_polylines_item* polylines_item, + const double offset_value, + const double angle, + const double sizing, + const double approx, + const double edge_size, + int tag) +{ + using GT = EPICK; + using Sphere_3 = GT::Sphere_3; + + using Mesh_domain_base = CGAL::Labeled_mesh_domain_3; + using Mesh_domain = CGAL::Mesh_domain_with_polyline_features_3; + using Tr = C3t3::Triangulation; + using Mesh_criteria = CGAL::Mesh_criteria_3; + + const CGAL::Bbox_3 bbox = source_item->bbox(); + + const GT::Point_3 center((bbox.xmax() + bbox.xmin()) / 2, + (bbox.ymax() + bbox.ymin()) / 2, + (bbox.zmax() + bbox.zmin()) / 2); + const double rad = 0.6 * std::sqrt(CGAL::square(bbox.xmax() - bbox.xmin()) + + CGAL::square(bbox.ymax() - bbox.ymin()) + + CGAL::square(bbox.zmax() - bbox.zmin())) + + offset_value; + const double sqrad = CGAL::square(rad); + + CGAL::Timer timer; + timer.start(); + + namespace p = CGAL::parameters; + + Mesh_domain domain = + Mesh_domain::create_implicit_mesh_domain + (p::function = offset_function(source_item, offset_value), + p::bounding_object = Sphere_3(center, sqrad), + p::relative_error_bound = 1e-7, + p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); + + const CGAL::Mesh_facet_topology topology = CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH; + auto manifold_option = p::non_manifold(); + if(tag == 1) + manifold_option = p::manifold_with_boundary(); + if(tag == 2) + manifold_option = p::manifold(); + + Mesh_criteria criteria(p::facet_angle = angle, + p::facet_size = sizing, + p::facet_distance = approx, + p::facet_topology = topology, + p::edge_size = edge_size); + + if(polylines_item != nullptr) + { + typedef std::vector Surface_patch_ids; + std::vector surface_patch_ids; + + domain.add_features_and_incidences(polylines_item->polylines.begin(), + polylines_item->polylines.end(), + CGAL::Identity_property_map(), + CGAL::Constant_property_map(surface_patch_ids)); + } + + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, + p::no_perturb(), + p::no_exude(), + manifold_option); + + timer.stop(); + std::cerr << "done (" << timer.time() << " ms, " << c3t3.triangulation().number_of_vertices() << " vertices)" << std::endl; + + if(c3t3.number_of_facets_in_complex() > 0) + { + SMesh* pRemesh = new SMesh(); + + // if the thread is interrupted before the mesh is returned, delete it. + MeshGuard guard(pRemesh); + CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, *pRemesh); + guard.setDone(); + + CGAL_postcondition(CGAL::Polygon_mesh_processing::is_outward_oriented(*pRemesh)); + + return pRemesh; + } + else + { + return nullptr; + } +} + +struct Mesher_thread + : public QThread +{ + Q_OBJECT + +private: + Scene_surface_mesh_item* sm_item; + Scene_polygon_soup_item* soup_item; + Scene_polylines_item* polylines_item; + + const double offset_value; + const double angle; + const double sizing; + const double approx; + const double edge_size; + int tag_index; + +public: + Mesher_thread(Scene_surface_mesh_item* sm_item, + Scene_polygon_soup_item* soup_item, + Scene_polylines_item* polylines_item, + const double offset_value, + const double angle, + const double sizing, + const double approx, + const double edge_size, + int tag) + : sm_item(sm_item), soup_item(soup_item), polylines_item(polylines_item), + offset_value(offset_value), + angle(angle), sizing(sizing), approx(approx), edge_size(edge_size), tag_index(tag) + { + } + + void run() override + { + SMesh* offset_mesh = nullptr; + + if(soup_item) + { + offset_mesh = cgal_off_meshing(Three::mainWindow(), + soup_item, polylines_item, + offset_value, + angle, sizing, approx, edge_size, tag_index); + } + else + { + offset_mesh = cgal_off_meshing(Three::mainWindow(), + sm_item, polylines_item, + offset_value, + angle, sizing, approx, edge_size, tag_index); + } + + Three::getMutex()->lock(); + Three::getWaitCondition()->wakeAll(); + Three::getMutex()->unlock(); + + Q_EMIT resultReady(offset_mesh); + } + +Q_SIGNALS: + void resultReady(SMesh *offset_mesh); +}; + +class Polyhedron_demo_offset_meshing_plugin + : public QObject, + protected Polyhedron_demo_plugin_interface +{ + Q_OBJECT + Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + +private: + QAction* actionOffsetMeshing; + QAction* actionInflateMesh; + + Scene_interface *scene; + QMainWindow *mw; + +public: + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface, + Messages_interface*) + { + this->scene = scene_interface; + this->mw = mainWindow; + + actionOffsetMeshing = new QAction(tr("Offset Meshing"), mw); + actionOffsetMeshing->setProperty("subMenuName", "3D Surface Mesh Generation"); + connect(actionOffsetMeshing, SIGNAL(triggered()), + this, SLOT(offset_meshing())); + + actionInflateMesh = new QAction(tr("Inflate Mesh"), mw); + actionInflateMesh->setProperty("subMenuName", "Operations on Polyhedra"); + connect(actionInflateMesh, SIGNAL(triggered()), + this, SLOT(inflate_mesh())); + } + + bool applicable(QAction* action) const + { + if(action == actionOffsetMeshing) + { + if(scene->selectionIndices().size() == 1) + { + const int index = scene->mainSelectionIndex(); + return (qobject_cast(scene->item(index)) || + qobject_cast(scene->item(index))); + } + + // Can provide a polyline item for feature protection + if(scene->selectionIndices().size() != 2) + return false; + + // One needs to be a surface mesh or polygon soup item, and the other a polyline item + const int index1 = scene->selectionIndices().at(0); + const int index2 = scene->selectionIndices().at(1); + Scene_item* item1 = scene->item(index1); + Scene_item* item2 = scene->item(index2); + + if((qobject_cast(item1) || + qobject_cast(item1)) && + qobject_cast(item2)) + return true; + + if((qobject_cast(item2) || + qobject_cast(item2)) && + qobject_cast(item1)) + return true; + } + else if(action == actionInflateMesh) + { + if(scene->selectionIndices().size() == 1) + { + const int index = scene->mainSelectionIndex(); + return qobject_cast(scene->item(index)); + } + } + + return false; + } + + QList actions() const + { + return QList() << actionOffsetMeshing + << actionInflateMesh; + } + +public Q_SLOTS: + void offset_meshing(); + void inflate_mesh(); +}; // class Polyhedron_demo_offset_meshing_plugin + +void +Polyhedron_demo_offset_meshing_plugin:: +offset_meshing() +{ + Scene_item* item = nullptr; + Scene_surface_mesh_item* sm_item = nullptr; + Scene_polygon_soup_item* soup_item = nullptr; + Scene_polylines_item* polylines_item = nullptr; + + bool mesh_or_soup_item_found = false; + Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) + { + if(!mesh_or_soup_item_found) + { + sm_item = qobject_cast(scene->item(index)); + if(sm_item == nullptr) + { + soup_item = qobject_cast(scene->item(index)); + if(soup_item != nullptr) + { + item = scene->item(index); + mesh_or_soup_item_found = true; + continue; + } + } + else + { + item = scene->item(index); + mesh_or_soup_item_found = true; + continue; + } + } + + polylines_item = qobject_cast(scene->item(index)); + } + + QApplication::setOverrideCursor(Qt::WaitCursor); + + if(!mesh_or_soup_item_found) + return; + + if(sm_item) + { + if(!is_triangle_mesh(*(sm_item->face_graph()))) + { + QMessageBox::critical(mw, + tr("Offset Meshing"), + tr("The selected mesh is not a triangle mesh.")); + return; + } + } + else + { + for(const auto& p : soup_item->polygons()) + { + if(p.size() != 3) + { + QMessageBox::critical(mw, + tr("Offset Meshing"), + tr("The selected polygon soup is not a triangle soup.")); + return; + } + } + } + + double diag; + if(sm_item) + diag = sm_item->bboxDiagonal(); + else + diag = soup_item->bboxDiagonal(); + + QApplication::restoreOverrideCursor(); + + bool ok = true; + double offset_value = QInputDialog::getDouble(mw, + QString("Choose Offset Value"), + QString("Offset Value (use a negative number to compute the inset of a closed mesh)"), + 0.1 * diag, + - (std::numeric_limits::max)(), + (std::numeric_limits::max)(), 10, &ok); + if(!ok) + return; + + if(offset_value < 0 && (!sm_item || !is_closed(*(sm_item->face_graph())))) + { + QMessageBox::critical(mw, + tr("Offset Meshing"), + tr("Insetting is only possible for closed polygon meshes.")); + return; + } + + QDialog dialog(mw); + Ui::Offset_meshing_dialog ui; + ui.setupUi(&dialog); + ui.angle->setRange(1.0, 30.0); + + connect(ui.buttonBox, SIGNAL(accepted()), + &dialog, SLOT(accept())); + connect(ui.buttonBox, SIGNAL(rejected()), + &dialog, SLOT(reject())); + + ui.sizing->setRange(diag * 10e-6, diag); + ui.sizing->setValue(diag * 0.05); // default value + ui.approx->setRange(diag * 10e-7, diag); + ui.approx->setValue(diag * 0.005); + + if(polylines_item != nullptr) + { + ui.edge_sizing->setRange(diag * 10e-6, diag); + ui.edge_sizing->setValue(diag * 0.05); // default value + } + else + { + ui.edge_sizing->setEnabled(false); + } + + int i = dialog.exec(); + if(i == QDialog::Rejected) + return; + + const double angle = ui.angle->value(); + const double approx = ui.approx->value(); + const double sizing = ui.sizing->value(); + const double edge_size = (polylines_item != nullptr) ? ui.edge_sizing->value() : 0; + const int tag_index = ui.tags->currentIndex(); + + if(tag_index < 0) + return; + + QApplication::setOverrideCursor(Qt::BusyCursor); + + std::cerr << "mesh with:" + << "\n angle= " << angle + << "\n sizing= " << sizing + << "\n approx= " << approx + << "\n tag= " << tag_index + << std::boolalpha + << std::endl; + + Mesher_thread* worker = nullptr; + if(soup_item) + { + worker = new Mesher_thread(nullptr, soup_item, polylines_item, + offset_value, + angle, sizing, approx, edge_size, tag_index); + } + else + { + worker = new Mesher_thread(sm_item, nullptr, polylines_item, + offset_value, + angle, sizing, approx, edge_size, tag_index); + } + + connect(worker, &QThread::finished, + worker, &QObject::deleteLater); + + connect(worker, &Mesher_thread::resultReady, + this, [item, angle, sizing, approx, offset_value/* , index */](SMesh* offset_mesh) + { + if(!offset_mesh) + { + QApplication::restoreOverrideCursor(); + + Three::getMutex()->lock(); + Three::isLocked() = false; + Three::getMutex()->unlock(); + + return; + } + + Scene_surface_mesh_item* offset_item = new Scene_surface_mesh_item(offset_mesh); + offset_item->setName(tr("%1 offset %5 (%2 %3 %4)").arg(item->name()) + .arg(angle) + .arg(sizing) + .arg(approx) + .arg(offset_value)); + offset_item->setColor(Qt::magenta); + offset_item->setRenderingMode(Wireframe); + Three::scene()->addItem(offset_item); + + QApplication::restoreOverrideCursor(); + + Three::getMutex()->lock(); + Three::isLocked() = false; + Three::getMutex()->unlock(); + }); + + QMessageBox* message_box = new QMessageBox(QMessageBox::NoIcon, + "Meshing", + "Offset meshing in progress...", + QMessageBox::Cancel, + mw); + message_box->setDefaultButton(QMessageBox::Cancel); + QAbstractButton* cancelButton = message_box->button(QMessageBox::Cancel); + cancelButton->setText(tr("Stop")); + + connect(cancelButton, &QAbstractButton::clicked, + this, [worker](){ worker->terminate(); }); + connect(worker, &Mesher_thread::finished, + message_box, &QMessageBox::close); + + Three::getMutex()->lock(); + Three::isLocked() = true; + Three::getMutex()->unlock(); + + message_box->open(); + worker->start(); +} + +void +Polyhedron_demo_offset_meshing_plugin:: +inflate_mesh() +{ + const Scene_interface::Item_id index = scene->mainSelectionIndex(); + Scene_item* item = scene->item(index); + if(item == nullptr) + return; + + Scene_surface_mesh_item* sm_item = qobject_cast(item); + if(sm_item == nullptr) + return; + + SMesh* sMesh = sm_item->face_graph(); + if(sMesh == nullptr) + return; + + const double diag = sm_item->bboxDiagonal(); + + bool ok = true; + const double offset_value = QInputDialog::getDouble(mw, + QString("Choose Inflate Distance"), + QString("Inflate Distance (use a negative number to deflate)"), + 0.1 * diag, + -(std::numeric_limits::max)(), + (std::numeric_limits::max)(), + 10, + &ok); + if(!ok) + return; + + auto vpm = get(CGAL::vertex_point, *sMesh); + auto vnm = sMesh->property_map("v:normal").first; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + for(const auto& v : vertices(*sMesh)) + { + const EPICK::Vector_3& n = get(vnm, v); + put(vpm, v, get(vpm, v) + offset_value * n); + } + + sm_item->invalidateOpenGLBuffers(); + sm_item->itemChanged(); + sm_item->itemVisibilityChanged(); + + QApplication::restoreOverrideCursor(); +} + +#include "Offset_meshing_plugin.moc" + +#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index 9e2af43a318..89ef2123675 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -1,242 +1,141 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include "ui_Transformation_widget.h" +#include "ui_MeshOnGrid_dialog.h" -#include +#include "Scene_aff_transformed_item.h" +#include "Scene_aff_transformed_point_set_item.h" +#include "Scene_aff_transformed_polygon_soup_item.h" +#include "Scene_aff_transformed_surface_mesh_item.h" +#include "Scene_points_with_normal_item.h" +#include "Scene_polygon_soup_item.h" #include "Scene_surface_mesh_item.h" -#include "Scene_facegraph_transform_item.h" -#include "Scene_points_with_normal_item.h" -#include "Scene_polylines_item.h" +#include +#include +#include +#include + +#include +#include -#include #include -#include -#include -#include -#include #include +#include +#include #include +#include #include +#include +#include -#include "ui_Transformation_widget.h" +#include +#include +#include +#include using namespace CGAL::Three; -typedef Viewer_interface Vi; -typedef Point_container Pc; -#include "ui_MeshOnGrid_dialog.h" -typedef Scene_surface_mesh_item Facegraph_item; +typedef Scene_surface_mesh_item::Face_graph FaceGraph; - -class Scene_transform_point_set_item : public Scene_item_rendering_helper +class GridDialog + : public QDialog, + public Ui::GridDialog { Q_OBJECT - typedef Point_set_3 Point_set; + public: - Scene_transform_point_set_item(Scene_points_with_normal_item *item, const CGAL::qglviewer::Vec& pos) - : base(item), - center_(pos), - frame(new CGAL::Three::Scene_item::ManipulatedFrame()) + explicit GridDialog(QWidget* = nullptr) { - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - frame->setPosition(pos+offset); - Point_set ps= *item->point_set(); - const Kernel::Point_3& p = ps.point(*(ps.begin())); - CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z()); - CGAL::cpp98::random_shuffle (ps.begin(), ps.end()); - points.reserve(3*ps.size()); - for (Point_set::const_iterator it = ps.begin(); it != ps.first_selected(); it++) - { - const Kernel::Point_3& p = ps.point(*it); - bbox = bbox + p.bbox(); - points.push_back(p.x()-center_.x); - points.push_back(p.y()-center_.y); - points.push_back(p.z()-center_.z); - } - setPointContainer(0, new Pc(Vi::PROGRAM_NO_SELECTION, false)); - setBbox(Bbox(bbox.xmin(),bbox.ymin(),bbox.zmin(), - bbox.xmax(),bbox.ymax(),bbox.zmax())); - - nb_points = points.size(); - for(auto v : CGAL::QGLViewer::QGLViewerPool()) - { - CGAL::Three::Viewer_interface* viewer = static_cast(v); - initGL(viewer); - } - Pc* pc = getPointContainer(0); - pc->allocate(Pc::Vertices, - points.data(), - static_cast(points.size()*sizeof(float))); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) - initializeBuffers(qobject_cast(v)); + setupUi(this); } - - void initializeBuffers(Viewer_interface *v) const - { - Pc* pc = getPointContainer(0); - pc->initializeBuffers(v); - pc->setFlatDataSize(nb_points); - points.clear(); - points.shrink_to_fit(); - } - bool manipulatable() const { return true; } - - Scene_item* clone()const{ return nullptr; } - - bool supportsRenderingMode(RenderingMode m) const { return m==Points ; } - - QString toolTip() const { - return QObject::tr("

    Affine transformation of %1

    " - "

    Keep Ctrl pressed and use the arcball to define an affine transformation.
    " - "Press S to apply the affine transformation to a copy of %1.

    ") - .arg(getBase()->name()); - } - - void setFMatrix(double matrix[16]) - { - for (int i=0; i<16; ++i) - f_matrix.data()[i] = (float)matrix[i]; - } - - ~Scene_transform_point_set_item() {delete frame; Q_EMIT killed(); } - void drawPoints(Viewer_interface *viewer) const - { - GLfloat point_size; - viewer->glGetFloatv(GL_POINT_SIZE, &point_size); - viewer->setGlPointSize(6.f); - double ratio_displayed = 1.0; - if ((viewer->inFastDrawing () || frame->isManipulated()) && - (nb_points /3 > 300000)) // arbitrary large value - ratio_displayed = 3 * 300000. / (double)nb_points; - - Pc* pc = getPointContainer(0); - std::size_t real_size = pc->getFlatDataSize(); - pc->setFlatDataSize(ratio_displayed * real_size); - pc->setColor(QColor(Qt::green)); - pc->setFrameMatrix(f_matrix); - pc->draw(viewer, true); - pc->setFlatDataSize(real_size); - } - bool keyPressEvent(QKeyEvent* e){ - if (e->key()==Qt::Key_S){ - Q_EMIT stop(); - return true; - } - return false; - } - const Scene_points_with_normal_item* getBase()const{return base;} - const CGAL::qglviewer::Vec& center() const { return center_; } - CGAL::Three::Scene_item::ManipulatedFrame* manipulatedFrame() { return frame; } - void compute_bbox() const - { - Point_set ps= *base->point_set(); - const Kernel::Point_3& p = ps.point(*(ps.begin())); - CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z()); - - for (Point_set::const_iterator it = ps.begin(); it != ps.first_selected(); it++) - { - bbox = bbox + ps.point(*it).bbox(); - } - CGAL::qglviewer::Vec v_min(bbox.xmin(),bbox.ymin(),bbox.zmin()); - CGAL::qglviewer::Vec v_max(bbox.xmax(),bbox.ymax(),bbox.zmax()); - - setBbox(Bbox(v_min.x,v_min.y,v_min.z, - v_max.x,v_max.y,v_max.z)); - } - bool isEmpty() const{return false;} -Q_SIGNALS: - void stop(); - void killed(); -private: - const Scene_points_with_normal_item* base; - CGAL::qglviewer::Vec center_; - CGAL::Three::Scene_item::ManipulatedFrame* frame; - mutable std::vector points; - std::size_t nb_points; - QMatrix4x4 f_matrix; - }; -using namespace CGAL::Three; -class Polyhedron_demo_affine_transform_plugin : - public QObject, +class Polyhedron_demo_affine_transform_plugin + : public QObject, public Polyhedron_demo_plugin_helper { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + enum class Item_type { UNKNOWN, POINT_SET, POLYGON_SOUP, POLYGON_MESH }; + using Generic_scene_aff_transformed_item = Scene_aff_transformed_item; // just for clarity + +private: + CGAL::Three::Scene_interface* scene = nullptr; + + QDockWidget* dockWidget = nullptr; + Ui::TransformationWidget ui; + + QAction* actionTransformItem = nullptr; + QAction* actionGenerateItemGrid = nullptr; + + Generic_scene_aff_transformed_item* aff_transformed_item = nullptr; + Item_type aff_transformed_item_type = Item_type::UNKNOWN; + + double scaling[3]; + double lastScaling[3]; + QMatrix4x4 lastMatrix; + public: - - Polyhedron_demo_affine_transform_plugin():started(false){} - - QList actions() const { - return QList() << actionTransformPolyhedron - << actionMeshOnGrid; + QList actions() const + { + return QList() << actionTransformItem + << actionGenerateItemGrid; } - bool applicable(QAction* a) const { - if(a == actionMeshOnGrid) - { - return qobject_cast(scene->item(scene->mainSelectionIndex())); - } - else - return qobject_cast(scene->item(scene->mainSelectionIndex())) - || qobject_cast(scene->item(scene->mainSelectionIndex())) - || qobject_cast(scene->item(scene->mainSelectionIndex())) - || qobject_cast(scene->item(scene->mainSelectionIndex())); + bool started() const + { + return (aff_transformed_item != nullptr); } - void init(QMainWindow* _mw, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { - for(int i=0; i<3; ++i) - { - scaling[i] = 1; - lastScaling[i] = 1 ; - } - lastMatrix.setToIdentity(); + bool applicable(QAction* a) const + { + // do not allow multiple transformations at the same time + if(started()) + return false; + + // only meshes for the grid, for now + if(a == actionGenerateItemGrid) + return qobject_cast(scene->item(scene->mainSelectionIndex())); + + return qobject_cast(scene->item(scene->mainSelectionIndex())) + || qobject_cast(scene->item(scene->mainSelectionIndex())) + || qobject_cast(scene->item(scene->mainSelectionIndex())); + } + + void init(QMainWindow* _mw, + CGAL::Three::Scene_interface* scene_interface, + Messages_interface*) + { mw = _mw; this->scene = scene_interface; - actionMeshOnGrid = new QAction( - tr("Create a Grid of Surface Meshes") - , mw); - if(actionMeshOnGrid) { - connect(actionMeshOnGrid, SIGNAL(triggered()),this, SLOT(grid())); - } + actionGenerateItemGrid = new QAction(tr("Create a Grid of Surface Meshes"), mw); + if(actionGenerateItemGrid) + connect(actionGenerateItemGrid, SIGNAL(triggered()),this, SLOT(generateItemGrid())); - actionTransformPolyhedron = new QAction( - tr("Affine Transformation") - , mw); - if(actionTransformPolyhedron) { - connect(actionTransformPolyhedron, SIGNAL(triggered()),this, SLOT(go())); - } - transform_item = nullptr; - transform_points_item = nullptr; + actionTransformItem = new QAction(tr("Affine Transformation"), mw); + if(actionTransformItem) + connect(actionTransformItem, SIGNAL(triggered()), this, SLOT(transformItem())); - dock_widget = new QDockWidget( - tr("Affine Transformation") - , mw); - ui.setupUi(dock_widget); - dock_widget->setWindowTitle(tr( - "Affine Transformation" - )); - addDockWidget(dock_widget); - dock_widget->hide(); + dockWidget = new QDockWidget(tr("Affine Transformation"), mw); + ui.setupUi(dockWidget); + dockWidget->setWindowTitle(tr("Affine Transformation")); + addDockWidget(dockWidget); + dockWidget->hide(); QList lineEdits; - lineEdits<sizePolicy(); sp_retain.setRetainSizeWhenHidden(true); widget->setSizePolicy(sp_retain); } + + // initial state is Translation: no need for this one + ui.lineEditA->hide(); + connect(ui.applyTransfo_Button, &QPushButton::clicked, this, &Polyhedron_demo_affine_transform_plugin::applySingleTransformation); connect(ui.transfo_ComboBox, SIGNAL(currentIndexChanged(int)), @@ -249,575 +148,583 @@ public: this, &Polyhedron_demo_affine_transform_plugin::undo); connect(ui.validatePushButton, &QPushButton::clicked, this, &Polyhedron_demo_affine_transform_plugin::end); - //initial state is Translation: no need for this one - ui.lineEditA->hide(); + + std::fill(std::begin(scaling), std::end(scaling), 1.); + std::fill(std::begin(lastScaling), std::end(lastScaling), 1.); + lastMatrix.setToIdentity(); + + resetTransformedItem(); } - void start(FaceGraph *facegraph, const QString name, const Scene_item::Bbox&); - void start(Scene_points_with_normal_item*); + template + void start(SceneItem*); + + void endPointSet(const QMatrix4x4& transform_matrix); + void endPolygonSoup(const QMatrix4x4& transform_matrix); + void endPolygonMesh(const QMatrix4x4& transform_matrix); void end(); + void closure() { - dock_widget->hide(); + dockWidget->hide(); } private: - QDockWidget* dock_widget; - Ui::TransformationWidget ui; - QAction* actionTransformPolyhedron; - QAction* actionMeshOnGrid; - Scene_facegraph_transform_item* transform_item; - Scene_transform_point_set_item* transform_points_item; - CGAL::Three::Scene_interface::Item_id tr_item_index; - CGAL::Three::Scene_interface* scene; - bool started; - double scaling[3]; - double lastScaling[3]; - QMatrix4x4 lastMatrix; + void transformMatrix(double* /*double[16]*/) const; - //takes a double[16] - void transformMatrix( double* res)const - { - bool is_point_set = false; - if(!transform_item) - { - if(transform_points_item) - is_point_set = true; - } + void normalize(); - QMatrix4x4 tMatrix, manipulatedMatrix, scalingMatrix; - if(!is_point_set) - for(int i=0; i<16; ++i) - { - manipulatedMatrix.data()[i] = transform_item->manipulatedFrame()->matrix()[i]; - scalingMatrix.data()[i] = 0; - } - else - for(int i=0; i<16; ++i) - { - manipulatedMatrix.data()[i] = transform_points_item->manipulatedFrame()->matrix()[i]; - scalingMatrix.data()[i] = 0; - } - scalingMatrix.data()[0] = scaling[0]; - scalingMatrix.data()[5] = scaling[1]; - scalingMatrix.data()[10] = scaling[2]; - scalingMatrix.data()[15] = 1; - tMatrix = manipulatedMatrix*scalingMatrix; - for(int i=0; i<16; ++i) - res[i] = (double)tMatrix.data()[i]; - } - template - void normalize(Item*); public Q_SLOTS: - void grid(); - void go(); - void transformed_killed(); + void generateItemGrid(); + void transformItem(); + + void killTransformedItem() + { + if(aff_transformed_item) + scene->erase(scene->item_id(aff_transformed_item)); + } void updateUiMatrix(); + + void resetTransformMatrix(); + + void updateSingleTransfoValues(int); + + void applySingleTransformation(); + + void resetTransformedItem() + { + aff_transformed_item = nullptr; + } + void clear() { - ui.lineEditA->clear(); - ui.lineEditX->clear(); - ui.lineEditY->clear(); - ui.lineEditZ->clear(); + ui.lineEditA->clear(); + ui.lineEditX->clear(); + ui.lineEditY->clear(); + ui.lineEditZ->clear(); } - void resetTransformMatrix() - { - bool is_point_set = false; - if(!transform_item) - { - if(transform_points_item) - is_point_set = true; - else - return; - } - double matrix[16] = {0}; - scaling[0]=scaling[1]=scaling[2]=1.0; - matrix[0]=1; matrix[5] = 1; matrix[10] = 1; matrix[15] = 1; - matrix[12] = is_point_set ? transform_points_item->center().x : transform_item->center().x; - matrix[13] = is_point_set ? transform_points_item->center().y : transform_item->center().y; - matrix[14] = is_point_set ? transform_points_item->center().z : transform_item->center().z; - if(!is_point_set) - { - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - transform_item->manipulatedFrame()->setFromMatrix(matrix); - transform_item->manipulatedFrame()->translate(offset); - transform_item->itemChanged(); - } - else - { - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - transform_points_item->manipulatedFrame()->setFromMatrix(matrix); - transform_points_item->manipulatedFrame()->translate(offset); - transform_points_item->itemChanged(); - } - } - void updateSingleTransfoValues(int); - void applySingleTransformation(); - void resetItems() - { - transform_item = nullptr; - transform_points_item = nullptr; - } void undo() { - bool is_point_set = false; - if(!transform_item) - { - if(transform_points_item) - is_point_set = true; - else - return; - } + if(!started()) + return; double matrix[16]; for(short i = 0; i<16; ++i) - matrix[i] = (double)lastMatrix.data()[i]; + matrix[i] = double(lastMatrix.data()[i]); for(short i = 0; i< 3; ++i) scaling[i] = lastScaling[i]; - if(!is_point_set) - { - transform_item->manipulatedFrame()->setFromMatrix(matrix); - transform_item->itemChanged(); - } - else - { - transform_points_item->manipulatedFrame()->setFromMatrix(matrix); - transform_points_item->itemChanged(); - } - } - -}; // end class Polyhedron_demo_affine_transform_plugin - -class GridDialog : - public QDialog, - public Ui::GridDialog -{ - Q_OBJECT -public: - GridDialog(QWidget* =nullptr) - { - setupUi(this); + aff_transformed_item->manipulatedFrame()->setFromMatrix(matrix); + aff_transformed_item->itemChanged(); } }; -void Polyhedron_demo_affine_transform_plugin::grid() +void +Polyhedron_demo_affine_transform_plugin:: +transformMatrix(double* res) const { - Facegraph_item* item = - qobject_cast(scene->item(scene->mainSelectionIndex())); - if(!item) - return; - - - FaceGraph m = *item->face_graph(); - - Scene_item::Bbox b = item->bbox(); - - - double x_t(1.001*((b.max)(0)- (b.min)(0))), - y_t(1.001*((b.max)(1)- (b.min)(1))), - z_t(1.001*((b.max)(2)- (b.min)(2))); - - GridDialog dialog(mw); - dialog.x_space_doubleSpinBox->setValue(x_t); - dialog.y_space_doubleSpinBox->setValue(y_t); - dialog.z_space_doubleSpinBox->setValue(z_t); - if(!dialog.exec()) - return; - QApplication::setOverrideCursor(Qt::WaitCursor); - int i_max=dialog.x_spinBox->value(), - j_max=dialog.y_spinBox->value(), - k_max=dialog.z_spinBox->value(); - x_t = dialog.x_space_doubleSpinBox->value(); - y_t = dialog.y_space_doubleSpinBox->value(); - z_t = dialog.z_space_doubleSpinBox->value(); - bool single = dialog.singleItemCheckBox->isChecked(); - Facegraph_item* t_item = nullptr; - if(single) - { - t_item = new Facegraph_item(); - t_item->setName(tr("%1 %2x%3x%4") - .arg(item->name()) - .arg(i_max) - .arg(j_max) - .arg(k_max)); - scene->addItem(t_item); - } - for(int i = 0; i < i_max; ++i) - { - for(int j = 0; j< j_max; ++j) - { - for(int k = 0; k< k_max; ++k) - { - FaceGraph e; - CGAL::copy_face_graph(m,e); - Kernel::Aff_transformation_3 trans(CGAL::TRANSLATION, Kernel::Vector_3(i*x_t,j*y_t,k*z_t)); - CGAL::Polygon_mesh_processing::transform(trans, e); - if(!single) - { - t_item = new Facegraph_item(e); - t_item->setName(tr("%1 %2,%3,%4") - .arg(item->name()) - .arg(i) - .arg(j) - .arg(k)); - scene->addItem(t_item); - } - else - { - CGAL::copy_face_graph(e, *t_item->face_graph()); - } - } - } - } - if(single && t_item) - t_item->invalidateOpenGLBuffers(); - QApplication::restoreOverrideCursor(); -} -void Polyhedron_demo_affine_transform_plugin::go(){ - if (!started){ - Scene_item* item = scene->item(scene->mainSelectionIndex()); - Scene_points_with_normal_item* points_item = nullptr; - Facegraph_item* poly_item = qobject_cast(item); - if(!poly_item) - { - points_item = qobject_cast(item); - if(!points_item) - return; - } - dock_widget->show(); - dock_widget->raise(); - started=true; - actionTransformPolyhedron->setText("Apply affine transformation"); - if(poly_item) - { - start(poly_item->polyhedron(), poly_item->name(), poly_item->bbox()); - } - else if(points_item) - start(points_item); - ui.validatePushButton->setEnabled(true); - } - else - end(); -} - -void Polyhedron_demo_affine_transform_plugin::transformed_killed(){ - started=false; - actionTransformPolyhedron->setText("Affine Transformation"); -} - -void Polyhedron_demo_affine_transform_plugin::start(FaceGraph *facegraph, const QString name, const Scene_item::Bbox &bbox){ - QApplication::setOverrideCursor(Qt::PointingHandCursor); - - double x=(bbox.xmin()+bbox.xmax())/2; - double y=(bbox.ymin()+bbox.ymax())/2; - double z=(bbox.zmin()+bbox.zmax())/2; - lastMatrix.setToIdentity(); - lastMatrix.data()[12] = x; - lastMatrix.data()[13] = y; - lastMatrix.data()[14] = z; - transform_item = new Scene_facegraph_transform_item(CGAL::qglviewer::Vec(x,y,z),facegraph, name); - connect(transform_item, &Scene_item::aboutToBeDestroyed, - [](){ QApplication::restoreOverrideCursor(); }); - transform_item->setManipulatable(true); - transform_item->setColor(Qt::green); - transform_item->setRenderingMode(Wireframe); - transform_item->setName(tr("Affine Transformation")); - scaling[0] = 1; - scaling[1] = 1; - scaling[2] = 1; - connect(transform_item, SIGNAL(stop()),this, SLOT(go())); - connect(transform_item, SIGNAL(killed()),this, SLOT(transformed_killed())); - connect(transform_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, - this, &Polyhedron_demo_affine_transform_plugin::updateUiMatrix); - connect(transform_item, &Scene_facegraph_transform_item::aboutToBeDestroyed, - dock_widget, &QDockWidget::hide); - connect(transform_item, &Scene_facegraph_transform_item::aboutToBeDestroyed, - this, &Polyhedron_demo_affine_transform_plugin::resetItems); - tr_item_index=scene->addItem(transform_item); - scene->setSelectedItem(tr_item_index); - resetTransformMatrix(); -} - -void Polyhedron_demo_affine_transform_plugin::start(Scene_points_with_normal_item* points_item){ - QApplication::setOverrideCursor(Qt::PointingHandCursor); - - Scene_points_with_normal_item::Bbox bbox = points_item->bbox(); - double x=(bbox.xmin()+bbox.xmax())/2; - double y=(bbox.ymin()+bbox.ymax())/2; - double z=(bbox.zmin()+bbox.zmax())/2; - lastMatrix.setToIdentity(); - lastMatrix.data()[12] = x; - lastMatrix.data()[13] = y; - lastMatrix.data()[14] = z; - - transform_points_item = new Scene_transform_point_set_item(points_item,CGAL::qglviewer::Vec(x,y,z)); - connect(transform_points_item, &Scene_item::aboutToBeDestroyed, - [](){ QApplication::restoreOverrideCursor(); }); - transform_points_item->setRenderingMode(Points); - transform_points_item->setName(tr("Affine Transformation")); - connect(transform_points_item, SIGNAL(stop()),this, SLOT(go())); - connect(transform_points_item, SIGNAL(killed()),this, SLOT(transformed_killed())); - connect(transform_points_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, - this, &Polyhedron_demo_affine_transform_plugin::updateUiMatrix); - connect(transform_points_item, &Scene_transform_point_set_item::aboutToBeDestroyed, - dock_widget, &QDockWidget::hide); - connect(transform_points_item, &Scene_transform_point_set_item::aboutToBeDestroyed, - this, &Polyhedron_demo_affine_transform_plugin::resetItems); - tr_item_index=scene->addItem(transform_points_item); - scene->setSelectedItem(tr_item_index); - resetTransformMatrix(); -} - - -void Polyhedron_demo_affine_transform_plugin::end(){ - ui.validatePushButton->setEnabled(false); - QApplication::restoreOverrideCursor(); - double matrix[16]; - transformMatrix(&matrix[0]); - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - matrix[12]-=offset.x; - matrix[13]-=offset.y; - matrix[14]-=offset.z; - resetTransformMatrix(); - QMatrix4x4 transform_matrix; + QMatrix4x4 manipulatedMatrix, scalingMatrix; for(int i=0; i<16; ++i) - transform_matrix.data()[i] = (float)matrix[i]; - - if(transform_item) { - CGAL::qglviewer::Vec c = transform_item->center(); - FaceGraph* new_sm = new FaceGraph(); - CGAL::copy_face_graph(*transform_item->getFaceGraph(), *new_sm); - typedef boost::property_map::type VPmap; - VPmap vpmap = get(CGAL::vertex_point, *new_sm); - - for (boost::graph_traits::vertex_iterator it=vertices(*new_sm).begin(), - endit=vertices(*new_sm).end();endit!=it;++it) - { - QVector3D vec = transform_matrix * QVector3D(get(vpmap, *it).x() - c.x, - get(vpmap, *it).y() - c.y, - get(vpmap, *it).z() - c.z); - - put(vpmap, *it, Kernel::Point_3 (vec.x(), vec.y(), vec.z())); - } - Facegraph_item* new_item=new Facegraph_item(new_sm); - new_item->setName(tr("%1_transformed").arg(transform_item->name())); - scene->replaceItem(tr_item_index,new_item); - delete transform_item; - transform_item = nullptr; + manipulatedMatrix.data()[i] = aff_transformed_item->manipulatedFrame()->matrix()[i]; + scalingMatrix.data()[i] = 0; } - else if(transform_points_item) - { - Scene_points_with_normal_item* new_item - = new Scene_points_with_normal_item (*(transform_points_item->getBase())); - Point_set* new_ps = new_item->point_set(); - CGAL::qglviewer::Vec c = transform_points_item->center(); - for(Point_set::Index idx : *new_ps) - { - QVector3D vec = transform_matrix * QVector3D(new_ps->point(idx).x() - c.x, - new_ps->point(idx).y() - c.y, - new_ps->point(idx).z() - c.z); - new_ps->point(idx) = Kernel::Point_3 (vec.x(), vec.y(), vec.z()); - } + scalingMatrix.data()[0] = scaling[0]; + scalingMatrix.data()[5] = scaling[1]; + scalingMatrix.data()[10] = scaling[2]; + scalingMatrix.data()[15] = 1.; - new_item->setName(tr("%1_transformed").arg(transform_points_item->getBase()->name())); - scene->replaceItem(tr_item_index,new_item); - delete transform_points_item; - transform_points_item = nullptr; - } - dock_widget->hide(); - QApplication::restoreOverrideCursor(); + QMatrix4x4 tMatrix = manipulatedMatrix * scalingMatrix; + for(int i=0; i<16; ++i) + res[i] = double(tMatrix.data()[i]); } -void Polyhedron_demo_affine_transform_plugin::updateUiMatrix() +void +Polyhedron_demo_affine_transform_plugin:: +updateUiMatrix() { - bool is_point_set = false; - if(!transform_item) - { - if(transform_points_item) - is_point_set = true; - else - return; - } + if(!started()) + return; + double tmatrix[16]; transformMatrix(&tmatrix[0]); - if(is_point_set) - transform_points_item->setFMatrix(tmatrix); - else - transform_item->setFMatrix(tmatrix); - //this matrix is not mandatory but it clarifies the code to use one. - QMatrix4x4 matrix; - for (int i=0; i<16; ++i) - matrix.data()[i] = tmatrix[i]; - if(!is_point_set) - { - matrix(0,3) -= transform_item->center().x; - matrix(1,3) -= transform_item->center().y; - matrix(2,3) -= transform_item->center().z; - } - else - { - matrix(0,3) -= transform_points_item->center().x; - matrix(1,3) -= transform_points_item->center().y; - matrix(2,3) -= transform_points_item->center().z; - } - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - matrix.data()[12]-=offset.x; - matrix.data()[13]-=offset.y; - matrix.data()[14]-=offset.z; - ui.matrix_00->setText(QString("%1").arg(matrix(0,0))); ui.matrix_01->setText(QString("%1").arg(matrix(0,1))); ui.matrix_02->setText(QString("%1").arg(matrix(0,2))); ui.matrix_03->setText(QString("%1").arg(matrix(0,3))); - ui.matrix_10->setText(QString("%1").arg(matrix(1,0))); ui.matrix_11->setText(QString("%1").arg(matrix(1,1))); ui.matrix_12->setText(QString("%1").arg(matrix(1,2))); ui.matrix_13->setText(QString("%1").arg(matrix(1,3))); - ui.matrix_20->setText(QString("%1").arg(matrix(2,0))); ui.matrix_21->setText(QString("%1").arg(matrix(2,1))); ui.matrix_22->setText(QString("%1").arg(matrix(2,2))); ui.matrix_23->setText(QString("%1").arg(matrix(2,3))); - ui.matrix_30->setText(QString("%1").arg(matrix(3,0))); ui.matrix_31->setText(QString("%1").arg(matrix(3,1))); ui.matrix_32->setText(QString("%1").arg(matrix(3,2))); ui.matrix_33->setText(QString("%1").arg(matrix(3,3))); + aff_transformed_item->setFMatrix(tmatrix); + // this matrix is not mandatory but it clarifies the code to use one. + QMatrix4x4 matrix; + for(int i=0; i<16; ++i) + matrix.data()[i] = tmatrix[i]; + + matrix(0,3) -= aff_transformed_item->center().x; + matrix(1,3) -= aff_transformed_item->center().y; + matrix(2,3) -= aff_transformed_item->center().z; + + const CGAL::qglviewer::Vec& offset = Three::mainViewer()->offset(); + + matrix.data()[12] -= offset.x; + matrix.data()[13] -= offset.y; + matrix.data()[14] -= offset.z; + + ui.matrix_00->setText(QString("%1").arg(matrix(0,0))); + ui.matrix_01->setText(QString("%1").arg(matrix(0,1))); + ui.matrix_02->setText(QString("%1").arg(matrix(0,2))); + ui.matrix_03->setText(QString("%1").arg(matrix(0,3))); + + ui.matrix_10->setText(QString("%1").arg(matrix(1,0))); + ui.matrix_11->setText(QString("%1").arg(matrix(1,1))); + ui.matrix_12->setText(QString("%1").arg(matrix(1,2))); + ui.matrix_13->setText(QString("%1").arg(matrix(1,3))); + + ui.matrix_20->setText(QString("%1").arg(matrix(2,0))); + ui.matrix_21->setText(QString("%1").arg(matrix(2,1))); + ui.matrix_22->setText(QString("%1").arg(matrix(2,2))); + ui.matrix_23->setText(QString("%1").arg(matrix(2,3))); + + ui.matrix_30->setText(QString("%1").arg(matrix(3,0))); + ui.matrix_31->setText(QString("%1").arg(matrix(3,1))); + ui.matrix_32->setText(QString("%1").arg(matrix(3,2))); + ui.matrix_33->setText(QString("%1").arg(matrix(3,3))); } -void Polyhedron_demo_affine_transform_plugin::updateSingleTransfoValues(int index) +void +Polyhedron_demo_affine_transform_plugin:: +resetTransformMatrix() +{ + if(!started()) + return; + + scaling[0] = scaling[1] = scaling[2] = 1.; + + double matrix[16] = {0}; + matrix[0] = 1.; + matrix[5] = 1.; + matrix[10] = 1.; + matrix[15] = 1.; + matrix[12] = aff_transformed_item->center().x; + matrix[13] = aff_transformed_item->center().y; + matrix[14] = aff_transformed_item->center().z; + + const CGAL::qglviewer::Vec& offset = Three::mainViewer()->offset(); + aff_transformed_item->manipulatedFrame()->setFromMatrix(matrix); + aff_transformed_item->manipulatedFrame()->translate(offset); + aff_transformed_item->itemChanged(); +} + +void +Polyhedron_demo_affine_transform_plugin:: +updateSingleTransfoValues(int index) { ui.lineEditZ->setToolTip("Value along the z-axis."); switch(index) { - case 0: - ui.lineEditA->show(); - ui.lineEditX->show(); - ui.lineEditY->show(); - ui.lineEditZ->show(); - ui.transfo_ComboBox->setToolTip("Angle, axis coordinates"); - break; - case 1: - ui.lineEditA->hide(); - ui.lineEditX->show(); - ui.lineEditY->show(); - ui.lineEditZ->show(); - ui.transfo_ComboBox->setToolTip("Axis coordinates"); - break; - case 2: - ui.lineEditA->hide(); - ui.lineEditX->show(); - ui.lineEditY->show(); - ui.lineEditZ->show(); - ui.transfo_ComboBox->setToolTip("Scaling along each axis"); - break; - default: - ui.lineEditA->hide(); - ui.lineEditX->hide(); - ui.lineEditY->hide(); - ui.lineEditZ->hide(); - ui.transfo_ComboBox->setToolTip("Scales coordinates between [0..1] "); - break; + case 0: + ui.lineEditA->show(); + ui.lineEditX->show(); + ui.lineEditY->show(); + ui.lineEditZ->show(); + ui.transfo_ComboBox->setToolTip("Angle, axis coordinates"); + break; + case 1: + ui.lineEditA->hide(); + ui.lineEditX->show(); + ui.lineEditY->show(); + ui.lineEditZ->show(); + ui.transfo_ComboBox->setToolTip("Axis coordinates"); + break; + case 2: + ui.lineEditA->hide(); + ui.lineEditX->show(); + ui.lineEditY->show(); + ui.lineEditZ->show(); + ui.transfo_ComboBox->setToolTip("Scaling along each axis"); + break; + default: + ui.lineEditA->hide(); + ui.lineEditX->hide(); + ui.lineEditY->hide(); + ui.lineEditZ->hide(); + ui.transfo_ComboBox->setToolTip("Scales coordinates between [0...1] "); + break; } } -template -void Polyhedron_demo_affine_transform_plugin::normalize(Item* item) +void +Polyhedron_demo_affine_transform_plugin:: +applySingleTransformation() { - Kernel::Point_3 bil(item->bbox().xmin(), - item->bbox().ymin(), - item->bbox().zmin()); + if(!started()) + return; + + // save the matrix before the change + for(short i=0; i<3; ++i) + lastScaling[i] = scaling[i]; - Kernel::Point_3 tsr(item->bbox().xmax(), - item->bbox().ymax(), - item->bbox().zmax()); - //Get the scale factor for the item's coordinates to be in [0..1] - double max = (std::max)((double)tsr.x()-bil.x(), (double)tsr.y()-bil.y()); - max = (std::max)(max, (double)tsr.z()-bil.z()); - QVector3D v_bil= QVector3D(bil.x(),bil.y(),bil.z()); - QMatrix4x4 frameMat = QMatrix(); - QVector3D center(item->center().x, - item->center().y, - item->center().z); - frameMat.translate(-(v_bil-center)/max); - double d_mat[16]; - for(int i=0; i<16; ++i) - d_mat[i] = (double)frameMat.data()[i]; - scaling[0]=scaling[1]=scaling[2]=1.0/max; - item->manipulatedFrame()->setFromMatrix(d_mat); -} -void Polyhedron_demo_affine_transform_plugin::applySingleTransformation() -{ - bool is_point_set = false; - if(!transform_item) - { - if(transform_points_item) - is_point_set = true; - else - return; - } - //save the matrix before the change - for(short i = 0; i<3; ++i) - lastScaling[i]=scaling[i]; double currentMatrix[16]; transformMatrix(¤tMatrix[0]); for(short i = 0; i < 16; ++i) - lastMatrix.data()[i] = (float)currentMatrix[i]; + lastMatrix.data()[i] = float(currentMatrix[i]); switch(ui.transfo_ComboBox->currentIndex()) { - //rotation - case 0: - { - CGAL::qglviewer::Vec axis(ui.lineEditX->text().toDouble(), - ui.lineEditY->text().toDouble(), - ui.lineEditZ->text().toDouble()); + // rotation + case 0: + { + CGAL::qglviewer::Vec axis(ui.lineEditX->text().toDouble(), + ui.lineEditY->text().toDouble(), + ui.lineEditZ->text().toDouble()); - if(!is_point_set) - transform_item->manipulatedFrame()->rotate(CGAL::qglviewer::Quaternion(axis, ui.lineEditA->text().toDouble()*CGAL_PI/180.0)); - else - transform_points_item->manipulatedFrame()->rotate(CGAL::qglviewer::Quaternion(axis, ui.lineEditA->text().toDouble()*CGAL_PI/180.0)); - break; - } - //translation - case 1: - { - if(!is_point_set) - transform_item->manipulatedFrame()->translate(CGAL::qglviewer::Vec(ui.lineEditX->text().toDouble() , - ui.lineEditY->text().toDouble() , - ui.lineEditZ->text().toDouble() )); - else - transform_points_item->manipulatedFrame()->translate(CGAL::qglviewer::Vec(ui.lineEditX->text().toDouble() , - ui.lineEditY->text().toDouble() , - ui.lineEditZ->text().toDouble() )); - break; - } - //scaling - case 2: - { - scaling[0] = ui.lineEditX->text().isEmpty() ? 1 : scaling[0]*ui.lineEditX->text().toDouble(); - scaling[1] = ui.lineEditY->text().isEmpty() ? 1 : scaling[1]*ui.lineEditY->text().toDouble(); - scaling[2] = ui.lineEditZ->text().isEmpty() ? 1 : scaling[2]*ui.lineEditZ->text().toDouble(); - break; - } - //normalizing - case 3: - { - resetTransformMatrix(); - if(!is_point_set) - normalize(transform_item); - else - normalize(transform_points_item); - break; - } - default: - { - break; - } + aff_transformed_item->manipulatedFrame()->rotate(CGAL::qglviewer::Quaternion(axis, ui.lineEditA->text().toDouble()*CGAL_PI/180.0)); + + break; + } + // translation + case 1: + { + aff_transformed_item->manipulatedFrame()->translate(CGAL::qglviewer::Vec(ui.lineEditX->text().toDouble() , + ui.lineEditY->text().toDouble() , + ui.lineEditZ->text().toDouble())); + + break; + } + // scaling + case 2: + { + scaling[0] = ui.lineEditX->text().isEmpty() ? 1. : scaling[0]*ui.lineEditX->text().toDouble(); + scaling[1] = ui.lineEditY->text().isEmpty() ? 1. : scaling[1]*ui.lineEditY->text().toDouble(); + scaling[2] = ui.lineEditZ->text().isEmpty() ? 1. : scaling[2]*ui.lineEditZ->text().toDouble(); + break; + } + // normalizing + case 3: + { + resetTransformMatrix(); + normalize(); + break; + } + default: + { + break; + } } + updateUiMatrix(); - if(is_point_set) + + aff_transformed_item->compute_bbox(); + aff_transformed_item->itemChanged(); +} + +void +Polyhedron_demo_affine_transform_plugin:: +normalize() +{ + // Get the scale factor for the item's coordinates to be in [0..1] + double max = (std::max)({ aff_transformed_item->bbox().x_span(), + aff_transformed_item->bbox().y_span(), + aff_transformed_item->bbox().z_span() }); + QVector3D v_bil = QVector3D(aff_transformed_item->bbox().xmin(), + aff_transformed_item->bbox().ymin(), + aff_transformed_item->bbox().zmin()); + QMatrix4x4 frameMat = QMatrix(); + QVector3D center(aff_transformed_item->center().x, + aff_transformed_item->center().y, + aff_transformed_item->center().z); + frameMat.translate(-(v_bil - center) / max); + double d_mat[16]; + for(int i=0; i<16; ++i) + d_mat[i] = double(frameMat.data()[i]); + + scaling[0] = scaling[1] = scaling[2] = 1. / max; + aff_transformed_item->manipulatedFrame()->setFromMatrix(d_mat); +} + +void +Polyhedron_demo_affine_transform_plugin:: +generateItemGrid() +{ + Scene_surface_mesh_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); + if(!item) + return; + + const FaceGraph& sm = *item->face_graph(); + const Scene_item::Bbox& b = item->bbox(); + + double x_t(1.001 * ((b.max)(0)- (b.min)(0))), + y_t(1.001 * ((b.max)(1)- (b.min)(1))), + z_t(1.001 * ((b.max)(2)- (b.min)(2))); + + GridDialog dialog(mw); + dialog.x_space_doubleSpinBox->setValue(x_t); + dialog.y_space_doubleSpinBox->setValue(y_t); + dialog.z_space_doubleSpinBox->setValue(z_t); + + if(!dialog.exec()) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + int i_max = dialog.x_spinBox->value(), + j_max = dialog.y_spinBox->value(), + k_max = dialog.z_spinBox->value(); + + x_t = dialog.x_space_doubleSpinBox->value(); + y_t = dialog.y_space_doubleSpinBox->value(); + z_t = dialog.z_space_doubleSpinBox->value(); + + const bool single = dialog.singleItemCheckBox->isChecked(); + + Scene_surface_mesh_item* t_item = nullptr; + if(single) { - transform_points_item->compute_bbox(); - transform_points_item->itemChanged(); + t_item = new Scene_surface_mesh_item(); + t_item->setName(tr("%1 %2x%3x%4") + .arg(item->name()) + .arg(i_max).arg(j_max).arg(k_max)); + scene->addItem(t_item); } - else + + for(int i=0; icompute_bbox(); - transform_item->itemChanged(); + for(int j=0; jsetName(tr("%1 %2,%3,%4") + .arg(item->name()) + .arg(i).arg(j).arg(k)); + scene->addItem(t_item); + } + else + { + CGAL::copy_face_graph(t_sm, *t_item->face_graph()); + } + } + } + } + + if(single && t_item) + t_item->invalidateOpenGLBuffers(); + + QApplication::restoreOverrideCursor(); +} + +template +void +Polyhedron_demo_affine_transform_plugin:: +start(SceneItem* item) +{ + CGAL_precondition(item && !aff_transformed_item); + + dockWidget->show(); + dockWidget->raise(); + + ui.validatePushButton->setEnabled(true); + + const typename SceneItem::Bbox& bbox = item->bbox(); + const double x = (bbox.xmin() + bbox.xmax()) / 2; + const double y = (bbox.ymin() + bbox.ymax()) / 2; + const double z = (bbox.zmin() + bbox.zmax()) / 2; + + lastMatrix.setToIdentity(); + lastMatrix.data()[12] = x; + lastMatrix.data()[13] = y; + lastMatrix.data()[14] = z; + + SceneTransformedItem* stfi = new SceneTransformedItem(item, CGAL::qglviewer::Vec(x,y,z)); + aff_transformed_item = static_cast(stfi); + + aff_transformed_item->setManipulatable(true); + aff_transformed_item->setColor(Qt::green); + aff_transformed_item->setRenderingMode(item->renderingMode()); + aff_transformed_item->setName(tr("Affine Transformation")); + + connect(aff_transformed_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, + this, &Polyhedron_demo_affine_transform_plugin::updateUiMatrix); + + connect(aff_transformed_item, SIGNAL(applyTransformation()), + this, SLOT(transformItem())); + + connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, + dockWidget, &QDockWidget::hide); + connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, + this, &Polyhedron_demo_affine_transform_plugin::resetTransformedItem); + connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, + [](){ QApplication::restoreOverrideCursor(); }); + + // delete this transformed item if the item it was created for is deleted + connect(item, &SceneItem::aboutToBeDestroyed, + this, &Polyhedron_demo_affine_transform_plugin::killTransformedItem); + + Scene_interface::Item_id transformed_item_index = scene->addItem(aff_transformed_item); + scene->setSelectedItem(transformed_item_index); + + resetTransformMatrix(); +} + +void +Polyhedron_demo_affine_transform_plugin:: +transformItem() +{ + if(started()) + return end(); + + Scene_item* item = scene->item(scene->mainSelectionIndex()); + CGAL_assertion(item); + + Scene_points_with_normal_item* pts_item = qobject_cast(item); + if(pts_item) + { + aff_transformed_item_type = Item_type::POINT_SET; + return start(pts_item); + } + + Scene_polygon_soup_item* ps_item = qobject_cast(item); + if(ps_item) + { + aff_transformed_item_type = Item_type::POLYGON_SOUP; + return start(ps_item); + } + + Scene_surface_mesh_item* sm_item = qobject_cast(item); + if(sm_item) + { + aff_transformed_item_type = Item_type::POLYGON_MESH; + return start(sm_item); } } +void +Polyhedron_demo_affine_transform_plugin:: +endPointSet(const QMatrix4x4& transform_matrix) +{ + Scene_aff_transformed_point_set_item* aff_transformed_pts_item = static_cast(aff_transformed_item); + Scene_points_with_normal_item* new_item = new Scene_points_with_normal_item(*(aff_transformed_pts_item->item())); + Point_set* new_ps = new_item->point_set(); + CGAL::qglviewer::Vec c = aff_transformed_item->center(); + + for(Point_set::Index idx : *new_ps) + { + QVector3D vec = transform_matrix * QVector3D(new_ps->point(idx).x() - c.x, + new_ps->point(idx).y() - c.y, + new_ps->point(idx).z() - c.z); + new_ps->point(idx) = Kernel::Point_3(vec.x(), vec.y(), vec.z()); + } + + new_item->setName(aff_transformed_item->name()); + Q_EMIT new_item->itemChanged(); + scene->replaceItem(scene->item_id(aff_transformed_item), new_item, true /*emit about to be destroyed*/); + + delete aff_transformed_item; + aff_transformed_item = nullptr; +} + +void +Polyhedron_demo_affine_transform_plugin:: +endPolygonSoup(const QMatrix4x4& transform_matrix) +{ + Scene_aff_transformed_polygon_soup_item* aff_transformed_ps_item = static_cast(aff_transformed_item); + Scene_polygon_soup_item* new_item = new Scene_polygon_soup_item(); + const auto& old_points = aff_transformed_ps_item->item()->points(); + + auto new_points = old_points; + CGAL::qglviewer::Vec c = aff_transformed_item->center(); + + for(Point_3& p : new_points) + { + QVector3D vec = transform_matrix * QVector3D(p.x() - c.x, + p.y() - c.y, + p.z() - c.z); + p = Kernel::Point_3(vec.x(), vec.y(), vec.z()); + } + + new_item->load(new_points, aff_transformed_ps_item->item()->polygons()); + new_item->setName(aff_transformed_item->name()); + new_item->invalidateOpenGLBuffers(); + Q_EMIT new_item->itemChanged(); + scene->replaceItem(scene->item_id(aff_transformed_item), new_item, true /*emit about to be destroyed*/); + + delete aff_transformed_item; + aff_transformed_item = nullptr; +} + +void +Polyhedron_demo_affine_transform_plugin:: +endPolygonMesh(const QMatrix4x4& transform_matrix) +{ + Scene_aff_transformed_surface_mesh_item* aff_transformed_sm_item = static_cast(aff_transformed_item); + Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item(*(aff_transformed_sm_item->item())); + new_item->setName(aff_transformed_item->name()); + + const CGAL::qglviewer::Vec& c = aff_transformed_item->center(); + auto transformation = [&c, &transform_matrix](const Kernel::Point_3& p) -> Kernel::Point_3 + { + QVector3D vec = transform_matrix * QVector3D(p.x() - c.x, + p.y() - c.y, + p.z() - c.z); + return { vec.x(), vec.y(), vec.z() }; + }; + + FaceGraph* new_sm = new_item->face_graph(); + CGAL::Polygon_mesh_processing::transform(transformation, *new_sm); + new_item->invalidateOpenGLBuffers(); + Q_EMIT new_item->itemChanged(); + scene->replaceItem(scene->item_id(aff_transformed_item), new_item, true /*emit about to be destroyed*/); + + delete aff_transformed_item; + aff_transformed_item = nullptr; +} + +void +Polyhedron_demo_affine_transform_plugin:: +end() +{ + ui.validatePushButton->setEnabled(false); + + QApplication::setOverrideCursor(Qt::WaitCursor); + + double matrix[16]; + transformMatrix(&matrix[0]); + + const CGAL::qglviewer::Vec& offset = Three::mainViewer()->offset(); + matrix[12] -= offset.x; + matrix[13] -= offset.y; + matrix[14] -= offset.z; + + resetTransformMatrix(); + + QMatrix4x4 transform_matrix; + for(int i=0; i<16; ++i) + transform_matrix.data()[i] = float(matrix[i]); + + switch(aff_transformed_item_type) + { + case Item_type::POINT_SET: + endPointSet(transform_matrix); + break; + case Item_type::POLYGON_SOUP: + endPolygonSoup(transform_matrix); + break; + case Item_type::POLYGON_MESH: + endPolygonMesh(transform_matrix); + break; + default: + CGAL_assertion(false); + } + + dockWidget->hide(); + QApplication::restoreOverrideCursor(); +} + #include "Affine_transform_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt index 8ede27ca7ed..dc58f28947f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt @@ -8,9 +8,12 @@ qt5_wrap_ui(transformUI_FILES Transformation_widget.ui MeshOnGrid_dialog.ui) polyhedron_demo_plugin(affine_transform_plugin Affine_transform_plugin ${transformUI_FILES} KEYWORDS PointSetProcessing) -target_link_libraries( - affine_transform_plugin PUBLIC scene_surface_mesh_item scene_transform_item - scene_points_with_normal_item) +target_link_libraries(affine_transform_plugin PUBLIC scene_surface_mesh_item + scene_points_with_normal_item + scene_aff_transformed_item + scene_aff_transformed_point_set_item + scene_aff_transformed_polygon_soup_item + scene_aff_transformed_surface_mesh_item) polyhedron_demo_plugin(edit_box_plugin Edit_box_plugin) target_link_libraries(edit_box_plugin PUBLIC scene_edit_box_item @@ -25,9 +28,10 @@ polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin) target_link_libraries(create_bbox_mesh_plugin PUBLIC scene_surface_mesh_item) polyhedron_demo_plugin(create_obb_mesh_plugin Create_obb_mesh_plugin) -target_link_libraries( - create_obb_mesh_plugin PUBLIC scene_surface_mesh_item scene_selection_item - scene_points_with_normal_item) +target_link_libraries(create_obb_mesh_plugin PUBLIC scene_surface_mesh_item + scene_polygon_soup_item + scene_selection_item + scene_points_with_normal_item) qt5_wrap_ui(volumesUI_FILES Basic_generator_widget.ui) polyhedron_demo_plugin( diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp index 13bf84315e3..1fafba9d82c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -11,7 +11,6 @@ #include "Scene_surface_mesh_item.h" #include - using namespace CGAL::Three; class Create_bbox_mesh_plugin : @@ -24,96 +23,135 @@ class Create_bbox_mesh_plugin : public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); + QList actions() const; - bool applicable(QAction*) const { - if(scene->mainSelectionIndex() != -1 - && scene->item(scene->mainSelectionIndex())->isFinite()) - return true; - return false;} + + bool applicable(QAction*) const + { + bool at_least_one_non_empty = false; + Q_FOREACH(int index, scene->selectionIndices()) + { + Scene_item* item = scene->item(index); + if(!item->isFinite()) + return false; + if(!item->isEmpty()) + at_least_one_non_empty = true; + } + + return at_least_one_non_empty; + } protected: bool bbox(bool extended = false); public Q_SLOTS: - void createBbox() { + void createBbox() + { QApplication::setOverrideCursor(Qt::WaitCursor); - if(!bbox()) - { - QApplication::restoreOverrideCursor(); - QMessageBox::warning(mw, "Error", "Bbox couldn't be computed, so there is no mesh created."); - } - else - QApplication::restoreOverrideCursor(); + const bool res = bbox(); + QApplication::restoreOverrideCursor(); + + if(!res) + QMessageBox::warning(mw, "Error", "Failed to compute the bounding box."); } - void createExtendedBbox() { + + void createExtendedBbox() + { QApplication::setOverrideCursor(Qt::WaitCursor); - if(!bbox(true)) - { - QApplication::restoreOverrideCursor(); - QMessageBox::warning(mw, "Error", "Bbox couldn't be computed, so there is no mesh created."); - } - else - QApplication::restoreOverrideCursor(); + const bool res = bbox(true); + QApplication::restoreOverrideCursor(); + + if(!res) + QMessageBox::warning(mw, "Error", "Failed to compute the extended bounding box"); } private: Scene_interface* scene; QMainWindow* mw; + QAction* actionBbox; QAction* actionExtendedBbox; +}; -}; // end Create_bbox_mesh_plugin - -void Create_bbox_mesh_plugin::init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) +void +Create_bbox_mesh_plugin:: +init(QMainWindow* mainWindow, + Scene_interface* scene_interface, + Messages_interface*) { scene = scene_interface; mw = mainWindow; - actionBbox = new QAction(tr("Create &Bbox Mesh"), mainWindow); + + actionBbox = new QAction(tr("Create &Bounding Box"), mainWindow); actionBbox->setObjectName("createBboxMeshAction"); connect(actionBbox, SIGNAL(triggered()), this, SLOT(createBbox())); - actionExtendedBbox = new QAction(tr("Create &Extended Bbox Mesh"), mainWindow); + + actionExtendedBbox = new QAction(tr("Create &Extended Bounding Box"), mainWindow); actionExtendedBbox->setObjectName("createExtendedBboxMeshAction"); connect(actionExtendedBbox, SIGNAL(triggered()), this, SLOT(createExtendedBbox())); } -QList Create_bbox_mesh_plugin::actions() const { +QList +Create_bbox_mesh_plugin:: +actions() const +{ return QList() << actionBbox << actionExtendedBbox; } -bool Create_bbox_mesh_plugin::bbox(bool extended) +bool +Create_bbox_mesh_plugin:: +bbox(bool extended) { Scene_interface::Bbox bbox; - bool initialized = false; + int item_count = 0; + QString name; - Q_FOREACH(int index, scene->selectionIndices()) { + Q_FOREACH(int index, scene->selectionIndices()) + { Scene_item* item = scene->item(index); - if(item->isFinite() && ! item->isEmpty()) { - if(initialized) { + if(item->isFinite() && !item->isEmpty()) + { + if(item_count > 0) + { bbox = bbox + item->bbox(); - } else { - bbox = item->bbox(); - initialized = true; + if(item_count == 1) + name = name + " and others"; } + else + { + bbox = item->bbox(); + name = item->name(); + } + ++item_count; } } - std::cerr << "bbox dimensions: " << bbox.xmax() - bbox.xmin() - << "\n " << bbox.ymax() - bbox.ymin() - << "\n " << bbox.zmax() - bbox.zmin() + + if(item_count == 0) + return false; + + std::cout << "bbox: " << bbox.xmin() << " | " << bbox.xmax() + << "\n " << bbox.ymin() << " | " << bbox.ymax() + << "\n " << bbox.zmin() << " | " << bbox.zmax() << std::endl; - if(extended) { + if(extended) + { const double delta_x = ( bbox.xmax() - bbox.xmin() ) / 20.; const double delta_y = ( bbox.ymax() - bbox.ymin() ) / 20.; const double delta_z = ( bbox.zmax() - bbox.zmin() ) / 20.; - bbox = Scene_interface::Bbox( - bbox.xmin() - delta_x, - bbox.ymin() - delta_y, - bbox.zmin() - delta_z, - bbox.xmax() + delta_x, - bbox.ymax() + delta_y, - bbox.zmax() + delta_z); + bbox = Scene_interface::Bbox(bbox.xmin() - delta_x, + bbox.ymin() - delta_y, + bbox.zmin() - delta_z, + bbox.xmax() + delta_x, + bbox.ymax() + delta_y, + bbox.zmax() + delta_z); + + std::cout << "extended bbox: " << bbox.xmin() << " | " << bbox.xmax() + << "\n " << bbox.ymin() << " | " << bbox.ymax() + << "\n " << bbox.zmin() << " | " << bbox.zmax() + << std::endl; } if((bbox.min)(0) > (bbox.max)(0) || @@ -122,15 +160,18 @@ bool Create_bbox_mesh_plugin::bbox(bool extended) { return false; } + Scene_item* item; EPICK::Iso_cuboid_3 ic(bbox); SMesh* p = new SMesh; - CGAL::make_hexahedron(ic[0], ic[1], ic[2], ic[3], ic[4], ic[5], ic[6], ic[7],*p); + CGAL::make_hexahedron(ic[0], ic[1], ic[2], ic[3], ic[4], ic[5], ic[6], ic[7], *p); item = new Scene_surface_mesh_item(p); - item->setName("Scene bbox mesh"); + item->setName(name + (extended ? " (Extended Bbox)" : " (Bbox)")); item->setRenderingMode(Wireframe); + item->setColor(Qt::black); scene->addItem(item); + return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp index 59d44164df3..7ca4e060a92 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp @@ -9,6 +9,7 @@ #include #include "Scene_surface_mesh_item.h" +#include "Scene_polygon_soup_item.h" #include "Scene_polyhedron_selection_item.h" #include "Scene_points_with_normal_item.h" @@ -20,9 +21,9 @@ using namespace CGAL::Three; typedef Scene_surface_mesh_item Scene_facegraph_item; -class Create_obb_mesh_plugin : - public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface +class Create_obb_mesh_plugin + : public QObject, + public CGAL::Three::Polyhedron_demo_plugin_interface { Q_OBJECT Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) @@ -30,32 +31,36 @@ class Create_obb_mesh_plugin : public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); + QList actions() const; bool applicable(QAction*) const { - if(scene->mainSelectionIndex() != -1 - && scene->item(scene->mainSelectionIndex())->isFinite()) + bool at_least_one_non_empty = false; + Q_FOREACH(int index, scene->selectionIndices()) { - const Scene_interface::Item_id index = scene->mainSelectionIndex(); - - Scene_facegraph_item* item = qobject_cast(scene->item(index)); - - Scene_polyhedron_selection_item* selection_item = - qobject_cast(scene->item(index)); - - Scene_points_with_normal_item* point_set_item = - qobject_cast(scene->item(index)); - if(!item && !selection_item && !point_set_item) + Scene_item* item = scene->item(index); + if(!item->isFinite()) return false; - return true; + + Scene_facegraph_item* sm_item = qobject_cast(item); + Scene_polygon_soup_item* ps_item = qobject_cast(item); + Scene_polyhedron_selection_item* selection_item = qobject_cast(item); + Scene_points_with_normal_item* pts_item = qobject_cast(item); + if(!sm_item && !ps_item && !selection_item && !pts_item) + return false; + + if(!item->isEmpty()) + at_least_one_non_empty = true; } - return false; + + return at_least_one_non_empty; } protected: void gather_mesh_points(std::vector& points); - void obb(); + int dimensionality(const std::vector& points); + bool obb(); public Q_SLOTS: void createObb() @@ -69,87 +74,166 @@ private: Scene_interface* scene; QMainWindow* mw; QAction* actionObb; -}; // end Create_obb_mesh_plugin class +}; -void Create_obb_mesh_plugin::init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) +void +Create_obb_mesh_plugin:: +init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) { scene = scene_interface; mw = mainWindow; - actionObb = new QAction(tr("Create &Optimal Bbox Mesh"), mainWindow); + actionObb = new QAction(tr("Create &Optimal Bounding Box"), mainWindow); actionObb->setObjectName("createObbMeshAction"); connect(actionObb, SIGNAL(triggered()), this, SLOT(createObb())); } -QList Create_obb_mesh_plugin::actions() const +QList +Create_obb_mesh_plugin:: +actions() const { return QList() << actionObb; } -void Create_obb_mesh_plugin::gather_mesh_points(std::vector& points) +int +Create_obb_mesh_plugin:: +dimensionality(const std::vector& points) { - const Scene_interface::Item_id index = scene->mainSelectionIndex(); + if(points.empty()) + return -1; - Scene_facegraph_item* item = qobject_cast(scene->item(index)); + int d = 0; + Point_3 p0 = points[0], p1, p2; - Scene_polyhedron_selection_item* selection_item = - qobject_cast(scene->item(index)); - - Scene_points_with_normal_item* point_set_item = - qobject_cast(scene->item(index)); - - if(item || selection_item) + auto it = std::cbegin(points), end = std::cend(points); + while(it != end) { - typedef typename boost::property_map::type PointPMap; - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::face_descriptor face_descriptor; - - std::vector selected_vertices; - - if(item != nullptr) + if(p0 != *it) { - FaceGraph& pmesh = *item->polyhedron(); - selected_vertices.assign(vertices(pmesh).begin(), vertices(pmesh).end()); - PointPMap pmap = get(CGAL::vertex_point, pmesh); - for(vertex_descriptor v : selected_vertices) - points.push_back(get(pmap, v)); - + p1 = *it; + d = 1; + break; } - else if(selection_item != nullptr) // using selection of faces - { - FaceGraph& pmesh = *selection_item->polyhedron(); - for(face_descriptor f : selection_item->selected_facets) - { - for(vertex_descriptor v : vertices_around_face(halfedge(f, pmesh), pmesh)) - selected_vertices.push_back(v); - } - - PointPMap pmap = get(CGAL::vertex_point, pmesh); - for(vertex_descriptor v : selected_vertices) - points.push_back(get(pmap, v)); - } - - CGAL_assertion(points.size() >= 3); + ++it; } - if(point_set_item) + while(it != end) { - Point_set* points_set = point_set_item->point_set(); - if(points_set == nullptr) - return; + if(!collinear(p0, p1, *it)) + { + p2 = *it; + d = 2; + break; + } + ++it; + } - std::cout << "points_set->size()= " << points_set->size() << std::endl; - for(const Point_3& p : points_set->points()) - points.push_back(p); + while(it != end) + { + if(!coplanar(p0, p1, p2, *it)) + { + d = 3; + break; + } + ++it; + } + + return d; +} + +void +Create_obb_mesh_plugin:: +gather_mesh_points(std::vector& points) +{ + Q_FOREACH(int index, scene->selectionIndices()) + { + Scene_item* item = scene->item(index); + + // Surface Mesh + Scene_facegraph_item* sm_item = qobject_cast(item); + if(sm_item) + { + FaceGraph* sm_ptr = sm_item->polyhedron(); + if(sm_ptr == nullptr) + continue; + + for(auto v : vertices(*sm_ptr)) + points.push_back(get(CGAL::vertex_point, *sm_ptr, v)); + + continue; + } + + // Polygon soup + Scene_polygon_soup_item* ps_item = qobject_cast(item); + if(ps_item) + { + for(const Point_3& p : ps_item->points()) + points.push_back(p); + + continue; + } + + // Selection + Scene_polyhedron_selection_item* selection_item = qobject_cast(item); + if(selection_item != nullptr) + { + FaceGraph* sm_ptr = selection_item->polyhedron(); + if(sm_ptr == nullptr) + continue; + + auto vpm = get(CGAL::vertex_point, *sm_ptr); + + for(auto f : selection_item->selected_facets) + { + // @todo avoid duplication + for(auto v : vertices_around_face(halfedge(f, *sm_ptr), *sm_ptr)) + points.push_back(get(vpm, v)); + } + + for(auto e : selection_item->selected_edges) + { + points.push_back(get(vpm, source(e, *sm_ptr))); + points.push_back(get(vpm, target(e, *sm_ptr))); + } + + for(auto v : selection_item->selected_vertices) + points.push_back(get(vpm, v)); + + continue; + } + + // Point set + Scene_points_with_normal_item* pts_item = qobject_cast(item); + if(pts_item) + { + Point_set* pts_ptr = pts_item->point_set(); + if(pts_ptr == nullptr) + return; + + for(const Point_3& p : pts_ptr->points()) + points.push_back(p); + + continue; + } } } -void Create_obb_mesh_plugin::obb() +bool +Create_obb_mesh_plugin:: +obb() { // gather point coordinates std::vector points; gather_mesh_points(points); - // find obb + const int d = dimensionality(points); + if(d != 3) + { + std::cerr << "Dimensionality of the point set is: " << d << std::endl; + QMessageBox::warning(mw, "Error", "At least 4 non-coplanar points are required to compute an OBB."); + return false; + } + + // compute the OBB std::array obb_points; CGAL::oriented_bounding_box(points, obb_points); @@ -157,11 +241,36 @@ void Create_obb_mesh_plugin::obb() SMesh* p = new SMesh; CGAL::make_hexahedron(obb_points[0], obb_points[1], obb_points[2], obb_points[3], obb_points[4], obb_points[5], obb_points[6], obb_points[7], *p); - item = new Scene_facegraph_item(p); - item->setName("Optimal bbox mesh"); + std::cout << "Optimal bounding box: " << obb_points[0] + << "\n " << obb_points[7] + << std::endl; + + QString name; + Q_FOREACH(int index, scene->selectionIndices()) + { + Scene_item* item = scene->item(index); + if(!item->isEmpty()) + { + if(name.size() > 0) + { + name = name + " and others"; + break; + } + else + { + name = item->name(); + } + } + } + + item = new Scene_facegraph_item(p); + item->setName(name + " (OBB)"); item->setRenderingMode(Wireframe); + item->setColor(Qt::black); scene->addItem(item); + + return true; } #include "Create_obb_mesh_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.cpp new file mode 100644 index 00000000000..2757b2b919b --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.cpp @@ -0,0 +1,55 @@ +#include "Scene_aff_transformed_item.h" + +#include +#include + +#include + +using namespace CGAL::Three; + +Scene_aff_transformed_item:: +Scene_aff_transformed_item(const CGAL::qglviewer::Vec& pos) +{ + d = new Scene_aff_transformed_item_priv(pos); +} + +Scene_aff_transformed_item:: +~Scene_aff_transformed_item() +{ + delete d; +} + +void +Scene_aff_transformed_item:: +itemAboutToBeDestroyed(Scene_item *item) +{ + Scene_item::itemAboutToBeDestroyed(item); + if(d && item == this) + { + if(d->frame) + { + delete d->frame; + d->frame = nullptr; + } + } +} + +void +Scene_aff_transformed_item:: +setFMatrix(double matrix[16]) +{ + for(int i=0; i<16; ++i) + d->f_matrix.data()[i] = float(matrix[i]); +} + +bool +Scene_aff_transformed_item:: +keyPressEvent(QKeyEvent* e) +{ + if(e->key() == Qt::Key_S) + { + Q_EMIT applyTransformation(); + return true; + } + return false; +} diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.h b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.h new file mode 100644 index 00000000000..77554fc1102 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.h @@ -0,0 +1,78 @@ +#ifndef SCENE_AFF_TRANSFORMED_ITEM_H +#define SCENE_AFF_TRANSFORMED_ITEM_H + +#if defined( scene_aff_transformed_item_EXPORTS) +# define SCENE_AFF_TRANSFORMED_ITEM_EXPORT Q_DECL_EXPORT +#else +# define SCENE_AFF_TRANSFORMED_ITEM_EXPORT Q_DECL_IMPORT +#endif + +#include +#include +#include +#include + +#include + +using namespace CGAL::Three; + +struct Scene_aff_transformed_item_priv +{ + bool manipulable; + CGAL::Three::Scene_item::ManipulatedFrame* frame; + QMatrix4x4 f_matrix; + + Scene_aff_transformed_item_priv(const CGAL::qglviewer::Vec& pos) + : frame(new CGAL::Three::Scene_item::ManipulatedFrame()) + { + const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); + frame->setPosition(pos + offset); + } + + ~Scene_aff_transformed_item_priv() + { + if(frame) + { + delete frame; + frame = nullptr; + } + } +}; + +// This is an abstract representation of a scene item (points, polygon mesh, ...) +// that is transformed by an affine transformation. +// In Affine_transform_plugin.cpp, type erasure is used to factorize most of the code, +// using this base class. +class SCENE_AFF_TRANSFORMED_ITEM_EXPORT Scene_aff_transformed_item + : public Scene_item_rendering_helper +{ + Q_OBJECT + +protected: + friend Scene_aff_transformed_item_priv; + Scene_aff_transformed_item_priv* d; + +public: + Scene_aff_transformed_item(const CGAL::qglviewer::Vec& pos); + + ~Scene_aff_transformed_item(); + + void itemAboutToBeDestroyed(Scene_item *item) Q_DECL_OVERRIDE; + + void setManipulatable(bool b = true) { d->manipulable = b;} + bool manipulatable() const Q_DECL_OVERRIDE { return d->manipulable; } + CGAL::Three::Scene_item::ManipulatedFrame* manipulatedFrame() Q_DECL_OVERRIDE { return d->frame; } + void setFMatrix(double matrix[16]); + const QMatrix4x4& getFMatrix() const { return d->f_matrix; } + + // below is defined in the specific aff_transformed items + virtual void compute_bbox() const Q_DECL_OVERRIDE = 0; + virtual const CGAL::qglviewer::Vec& center() const = 0; + + virtual bool keyPressEvent(QKeyEvent* e) Q_DECL_OVERRIDE; + +Q_SIGNALS: + void applyTransformation(); +}; + +#endif // SCENE_AFF_TRANSFORMED_ITEM_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp new file mode 100644 index 00000000000..ebf07545f44 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp @@ -0,0 +1,128 @@ +#include "Scene_aff_transformed_point_set_item.h" + +#include +#include +#include + +#include + +using namespace CGAL::Three; + +// const std::size_t limit_fast_drawing = 300000; //arbitraty large value + +Scene_aff_transformed_point_set_item:: +Scene_aff_transformed_point_set_item(Scene_points_with_normal_item* pts_item, + const CGAL::qglviewer::Vec& pos) + : Scene_aff_transformed_item(pos) +{ + d = new Scene_aff_transformed_point_set_item_priv(pts_item, pos); + setPointContainer(0, new Point_container(Viewer_interface::PROGRAM_NO_SELECTION, false)); + compute_bbox(); + invalidateOpenGLBuffers(); + + connect(pts_item, &Scene_points_with_normal_item::itemChanged , + this, &Scene_aff_transformed_point_set_item::updateCache); +} + +Scene_aff_transformed_point_set_item:: +~Scene_aff_transformed_point_set_item() +{ + delete d; +} + +void +Scene_aff_transformed_point_set_item:: +updateCache() +{ + compute_bbox(); + invalidateOpenGLBuffers(); +} + +QString +Scene_aff_transformed_point_set_item:: +toolTip() const +{ + return QObject::tr("

    Affine transformation of %1

    " + "

    Keep Ctrl pressed and use the arcball to define an affine transformation.
    " + "Press S to apply the affine transformation to a copy of %1.

    ") + .arg(d->pts_item->name()); +} + +void +Scene_aff_transformed_point_set_item:: +invalidateOpenGLBuffers() +{ + setBuffersFilled(false); + getPointContainer(0)->reset_vbos(ALL); +} + +void +Scene_aff_transformed_point_set_item:: +initializeBuffers(Viewer_interface* v) const +{ + Point_container* pc = getPointContainer(0); + pc->initializeBuffers(v); + pc->setFlatDataSize(d->nb_points); + d->points.clear(); + d->points.shrink_to_fit(); +} + +void +Scene_aff_transformed_point_set_item:: +compute_bbox() const +{ + setBbox(d->pts_item->bbox()); +} + +void +Scene_aff_transformed_point_set_item:: +computeElements() const +{ + d->compute_elements(); + + Point_container* pc = getPointContainer(0); + pc->allocate(Point_container::Vertices, + d->points.data(), + static_cast(d->points.size()*sizeof(float))); + d->nb_points = d->points.size(); + + setBuffersFilled(true); +} + +void +Scene_aff_transformed_point_set_item:: +drawPoints(CGAL::Three::Viewer_interface *viewer) const +{ + GLfloat point_size; + viewer->glGetFloatv(GL_POINT_SIZE, &point_size); + viewer->setGlPointSize(6.f); + double ratio_displayed = 1.0; + // @fixme... + // if((viewer->inFastDrawing () || d->pts_item->d->isPointSliderMoving()) && + // ((d->nb_points)/3 > limit_fast_drawing)) // arbitrary large value + // ratio_displayed = 3 * limit_fast_drawing / static_cast(d->nb_points); + + if(!isInit(viewer)) + initGL(viewer); + + if(getBuffersFilled() && !getBuffersInit(viewer)) + { + initializeBuffers(viewer); + setBuffersInit(viewer, true); + } + + if(!getBuffersFilled()) + { + computeElements(); + initializeBuffers(viewer); + } + + Point_container* pc = getPointContainer(0); + pc->setColor(this->color()); + pc->setFrameMatrix(this->getFMatrix()); + + std::size_t real_size = pc->getFlatDataSize(); + pc->setFlatDataSize(ratio_displayed * real_size); + pc->draw(viewer, true); + pc->setFlatDataSize(real_size); +} diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.h b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.h new file mode 100644 index 00000000000..1bd9d46ca9c --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.h @@ -0,0 +1,95 @@ +#ifndef SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_H +#define SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_H + +#if defined( scene_aff_transformed_point_set_item_EXPORTS) +# define SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_EXPORT Q_DECL_EXPORT +#else +# define SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_EXPORT Q_DECL_IMPORT +#endif + +#include "Kernel_type.h" +#include "Scene_points_with_normal_item.h" +#include "Scene_aff_transformed_item.h" + +#include +#include +#include +#include + +#include + +using namespace CGAL::Three; + +struct Scene_aff_transformed_point_set_item_priv +{ + using Point = Kernel::Point_3; + + Scene_points_with_normal_item* pts_item; + mutable std::vector points; + mutable std::size_t nb_points; + + CGAL::qglviewer::Vec center_; + + Scene_aff_transformed_point_set_item_priv(Scene_points_with_normal_item *pts_item, + const CGAL::qglviewer::Vec& pos) + : pts_item(pts_item), + center_(pos) + { + nb_points = 0; + } + + ~Scene_aff_transformed_point_set_item_priv() { } + + void compute_elements() const + { + const Point_set& ps = *(pts_item->point_set()); + points.reserve(3*ps.size()); + for(Point_set::const_iterator it = ps.begin(); it != ps.first_selected(); it++) + { + const Point& p = ps.point(*it); + points.push_back(p.x() - center_.x); + points.push_back(p.y() - center_.y); + points.push_back(p.z() - center_.z); + } + } +}; + +class SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_EXPORT Scene_aff_transformed_point_set_item + : public Scene_aff_transformed_item +{ + Q_OBJECT + + using Point_set = Point_set_3; + +protected: + friend Scene_aff_transformed_point_set_item_priv; + Scene_aff_transformed_point_set_item_priv* d; + +public: + Scene_aff_transformed_point_set_item(Scene_points_with_normal_item *pts_item, + const CGAL::qglviewer::Vec& pos); + + ~Scene_aff_transformed_point_set_item(); + + Scene_points_with_normal_item* item() { return d->pts_item; } + const CGAL::qglviewer::Vec& center() const Q_DECL_OVERRIDE { return d->center_; } + + CGAL::Three::Scene_item* clone() const Q_DECL_OVERRIDE { return nullptr; } + QString name() const Q_DECL_OVERRIDE { return tr("%1_transformed").arg(d->pts_item->name()); } + QString toolTip() const Q_DECL_OVERRIDE; + + bool isEmpty() const Q_DECL_OVERRIDE { return (d->nb_points == 0); } + + void updateCache(); + + virtual bool supportsRenderingMode(RenderingMode m) const Q_DECL_OVERRIDE { return m == Points ; } + + virtual void invalidateOpenGLBuffers() Q_DECL_OVERRIDE; + void initializeBuffers(CGAL::Three::Viewer_interface* v) const Q_DECL_OVERRIDE; + + void compute_bbox() const Q_DECL_OVERRIDE; + void computeElements() const Q_DECL_OVERRIDE; + void drawPoints(CGAL::Three::Viewer_interface *viewer) const Q_DECL_OVERRIDE; +}; + +#endif // SCENE_AFF_TRANSFORMED_POINT_SET_ITEM_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp new file mode 100644 index 00000000000..4aa45a823fc --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp @@ -0,0 +1,111 @@ +#include "Scene_aff_transformed_polygon_soup_item.h" + +#include +#include +#include + +#include + +using namespace CGAL::Three; + +Scene_aff_transformed_polygon_soup_item:: +Scene_aff_transformed_polygon_soup_item(Scene_polygon_soup_item* ps_item, + const CGAL::qglviewer::Vec& pos) + : Scene_aff_transformed_item(pos) +{ + d = new Scene_aff_transformed_polygon_soup_item_priv(ps_item, pos); + setEdgeContainer(0, new Edge_container(Viewer_interface::PROGRAM_NO_SELECTION, false)); + compute_bbox(); + invalidateOpenGLBuffers(); + + connect(ps_item, &Scene_polygon_soup_item::itemChanged , + this, &Scene_aff_transformed_polygon_soup_item::updateCache); +} + +Scene_aff_transformed_polygon_soup_item:: +~Scene_aff_transformed_polygon_soup_item() +{ + delete d; +} + +void +Scene_aff_transformed_polygon_soup_item:: +updateCache() +{ + compute_bbox(); + invalidateOpenGLBuffers(); +} + +QString +Scene_aff_transformed_polygon_soup_item:: +toolTip() const +{ + return QObject::tr("

    Affine transformation of %1

    " + "

    Keep Ctrl pressed and use the arcball to define an affine transformation.
    " + "Press S to apply the affine transformation to a copy of %1.

    ") + .arg(d->ps_item->name()); +} + +void +Scene_aff_transformed_polygon_soup_item:: +invalidateOpenGLBuffers() +{ + setBuffersFilled(false); + getEdgeContainer(0)->reset_vbos(ALL); +} + +void +Scene_aff_transformed_polygon_soup_item:: +initializeBuffers(Viewer_interface *v) const +{ + getEdgeContainer(0)->initializeBuffers(v); + getEdgeContainer(0)->setFlatDataSize(d->nb_lines); + d->positions_lines.clear(); + d->positions_lines.shrink_to_fit(); +} + +void +Scene_aff_transformed_polygon_soup_item:: +compute_bbox() const +{ + setBbox(d->ps_item->bbox()); +} + +void +Scene_aff_transformed_polygon_soup_item:: +computeElements() const +{ + d->compute_elements(); + + getEdgeContainer(0)->allocate(Edge_container::Vertices, + d->positions_lines.data(), + static_cast(d->positions_lines.size()*sizeof(float))); + d->nb_lines = d->positions_lines.size(); + + setBuffersFilled(true); +} + +void +Scene_aff_transformed_polygon_soup_item:: +drawEdges(CGAL::Three::Viewer_interface* viewer) const +{ + if(!isInit(viewer)) + initGL(viewer); + + if(getBuffersFilled() && !getBuffersInit(viewer)) + { + initializeBuffers(viewer); + setBuffersInit(viewer, true); + } + + if(!getBuffersFilled()) + { + computeElements(); + initializeBuffers(viewer); + } + + Edge_container* ec = getEdgeContainer(0); + ec->setColor(this->color()); + ec->setFrameMatrix(this->getFMatrix()); + ec->draw(viewer, true); +} \ No newline at end of file diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h new file mode 100644 index 00000000000..4222fb455d3 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h @@ -0,0 +1,118 @@ +#ifndef SCENE_AFF_TRANSFORMED_POLYGON_SOUP_ITEM_H +#define SCENE_AFF_TRANSFORMED_POLYGON_SOUP_ITEM_H + +#if defined( scene_aff_transformed_polygon_soup_item_EXPORTS) +# define SCENE_AFF_TRANSFORMED_POLYGON_SOUP_ITEM_EXPORT Q_DECL_EXPORT +#else +# define SCENE_AFF_TRANSFORMED_POLYGON_SOUP_ITEM_EXPORT Q_DECL_IMPORT +#endif + +#include "Kernel_type.h" +#include "Scene_polygon_soup_item.h" +#include "Scene_aff_transformed_item.h" + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +using namespace CGAL::Three; + +struct Scene_aff_transformed_polygon_soup_item_priv +{ + using Point = Kernel::Point_3; + + Scene_polygon_soup_item* ps_item; + mutable std::vector positions_lines; + mutable std::size_t nb_lines; + + CGAL::qglviewer::Vec center_; + +public: + Scene_aff_transformed_polygon_soup_item_priv(Scene_polygon_soup_item* ps_item, + const CGAL::qglviewer::Vec& pos) + : ps_item(ps_item), + center_(pos) + { + nb_lines = 0; + } + + ~Scene_aff_transformed_polygon_soup_item_priv() { } + + void compute_elements() const + { + if(!ps_item) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + const auto& points = ps_item->points(); + const auto& polygons = ps_item->polygons(); + + for(std::size_t i=0; ips_item; } + const CGAL::qglviewer::Vec& center() const Q_DECL_OVERRIDE { return d->center_; } + + CGAL::Three::Scene_item* clone() const Q_DECL_OVERRIDE { return nullptr; } + QString name() const Q_DECL_OVERRIDE { return tr("%1_transformed").arg(d->ps_item->name()); } + QString toolTip() const Q_DECL_OVERRIDE; + + void updateCache(); + + bool isEmpty() const Q_DECL_OVERRIDE { return (d->nb_lines == 0); } + + virtual bool supportsRenderingMode(RenderingMode m) const Q_DECL_OVERRIDE { return m == Wireframe ; } + virtual void invalidateOpenGLBuffers() Q_DECL_OVERRIDE; + void initializeBuffers(CGAL::Three::Viewer_interface*) const Q_DECL_OVERRIDE; + + void compute_bbox() const Q_DECL_OVERRIDE; + void computeElements() const Q_DECL_OVERRIDE; + void drawEdges(CGAL::Three::Viewer_interface*) const Q_DECL_OVERRIDE; +}; + +#endif // SCENE_AFF_TRANSFORMED_POLYGON_SOUP_ITEM_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp new file mode 100644 index 00000000000..7440437dd05 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp @@ -0,0 +1,111 @@ +#include "Scene_aff_transformed_surface_mesh_item.h" + +#include +#include +#include + +#include + +using namespace CGAL::Three; + +Scene_aff_transformed_surface_mesh_item:: +Scene_aff_transformed_surface_mesh_item(Scene_surface_mesh_item* sm_item, + const CGAL::qglviewer::Vec& pos) + : Scene_aff_transformed_item(pos) +{ + d = new Scene_aff_transformed_surface_mesh_item_priv(sm_item, pos); + setEdgeContainer(0, new Edge_container(Viewer_interface::PROGRAM_NO_SELECTION, false)); + compute_bbox(); + invalidateOpenGLBuffers(); + + connect(sm_item, &Scene_surface_mesh_item::itemChanged , + this, &Scene_aff_transformed_surface_mesh_item::updateCache); +} + +Scene_aff_transformed_surface_mesh_item:: +~Scene_aff_transformed_surface_mesh_item() +{ + delete d; +} + +void +Scene_aff_transformed_surface_mesh_item:: +updateCache() +{ + compute_bbox(); + invalidateOpenGLBuffers(); +} + +QString +Scene_aff_transformed_surface_mesh_item:: +toolTip() const +{ + return QObject::tr("

    Affine transformation of %1

    " + "

    Keep Ctrl pressed and use the arcball to define an affine transformation.
    " + "Press S to apply the affine transformation to a copy of %1.

    ") + .arg(d->sm_item->name()); +} + +void +Scene_aff_transformed_surface_mesh_item:: +invalidateOpenGLBuffers() +{ + setBuffersFilled(false); + getEdgeContainer(0)->reset_vbos(ALL); +} + +void +Scene_aff_transformed_surface_mesh_item:: +initializeBuffers(Viewer_interface *v) const +{ + getEdgeContainer(0)->initializeBuffers(v); + getEdgeContainer(0)->setFlatDataSize(d->nb_lines); + d->positions_lines.clear(); + d->positions_lines.shrink_to_fit(); +} + +void +Scene_aff_transformed_surface_mesh_item:: +compute_bbox() const +{ + setBbox(d->sm_item->bbox()); +} + +void +Scene_aff_transformed_surface_mesh_item:: +computeElements() const +{ + d->compute_elements(); + + getEdgeContainer(0)->allocate(Edge_container::Vertices, + d->positions_lines.data(), + static_cast(d->positions_lines.size()*sizeof(float))); + d->nb_lines = d->positions_lines.size(); + + setBuffersFilled(true); +} + +void +Scene_aff_transformed_surface_mesh_item:: +drawEdges(CGAL::Three::Viewer_interface* viewer) const +{ + if(!isInit(viewer)) + initGL(viewer); + + if(getBuffersFilled() && !getBuffersInit(viewer)) + { + initializeBuffers(viewer); + setBuffersInit(viewer, true); + } + + if(!getBuffersFilled()) + { + computeElements(); + initializeBuffers(viewer); + } + + Edge_container* ec = getEdgeContainer(0); + ec->setColor(this->color()); + ec->setFrameMatrix(this->getFMatrix()); + ec->draw(viewer, true); +} \ No newline at end of file diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h new file mode 100644 index 00000000000..64d2cfe40a5 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h @@ -0,0 +1,113 @@ +#ifndef SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_H +#define SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_H + +#if defined( scene_aff_transformed_surface_mesh_item_EXPORTS) +# define SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_EXPORT Q_DECL_EXPORT +#else +# define SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_EXPORT Q_DECL_IMPORT +#endif + +#include "Kernel_type.h" +#include "Scene_surface_mesh_item.h" +#include "Scene_aff_transformed_item.h" + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +using namespace CGAL::Three; + +struct Scene_aff_transformed_surface_mesh_item_priv +{ + using Point = Kernel::Point_3; + + Scene_surface_mesh_item* sm_item; + mutable std::vector positions_lines; + mutable std::size_t nb_lines; + + CGAL::qglviewer::Vec center_; + +public: + Scene_aff_transformed_surface_mesh_item_priv(Scene_surface_mesh_item* sm_item, + const CGAL::qglviewer::Vec& pos) + : sm_item(sm_item), + center_(pos) + { + nb_lines = 0; + } + + ~Scene_aff_transformed_surface_mesh_item_priv() { } + + void compute_elements() const + { + if(!sm_item) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + + const auto& sm_ptr = sm_item->face_graph(); + auto vpm = get(CGAL::vertex_point, *sm_ptr); + + positions_lines.resize(0); + for(auto e : edges(*sm_ptr)) + { + const Point& a = get(vpm, target(halfedge(e, *sm_ptr), *sm_ptr)); + const Point& b = get(vpm, target(opposite(halfedge(e, *sm_ptr), *sm_ptr), *sm_ptr)); + + positions_lines.push_back(a.x() - center_.x); + positions_lines.push_back(a.y() - center_.y); + positions_lines.push_back(a.z() - center_.z); + + positions_lines.push_back(b.x() - center_.x); + positions_lines.push_back(b.y() - center_.y); + positions_lines.push_back(b.z() - center_.z); + } + + QApplication::restoreOverrideCursor(); + } +}; + +class SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_EXPORT Scene_aff_transformed_surface_mesh_item + : public Scene_aff_transformed_item +{ + Q_OBJECT + +protected: + friend Scene_aff_transformed_surface_mesh_item_priv; + Scene_aff_transformed_surface_mesh_item_priv* d; + +public: + Scene_aff_transformed_surface_mesh_item(Scene_surface_mesh_item* item, + const CGAL::qglviewer::Vec& pos); + + ~Scene_aff_transformed_surface_mesh_item(); + + Scene_surface_mesh_item* item() { return d->sm_item; } + const CGAL::qglviewer::Vec& center() const Q_DECL_OVERRIDE { return d->center_; } + + CGAL::Three::Scene_item* clone() const Q_DECL_OVERRIDE { return nullptr; } + QString name() const Q_DECL_OVERRIDE { return tr("%1_transformed").arg(d->sm_item->name()); } + QString toolTip() const Q_DECL_OVERRIDE; + + bool isEmpty() const Q_DECL_OVERRIDE { return (d->nb_lines == 0); } + + void updateCache(); + + virtual bool supportsRenderingMode(RenderingMode m) const Q_DECL_OVERRIDE { return m == Wireframe ; } + virtual void invalidateOpenGLBuffers() Q_DECL_OVERRIDE; + void initializeBuffers(CGAL::Three::Viewer_interface*) const Q_DECL_OVERRIDE; + + void compute_bbox() const Q_DECL_OVERRIDE; + void computeElements() const Q_DECL_OVERRIDE; + void drawEdges(CGAL::Three::Viewer_interface*) const Q_DECL_OVERRIDE; +}; + +#endif // SCENE_AFF_TRANSFORMED_SURFACE_MESH_ITEM_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp deleted file mode 100644 index 71cc00c5933..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include -#include "Scene_facegraph_transform_item.h" -#include -#include -#include - -using namespace CGAL::Three; -typedef Viewer_interface Vi; -typedef Edge_container Ec; - -struct Scene_facegraph_transform_item_priv -{ - Scene_facegraph_transform_item_priv(const CGAL::qglviewer::Vec& pos,FaceGraph* sm, - const QString name, Scene_facegraph_transform_item *parent) - : manipulable(false), - frame(new CGAL::Three::Scene_item::ManipulatedFrame()), - facegraph(sm), - center_(pos), - item_name(name) - { - item = parent; - const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); - frame->setPosition(pos+offset); - nb_lines = 0; - } - ~Scene_facegraph_transform_item_priv() -{ - delete frame; -} - void compute_elements() const; - - bool manipulable; - CGAL::qglviewer::ManipulatedFrame* frame; - FaceGraph* facegraph; - CGAL::qglviewer::Vec center_; - Scene_facegraph_transform_item *item; - QMatrix4x4 f_matrix; - const QString item_name; - - mutable std::vector positions_lines; - mutable std::size_t nb_lines; -}; - -Scene_facegraph_transform_item::Scene_facegraph_transform_item(const CGAL::qglviewer::Vec& pos, FaceGraph* sm, - const QString name) -{ - d = new Scene_facegraph_transform_item_priv(pos,sm, name, this); - setEdgeContainer(0, new Ec(Vi::PROGRAM_NO_SELECTION, false)); - invalidateOpenGLBuffers(); -} - - -void Scene_facegraph_transform_item_priv::compute_elements() const -{ - QApplication::setOverrideCursor(Qt::WaitCursor); - positions_lines.resize(0); - typedef Kernel::Point_3 Point; - typedef boost::graph_traits::edge_iterator Edge_iterator; - typedef boost::property_map::type VPmap; - VPmap vpmap = get(CGAL::vertex_point, *facegraph); - Edge_iterator he; - for(he = edges(*facegraph).begin(); - he != edges(*facegraph).end(); - he++) - { - const Point& a = get(vpmap, target(halfedge(*he, *facegraph), *facegraph)); - const Point& b = get(vpmap, target(opposite(halfedge(*he, *facegraph), *facegraph), *facegraph)); - positions_lines.push_back(a.x()-center_.x); - positions_lines.push_back(a.y()-center_.y); - positions_lines.push_back(a.z()-center_.z); - - positions_lines.push_back(b.x()-center_.x); - positions_lines.push_back(b.y()-center_.y); - positions_lines.push_back(b.z()-center_.z); - - } - QApplication::restoreOverrideCursor(); -} - -void Scene_facegraph_transform_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const -{ - if(!isInit(viewer)) - initGL(viewer); - if ( getBuffersFilled() && - ! getBuffersInit(viewer)) - { - initializeBuffers(viewer); - setBuffersInit(viewer, true); - } - if(!getBuffersFilled()) - { - computeElements(); - initializeBuffers(viewer); - } - Ec* ec = getEdgeContainer(0); - ec->setColor(this->color()); - ec->setFrameMatrix(d->f_matrix); - ec->draw(viewer, true); -} - -QString Scene_facegraph_transform_item::toolTip() const { - return QObject::tr("

    Affine transformation of %1

    " - "

    Keep Ctrl pressed and use the arcball to define an affine transformation.
    " - "Press S to apply the affine transformation to a copy of %1.

    ") - .arg(d->item_name); -} -bool Scene_facegraph_transform_item::keyPressEvent(QKeyEvent* e){ - if (e->key()==Qt::Key_S){ - Q_EMIT stop(); - return true; - } - return false; -} - -void -Scene_facegraph_transform_item::compute_bbox() const { - typedef boost::property_map::type VPmap; - VPmap vpmap = get(CGAL::vertex_point,*d->facegraph); - const Kernel::Point_3& p = get(vpmap, *vertices(*d->facegraph).begin()); - CGAL::Bbox_3 bbox(p.x(), p.y(), p.z(), p.x(), p.y(), p.z()); - for(boost::graph_traits::vertex_iterator it = vertices(*d->facegraph).begin(); - it != vertices(*d->facegraph).end(); - ++it) { - bbox = bbox + get(vpmap, *it).bbox(); - } - CGAL::qglviewer::Vec vmin(bbox.xmin(),bbox.ymin(),bbox.zmin()); - CGAL::qglviewer::Vec vmax(bbox.xmax(),bbox.ymax(),bbox.zmax()); - setBbox(Bbox(vmin.x,vmin.y,vmin.z, - vmax.x,vmax.y,vmax.z)); -} - - -void Scene_facegraph_transform_item::invalidateOpenGLBuffers() -{ - compute_bbox(); - setBuffersFilled(false); - getEdgeContainer(0)->reset_vbos(ALL); -} - -bool Scene_facegraph_transform_item::manipulatable() const { return d->manipulable; } -CGAL::Three::Scene_item::ManipulatedFrame* Scene_facegraph_transform_item::manipulatedFrame() { return d->frame; } -void Scene_facegraph_transform_item::setManipulatable(bool b = true) { d->manipulable = b;} -const CGAL::qglviewer::Vec& Scene_facegraph_transform_item::center() const { return d->center_; } -Scene_facegraph_transform_item::~Scene_facegraph_transform_item() { delete d; Q_EMIT killed(); } -void Scene_facegraph_transform_item::setFMatrix(double matrix[16]) -{ - for (int i=0; i<16; ++i) - d->f_matrix.data()[i] = (float)matrix[i]; -} - -FaceGraph *Scene_facegraph_transform_item::getFaceGraph() -{ - return d->facegraph; -} - -void Scene_facegraph_transform_item::computeElements() const -{ - d->compute_elements(); - - getEdgeContainer(0)->allocate( - Ec::Vertices, - d->positions_lines.data(), - static_cast(d->positions_lines.size()*sizeof(float))); - d->nb_lines = d->positions_lines.size(); - setBuffersFilled(true); -} -void Scene_facegraph_transform_item::initializeBuffers(Viewer_interface *v) const -{ - getEdgeContainer(0)->initializeBuffers(v); - getEdgeContainer(0)->setFlatDataSize(d->nb_lines); - d->positions_lines.clear(); - d->positions_lines.shrink_to_fit(); -} diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.h b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.h deleted file mode 100644 index 0f2148548a5..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef Scene_facegraph_transform_item_H -#define Scene_facegraph_transform_item_H - -#include "Scene_facegraph_transform_item_config.h" -#include "Kernel_type.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - - -struct Scene_facegraph_transform_item_priv; -typedef CGAL::Surface_mesh FaceGraph; -// This class represents a polyhedron in the OpenGL scene -class SCENE_FACEGRAPH_TRANSFORM_ITEM_EXPORT Scene_facegraph_transform_item - : public CGAL::Three::Scene_item_rendering_helper { - Q_OBJECT - -public: - Scene_facegraph_transform_item(const CGAL::qglviewer::Vec& pos, FaceGraph *sm, - const QString name); - Scene_item* clone() const{return nullptr;} - QString toolTip() const; - void drawEdges(CGAL::Three::Viewer_interface*) const; - void compute_bbox() const; - ~Scene_facegraph_transform_item(); - bool manipulatable() const; - ManipulatedFrame* manipulatedFrame(); - void setManipulatable(bool); - const CGAL::qglviewer::Vec& center() const; - virtual bool supportsRenderingMode(RenderingMode m) const { return m==Wireframe ; } - virtual void invalidateOpenGLBuffers(); - virtual bool keyPressEvent(QKeyEvent*); - void setFMatrix(double matrix[16]); - bool isEmpty() const {return false;} - FaceGraph* getFaceGraph(); - void initializeBuffers(CGAL::Three::Viewer_interface *) const; - void computeElements() const; - -protected: - friend struct Scene_facegraph_transform_item_priv; - Scene_facegraph_transform_item_priv* d; - -Q_SIGNALS: - void stop(); - void killed(); -}; // end class Scene_facegraph_transform_item - -#endif // Scene_facegraph_transform_item_H diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp index 308bd503d95..caea10065a9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp @@ -404,8 +404,8 @@ private Q_SLOTS: // compute centroid Point c = CGAL::centroid(triangles.begin(),triangles.end()); - oliver_queen = new Scene_arrow_item(Vec(c.x(),c.y(),c.z()), fg_item->diagonalBbox() / 50.0f, - fg_item->diagonalBbox()/3.0f); + oliver_queen = new Scene_arrow_item(Vec(c.x(),c.y(),c.z()), fg_item->bboxDiagonal() / 50.0f, + fg_item->bboxDiagonal()/3.0f); Vec dir(plane.orthogonal_vector().x(), plane.orthogonal_vector().y(), plane.orthogonal_vector().z()); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index 1cae60b9a70..5ecc8921433 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -192,7 +192,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveNeedlesAndCaps_tri QDialog dialog; Ui::NeedleDialog ui; ui.setupUi(&dialog); - ui.collapseBox->setValue(sm_item->diagonalBbox()*0.01); + ui.collapseBox->setValue(sm_item->bboxDiagonal()*0.01); if(dialog.exec() != QDialog::Accepted) return; CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces(*sm_item->face_graph(), diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index fc344cec857..68a1fe2c6d3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -928,7 +928,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetectShapesSM_t dialog.m_cluster_epsilon_field->setEnabled(false); dialog.groupBox_3->setEnabled(false); //todo: check default values - dialog.m_epsilon_field->setValue(0.01*sm_item->diagonalBbox()); + dialog.m_epsilon_field->setValue(0.01*sm_item->bboxDiagonal()); std::size_t nb_faces = mesh->number_of_faces(); dialog.m_min_pts_field->setValue((std::max)(static_cast(0.01*nb_faces), 1)); if(!dialog.exec()) return; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp index 84e3b4702ce..87bb50fd96f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp @@ -95,16 +95,19 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_loop(FaceGraphItem* item, void Polyhedron_demo_subdivision_methods_plugin::on_actionLoop_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - - Scene_surface_mesh_item* sm_item = - qobject_cast(scene->item(index)); + Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); if(!sm_item) return; + + bool ok = true; int nb_steps = QInputDialog::getInt(mw, QString("Number of Iterations"), QString("Choose number of iterations"), - 1, - 1); + 1 /* value */, 1 /* min */, (std::numeric_limits::max)() /* max */, 1 /*step*/, + &ok); + if(!ok) + return; + apply_loop(sm_item, nb_steps); } @@ -123,18 +126,23 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_catmullclark(FaceGraphIte item->invalidateOpenGLBuffers(); scene->itemChanged(item); } + void Polyhedron_demo_subdivision_methods_plugin::on_actionCatmullClark_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_surface_mesh_item* sm_item = - qobject_cast(scene->item(index)); + Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); if(!sm_item) return; + + bool ok = true; int nb_steps = QInputDialog::getInt(mw, QString("Number of Iterations"), QString("Choose number of iterations"), - 1, - 1); + 1 /* value */, 1 /* min */, (std::numeric_limits::max)() /* max */, 1 /*step*/, + &ok); + if(!ok) + return; + apply_catmullclark(sm_item, nb_steps); } @@ -157,15 +165,19 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_sqrt3(FaceGraphItem* item void Polyhedron_demo_subdivision_methods_plugin::on_actionSqrt3_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_surface_mesh_item* sm_item = - qobject_cast(scene->item(index)); + Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); if(!sm_item) return; + + bool ok = true; int nb_steps = QInputDialog::getInt(mw, QString("Number of Iterations"), QString("Choose number of iterations"), - 1, - 1); + 1 /* value */, 1 /* min */, (std::numeric_limits::max)() /* max */, 1 /*step*/, + &ok); + if(!ok) + return; + apply_sqrt3(sm_item, nb_steps); } @@ -189,16 +201,19 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_doosabin(FaceGraphItem* i void Polyhedron_demo_subdivision_methods_plugin::on_actionDooSabin_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - - Scene_surface_mesh_item* sm_item = - qobject_cast(scene->item(index)); + Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); if(!sm_item) return; + + bool ok = true; int nb_steps = QInputDialog::getInt(mw, QString("Number of Iterations"), QString("Choose number of iterations"), - 1, - 1); + 1 /* value */, 1 /* min */, (std::numeric_limits::max)() /* max */, 1 /*step*/, + &ok); + if(!ok) + return; + apply_doosabin(sm_item, nb_steps); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index 508716a21e1..845dedbc31f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -41,18 +41,6 @@ if(NOT CGAL_DISABLE_GMP) polyhedron_demo_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) target_link_libraries(mesh_simplification_plugin PUBLIC scene_surface_mesh_item scene_selection_item) - qt5_wrap_ui(remeshingUI_FILES Remeshing_dialog.ui) - polyhedron_demo_plugin(offset_meshing_plugin Offset_meshing_plugin - ${remeshingUI_FILES}) - target_link_libraries(offset_meshing_plugin PUBLIC scene_surface_mesh_item - scene_polygon_soup_item - scene_polylines_item) - if(TARGET CGAL::Eigen3_support) - target_link_libraries(offset_meshing_plugin PUBLIC CGAL::Eigen3_support) - endif() - if(TARGET CGAL::TBB_support) - target_link_libraries(offset_meshing_plugin PUBLIC CGAL::TBB_support) - endif() qt5_wrap_ui(shortestPathUI_FILES Shortest_path_widget.ui) polyhedron_demo_plugin(shortest_path_plugin Shortest_path_plugin diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp deleted file mode 100644 index 860cc2d66e9..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ /dev/null @@ -1,691 +0,0 @@ -#include "config.h" -#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER -#include -#include "ui_Remeshing_dialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include "Scene_surface_mesh_item.h" -#include "Scene_polygon_soup_item.h" -#include "Scene_polylines_item.h" -#include -#include -#include -#include - -#include "C3t3_type.h" - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include // std::shared_ptr - -namespace CGAL{ - -template -class Offset_function -{ - typedef AABB_face_graph_triangle_primitive Primitive; - typedef AABB_traits Traits; - typedef AABB_tree Tree; - typedef Side_of_triangle_mesh Side_of; - -public: - - Offset_function(TriangleMesh& tm, double offset_distance) - : m_tree_ptr(new Tree(boost::begin(faces(tm)), - boost::end(faces(tm)), - tm) ) - , m_side_of_ptr( new Side_of(*m_tree_ptr) ) - , m_offset_distance(offset_distance) - , m_is_closed( is_closed(tm) ) - { - CGAL_assertion(!m_tree_ptr->empty()); - } - - double operator()(const typename GeomTraits::Point_3& p) const - { - using CGAL::sqrt; - - Bounded_side side = m_is_closed?m_side_of_ptr->operator()(p):ON_UNBOUNDED_SIDE; - if (side==ON_BOUNDARY) return m_offset_distance; - - typename GeomTraits::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return (side == ON_UNBOUNDED_SIDE ? -distance : distance) + m_offset_distance; - } - -private: - std::shared_ptr m_tree_ptr; - std::shared_ptr m_side_of_ptr; - double m_offset_distance; - bool m_is_closed; - -}; - -class Polygon_soup_offset_function { - typedef Scene_polygon_soup_item::Points Points; - typedef Scene_polygon_soup_item::Polygons Polygons; - - typedef Polygons::const_iterator Polygon_iterator; - - - class Polygon_soup_point_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Point_3 value_type; - typedef const value_type& reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_point_property_map() = default; - Polygon_soup_point_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend reference get(Polygon_soup_point_property_map map, - key_type polygon_it) - { - return (*map.points_vector_ptr)[*polygon_it->begin()]; - } - }; - - - class Polygon_soup_triangle_property_map { - const Points* points_vector_ptr; - public: - typedef Polygon_iterator key_type; - typedef EPICK::Triangle_3 value_type; - typedef value_type reference; - typedef boost::readable_property_map_tag category; - - Polygon_soup_triangle_property_map() = default; - Polygon_soup_triangle_property_map(const Points* ptr) - : points_vector_ptr(ptr) - {} - - friend value_type get(Polygon_soup_triangle_property_map map, - key_type polygon_it) - { - auto it = polygon_it->begin(); - CGAL_assertion(it != polygon_it->end()); - const auto id0 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id1 = *it++; - CGAL_assertion(it != polygon_it->end()); - const auto id2 = *it++; - CGAL_assertion(it == polygon_it->end()); - - return value_type( (*map.points_vector_ptr)[id0], - (*map.points_vector_ptr)[id1], - (*map.points_vector_ptr)[id2] ); - } - }; - - struct AABB_primitive : - public CGAL::AABB_primitive - { - typedef CGAL::AABB_primitive Base; - - typedef Polygon_iterator Id; - - template - AABB_primitive(Id id, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(id, std::forward(opmap), std::forward(ppmap)) - {} - - template - AABB_primitive(Iterator it, ObjectPmap&& opmap, PointPmap&& ppmap) - : Base(*it, std::forward(opmap), std::forward(ppmap)) - {} - }; // end struct template AABB_primitive - - - typedef CGAL::AABB_traits AABB_traits; - typedef CGAL::AABB_tree AABB_tree; - - std::shared_ptr m_tree_ptr; - double m_offset_distance; - - typedef Polygon_soup_triangle_property_map ObjectPmap; - typedef Polygon_soup_point_property_map PointPmap; -public: - Polygon_soup_offset_function(const Scene_polygon_soup_item* soup, - const double offset_distance) - : m_tree_ptr - (std::make_shared(begin(soup->polygons()), - end(soup->polygons()), - ObjectPmap(&soup->points()), - PointPmap(&soup->points())) - ) - , m_offset_distance(offset_distance) - { - CGAL_assertion(! m_tree_ptr->empty() ); - } - - double operator()(const EPICK::Point_3& p) const - { - using CGAL::sqrt; - - EPICK::Point_3 closest_point = m_tree_ptr->closest_point(p); - double distance = sqrt(squared_distance(p, closest_point)); - - return m_offset_distance - distance; - } - -}; // end class Polygon_soup_offset_function - -} //end of CGAL namespace - -Scene_surface_mesh_item* make_item(SMesh* sm) -{ - return new Scene_surface_mesh_item(sm); -} - -CGAL::Offset_function -offset_function(SMesh* surface_mesh_ptr, double offset_value) { - return { *surface_mesh_ptr, offset_value }; -} - -CGAL::Polygon_soup_offset_function -offset_function(Scene_polygon_soup_item* item, double offset_value) { - return { item, offset_value }; -} - -template -struct Result_type { - typedef T type; -}; - -template <> -struct Result_type { - typedef SMesh type; -}; - -template -CGAL::Bbox_3 bbox(Mesh* mesh_ptr) { - return CGAL::Polygon_mesh_processing::bbox(*mesh_ptr); -} - -CGAL::Bbox_3 bbox(Scene_polygon_soup_item* item) { - return item->bbox(); -} -class MeshGuard{ - SMesh* mesh; - bool done; -public: - MeshGuard(SMesh* mesh):mesh(mesh), done(false){} - void setDone(){done = true;} - ~MeshGuard(){ - if(!done) - delete mesh; - } -}; -// declare the CGAL function -template -SMesh* cgal_off_meshing(QWidget*, - Mesh* tm_ptr, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) -{ - typedef EPICK GT; - typedef CGAL::Labeled_mesh_domain_3 Mesh_domain_base; - typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain; - typedef C3t3::Triangulation Tr; - typedef CGAL::Mesh_criteria_3 Mesh_criteria; - typedef GT::Sphere_3 Sphere_3; - - CGAL::Bbox_3 bbox = ::bbox(tm_ptr); - - GT::Point_3 center((bbox.xmax()+bbox.xmin())/2, - (bbox.ymax()+bbox.ymin())/2, - (bbox.zmax()+bbox.zmin())/2); - double sqrad = 0.6 * std::sqrt( CGAL::square(bbox.xmax()-bbox.xmin())+ - CGAL::square(bbox.ymax()-bbox.ymin())+ - CGAL::square(bbox.zmax()-bbox.zmin()) ) - + offset_value; - sqrad=CGAL::square(sqrad); - - CGAL::Timer timer; - timer.start(); - - namespace p = CGAL::parameters; - - Mesh_domain domain = - Mesh_domain::create_implicit_mesh_domain - (p::function = offset_function(tm_ptr, offset_value), - p::bounding_object = Sphere_3(center, sqrad), - p::relative_error_bound = 1e-7, - p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); - - const CGAL::Mesh_facet_topology topology = CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH; - auto manifold_option = p::non_manifold(); - if(tag == 1) manifold_option = p::manifold_with_boundary(); - if(tag == 2) manifold_option = p::manifold(); - Mesh_criteria criteria(p::facet_angle = angle, - p::facet_size = sizing, - p::facet_distance = approx, - p::facet_topology = topology, - p::edge_size = edge_size); - - if (polylines_item!=nullptr) - { - typedef std::vector Surface_patch_ids; - std::vector surface_patch_ids; - - domain.add_features_and_incidences(polylines_item->polylines.begin(), - polylines_item->polylines.end(), - CGAL::Identity_property_map(), - CGAL::Constant_property_map( - surface_patch_ids)); - } - - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - p::no_perturb(), - p::no_exude(), - manifold_option); - - const Tr& tr = c3t3.triangulation(); - - timer.stop(); - std::cerr << "done (" << timer.time() << " ms, " << tr.number_of_vertices() << " vertices)" << std::endl; - - if(tr.number_of_vertices() > 0) - { - typedef typename Result_type::type Result_mesh; - // add remesh as new polyhedron - Result_mesh *pRemesh = new Result_mesh; - //if the thread is interrupted before the mesh is returned, delete it. - MeshGuard guard(pRemesh); - CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, *pRemesh); - guard.setDone(); - if(CGAL::is_closed(*pRemesh) - && ! CGAL::Polygon_mesh_processing::is_outward_oriented(*pRemesh)) - { - CGAL::Polygon_mesh_processing::reverse_face_orientations(*pRemesh); - } - - return pRemesh; - } - else - return nullptr; -} - -struct Mesher_thread:public QThread{ - Q_OBJECT - -private: - SMesh* sMesh; - Scene_polygon_soup_item* soup_item; - Scene_polylines_item* polylines_item; - const double offset_value; - const double angle; - const double sizing; - const double approx; - const double edge_size; - int tag_index; -public: - Mesher_thread( SMesh* tm_ptr, - Scene_polygon_soup_item* soup_item, - Scene_polylines_item* polylines_item, - const double offset_value, - const double angle, - const double sizing, - const double approx, - const double edge_size, - int tag) - :sMesh(tm_ptr), soup_item(soup_item), polylines_item(polylines_item), - offset_value(offset_value), angle(angle), - sizing(sizing), approx(approx), edge_size(edge_size), tag_index(tag){ - } - void run() override { - SMesh* new_mesh= nullptr; - if(soup_item) - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - new_mesh = cgal_off_meshing(CGAL::Three::Three::mainWindow(), - sMesh, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::getWaitCondition()->wakeAll(); - CGAL::Three::Three::getMutex()->unlock(); - Q_EMIT resultReady(new_mesh); - } -Q_SIGNALS: - void resultReady(SMesh *new_mesh); -}; - -using namespace CGAL::Three; -class Polyhedron_demo_offset_meshing_plugin : - public QObject, - protected Polyhedron_demo_plugin_interface -{ - Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - -public: - void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { - this->scene = scene_interface; - this->mw = mainWindow; - actionOffsetMeshing = new QAction(tr("Offset Meshing"), mw); - actionOffsetMeshing->setProperty("subMenuName", "3D Surface Mesh Generation"); - if(actionOffsetMeshing) { - connect(actionOffsetMeshing, SIGNAL(triggered()), - this, SLOT(offset_meshing())); - } - - actionInflateMesh= new QAction(tr("Inflate Mesh"), mw); - actionInflateMesh->setProperty("subMenuName", "Operations on Polyhedra"); - if(actionInflateMesh) { - connect(actionInflateMesh, SIGNAL(triggered()), - this, SLOT(inflate_mesh())); - } - } - - bool applicable(QAction*) const { - if ( scene->selectionIndices().size() != 1 && - scene->selectionIndices().size() != 2 ) - { - return false; - } - - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) - { - if ( qobject_cast(scene->item(index)) || - qobject_cast(scene->item(index)) ) - return true; - } - return false; - } - - QList actions() const { - return QList() << actionOffsetMeshing - << actionInflateMesh; - } -public Q_SLOTS: - void offset_meshing(); - void inflate_mesh(); - -private: - QAction* actionOffsetMeshing; - QAction* actionInflateMesh; - Scene_interface *scene; - QMainWindow *mw; -}; // end class Polyhedron_demo_offset_meshing_plugin - -void Polyhedron_demo_offset_meshing_plugin::inflate_mesh() -{ - const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Scene_item* item = scene->item(index); - if(item == nullptr){ - return; - } - - Scene_surface_mesh_item* sm_item = - qobject_cast(item); - - if(sm_item == nullptr){ - return; - } - - SMesh* sMesh = sm_item->face_graph(); - - if(sMesh == nullptr){ - return; - } - - double diag = sm_item->diagonalBbox(); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Inflate Distance"), - QString("Inflate Distance (use negative number for deflate)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - auto vpm = get(CGAL::vertex_point,*sMesh); - auto vnm = - sMesh->property_map("v:normal").first; - - for(const auto& v : vertices(*sMesh)) - { - Point_3 p = get(vpm, v); - EPICK::Vector_3 n = get(vnm, v); - n/=(CGAL::sqrt(n.squared_length())); - put(vpm, v, p + offset_value*n); - } - sm_item->invalidateOpenGLBuffers(); -} - -void Polyhedron_demo_offset_meshing_plugin::offset_meshing() -{ - Scene_surface_mesh_item* sm_item = nullptr; - Scene_polygon_soup_item* soup_item = nullptr; - Scene_polylines_item* polylines_item = nullptr; - Scene_item* item = nullptr; - - bool mesh_or_soup_item_found = false; - - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) - { - if (!mesh_or_soup_item_found) - { - sm_item = qobject_cast(scene->item(index)); - if (sm_item == nullptr) - { - soup_item = qobject_cast(item); - if (soup_item != nullptr) - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - else - { - item=scene->item(index); - mesh_or_soup_item_found = true; - continue; - } - } - polylines_item = qobject_cast(scene->item(index)); - } - - SMesh* sMesh = nullptr; - double diag = 0; - Scene_item::Bbox box; - if(sm_item) - { - sMesh = sm_item->face_graph(); - if(!sMesh) - return; - box = bbox(sMesh); - } - else if(soup_item != nullptr) - { - box = bbox(soup_item); - } - else if(soup_item == nullptr) - return; - double X=(box.max)(0)-(box.min)(0), - Y = (box.max)(1)-(box.min)(1), - Z = (box.max)(2)-(box.min)(2); - diag = CGAL::sqrt(X*X+Y*Y+Z*Z); - double offset_value = QInputDialog::getDouble(mw, - QString("Choose Offset Value"), - QString("Offset Value (use negative number for inset)"), - 0.1*diag, - -(std::numeric_limits::max)(), - (std::numeric_limits::max)(), 10); - - QDialog dialog(mw); - Ui::Remeshing_dialog ui; - ui.setupUi(&dialog); - ui.angle->setRange(1.0, 30.0); - connect(ui.buttonBox, SIGNAL(accepted()), - &dialog, SLOT(accept())); - connect(ui.buttonBox, SIGNAL(rejected()), - &dialog, SLOT(reject())); - - ui.sizing->setRange(diag * 10e-6, // min - diag); // max - ui.sizing->setValue(diag * 0.05); // default value - - ui.approx->setRange(diag * 10e-7, // min - diag); // max - ui.approx->setValue(diag * 0.005); - - if (polylines_item!=nullptr) - { - ui.edge_sizing->setRange(diag * 10e-6, // min - diag); // max - ui.edge_sizing->setValue(diag * 0.05); // default value - } - else - ui.edge_sizing->setEnabled(false); - - int i = dialog.exec(); - if(i == QDialog::Rejected) - return; - - const double angle = ui.angle->value(); - const double approx = ui.approx->value(); - const double sizing = ui.sizing->value(); - const double edge_size=polylines_item!=nullptr?ui.edge_sizing->value():0; - const int tag_index = ui.tags->currentIndex(); - - if(tag_index < 0) return; - - QApplication::setOverrideCursor(Qt::WaitCursor); - - std::cerr << "mesh with:" - << "\n angle=" << angle - << "\n sizing=" << sizing - << "\n approx=" << approx - << "\n tag=" << tag_index - << std::boolalpha - << std::endl; - Mesher_thread* worker = nullptr; - if(soup_item) - worker = new Mesher_thread(nullptr, - soup_item, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - else - worker = new Mesher_thread(sMesh, - nullptr, - polylines_item, - offset_value, - angle, - sizing, - approx, - edge_size, - tag_index); - connect(worker, &QThread::finished, worker, &QObject::deleteLater); - connect(worker, &Mesher_thread::resultReady, this, - [item, angle, sizing, approx, offset_value/* , index */] - (SMesh *new_mesh){ - QApplication::restoreOverrideCursor(); - if(!new_mesh){ - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - return; - } - Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item(new_mesh); - new_item->setName(tr("%1 offset %5 (%2 %3 %4)") - .arg(item->name()) - .arg(angle) - .arg(sizing) - .arg(approx) - .arg(offset_value)); - new_item->setColor(Qt::magenta); - new_item->setWireframeMode(); - CGAL::Three::Three::scene()->addItem(new_item); -// CGAL::Three::Three::scene()->itemChanged(index); - QApplication::restoreOverrideCursor(); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = false; - CGAL::Three::Three::getMutex()->unlock(); - }); - QMessageBox* message_box = new QMessageBox(QMessageBox::NoIcon, - "Meshing", - "Offset meshing in progress...", - QMessageBox::Cancel, - mw); - message_box->setDefaultButton(QMessageBox::Cancel); - QAbstractButton* cancelButton = message_box->button(QMessageBox::Cancel); - cancelButton->setText(tr("Stop")); - - connect(cancelButton, &QAbstractButton::clicked, - this, [worker](){ - worker->terminate(); - QApplication::restoreOverrideCursor();//waitcursor - QApplication::restoreOverrideCursor();//busycursor - }); - connect(worker, &Mesher_thread::finished, - message_box, &QMessageBox::close); - message_box->open(); - - QApplication::setOverrideCursor(Qt::BusyCursor); - CGAL::Three::Three::getMutex()->lock(); - CGAL::Three::Three::isLocked() = true; - CGAL::Three::Three::getMutex()->unlock(); - worker->start(); -} - -#include "Offset_meshing_plugin.moc" - -#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Point_container.cpp b/Polyhedron/demo/Polyhedron/Point_container.cpp index a7e4c37a88e..014d016fdea 100644 --- a/Polyhedron/demo/Polyhedron/Point_container.cpp +++ b/Polyhedron/demo/Polyhedron/Point_container.cpp @@ -27,6 +27,11 @@ Point_container::Point_container(int program, bool indexed) } +Point_container::~Point_container() +{ + delete d; +} + void Point_container::initGL(Viewer_interface *viewer) { viewer->makeCurrent(); @@ -64,7 +69,6 @@ void Point_container::initGL(Viewer_interface *viewer) setVbo(Colors, new Vbo("colors", Vbo::COLORS)); - setVao(viewer, new Vao(viewer->getShaderProgram(getProgram()))); if(viewer->getShaderProgram(getProgram())->property("hasNormals").toBool()) { if(!getVbo(Normals)) diff --git a/Polyhedron/demo/Polyhedron/Scene_facegraph_transform_item_config.h b/Polyhedron/demo/Polyhedron/Scene_facegraph_transform_item_config.h deleted file mode 100644 index 50a8908de4b..00000000000 --- a/Polyhedron/demo/Polyhedron/Scene_facegraph_transform_item_config.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef SCENE_FACEGRAPH_TRANSFORM_ITEM_CONFIG_H -#define SCENE_FACEGRAPH_TRANSFORM_ITEM_CONFIG_H - -#if defined( scene_transform_item_EXPORTS) -# define SCENE_FACEGRAPH_TRANSFORM_ITEM_EXPORT Q_DECL_EXPORT -#else -# define SCENE_FACEGRAPH_TRANSFORM_ITEM_EXPORT Q_DECL_IMPORT -#endif - -#endif // SCENE_FACEGRAPH_TRANSFORM_ITEM_CONFIG_H - diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp index e9999831d4e..dcc28a79b08 100644 --- a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_image_item.cpp @@ -542,7 +542,16 @@ Scene_image_item::sigma_weights() const { return d->m_sigma_weights; } - +float +Scene_image_item::default_sigma_weights() const +{ + if(!m_image) + return 0.f; + else + return (std::max)(m_image->image()->vx, + (std::max)(m_image->image()->vy, + m_image->image()->vz)); +} void Scene_image_item::draw(Viewer_interface* viewer) const diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.h b/Polyhedron/demo/Polyhedron/Scene_image_item.h index fadffb352c4..1dffd5ba32d 100644 --- a/Polyhedron/demo/Polyhedron/Scene_image_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_image_item.h @@ -48,6 +48,7 @@ public: Image* image_weights() const; void set_image_weights(const Image& img, const float sigma); float sigma_weights() const; + float default_sigma_weights() const; void invalidateOpenGLBuffers(); void initializeBuffers(Viewer_interface *) const; diff --git a/Polyhedron/demo/Polyhedron/Scene_item.cpp b/Polyhedron/demo/Polyhedron/Scene_item.cpp index 1951ee8ff7c..1b54ec52993 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item.cpp @@ -22,7 +22,7 @@ CGAL::Three::Scene_item::Scene_item(int buffers_size, int vaos_size) CGAL::QGLViewer::QGLViewerPool().first()->makeCurrent(); is_bbox_computed = false; - is_diag_bbox_computed = false; + is_bbox_diag_computed = false; for(int i=0; iis_diag_bbox_computed) +double Scene_item_rendering_helper::bboxDiagonal() const { + if(!priv->is_bbox_diag_computed) priv->compute_diag_bbox(); - priv->is_diag_bbox_computed = true; + priv->is_bbox_diag_computed = true; return priv->_diag_bbox; } @@ -221,7 +221,7 @@ void Scene_item_rendering_helper::setEdgeContainer(std::size_t id, } void Scene_item_rendering_helper::setPointContainer(std::size_t id, - Point_container* pc) + Point_container* pc) { if(priv->point_containers.size() <= id) { diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index e2b93295cbc..75bea895cfa 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -27,13 +27,6 @@ #include #include -#include -#include -#include -#include - -#include - #ifdef CGAL_LINKED_WITH_TBB #include #include @@ -42,14 +35,22 @@ const std::size_t limit_fast_drawing = 300000; //arbitrary large value +#include +#include +#include + + typedef CGAL::Three::Point_container Pc; typedef CGAL::Three::Edge_container Ec; typedef CGAL::Three::Viewer_interface VI; + typedef Scene_points_with_normal_item_priv Priv; + struct Scene_points_with_normal_item_priv { - enum Point_container_id{ - Points =0, + enum Point_container_id + { + Points = 0, Shaded_points, Selected_points, Selected_shaded_points @@ -68,44 +69,41 @@ struct Scene_points_with_normal_item_priv point_Slider->setMinimum(1); point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize()); point_Slider->setMaximum(25); - item->setPointContainer(Priv::Selected_shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, - false)); - item->setPointContainer(Priv::Selected_points, new Pc(VI::PROGRAM_NO_SELECTION, - false)); - item->setPointContainer(Priv::Shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, - false)); - item->setPointContainer(Priv::Points, new Pc(VI::PROGRAM_NO_SELECTION, - false)); - item->setEdgeContainer(0, new Ec(VI::PROGRAM_NO_SELECTION, - false)); - + item->setPointContainer(Priv::Selected_shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, false)); + item->setPointContainer(Priv::Selected_points, new Pc(VI::PROGRAM_NO_SELECTION, false)); + item->setPointContainer(Priv::Shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, false)); + item->setPointContainer(Priv::Points, new Pc(VI::PROGRAM_NO_SELECTION, false)); + item->setEdgeContainer(0, new Ec(VI::PROGRAM_NO_SELECTION, false)); } + Scene_points_with_normal_item_priv(Scene_points_with_normal_item* parent) - :m_points(new Point_set) + : m_points(new Point_set) { init_values(parent); } - Scene_points_with_normal_item_priv(const Scene_points_with_normal_item& toCopy, Scene_points_with_normal_item* parent) + + Scene_points_with_normal_item_priv(const Scene_points_with_normal_item& toCopy, + Scene_points_with_normal_item* parent) : m_points(new Point_set(*toCopy.d->m_points)) { init_values(parent); } - Scene_points_with_normal_item_priv(const SMesh& input_mesh, Scene_points_with_normal_item* parent) + Scene_points_with_normal_item_priv(const SMesh& input_mesh, + Scene_points_with_normal_item* parent) : m_points(new Point_set) { - init_values(parent); - boost::graph_traits::vertex_iterator v; + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + + init_values(parent); + + auto vpm = get(CGAL::vertex_point, input_mesh); + auto vnormals = get(CGAL::dynamic_vertex_property_t(), input_mesh); + CGAL::Polygon_mesh_processing::compute_vertex_normals(input_mesh, vnormals); + m_points->add_normal_map(); - for (v = const_cast(input_mesh).vertices_begin(); - v != const_cast(input_mesh).vertices_end(); v++) - { - boost::graph_traits::vertex_descriptor vd(*v); - const Kernel::Point_3& p = input_mesh.point(vd); - Kernel::Vector_3 n = - CGAL::Polygon_mesh_processing::compute_vertex_normal(vd, input_mesh); - m_points->insert(p,n); - } + for(vertex_descriptor v : vertices(input_mesh)) + m_points->insert(get(vpm, v), get(vnormals, v)); } ~Scene_points_with_normal_item_priv() @@ -118,6 +116,7 @@ struct Scene_points_with_normal_item_priv delete normal_Slider; delete point_Slider; } + bool isPointSliderMoving() { return is_point_slider_moving; } void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const; void compute_normals_and_vertices() const; @@ -143,9 +142,10 @@ struct Scene_points_with_normal_item_priv Scene_points_with_normal_item* item; }; -class Fill_buffers { - +class Fill_buffers +{ Point_set* point_set; + std::vector& indices; std::vector& positions_lines; std::vector& positions_normals; @@ -212,19 +212,16 @@ public: } }; - - Scene_points_with_normal_item::Scene_points_with_normal_item() { - setRenderingMode(Points); - is_selected = true; - d = new Scene_points_with_normal_item_priv(this); + setRenderingMode(Points); + is_selected = true; + d = new Scene_points_with_normal_item_priv(this); } // Copy constructor Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy) { - d = new Scene_points_with_normal_item_priv(toCopy, this); if (!has_normals()) @@ -232,7 +229,8 @@ Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_ setRenderingMode(Points); is_selected = true; } - else{ + else + { setRenderingMode(CGAL::Three::Three::defaultPointSetRenderingMode()); is_selected = true; } @@ -323,7 +321,7 @@ void Scene_points_with_normal_item_priv::compute_normals_and_vertices() const positions_selected_normals.resize(m_points->nb_selected_points() * 3); // we can't afford computing real average spacing just for display, 0.5% of bbox will do - average_spacing = 0.005 * item->diagonalBbox(); + average_spacing = 0.005 * item->bboxDiagonal(); normal_length = (std::min)(average_spacing, std::sqrt( region_of_interest.squared_radius() / 1000.)); length_factor = 10.0/100*normal_Slider->value(); @@ -692,7 +690,6 @@ void Scene_points_with_normal_item::drawEdges(CGAL::Three::Viewer_interface* vie void Scene_points_with_normal_item:: drawPoints(CGAL::Three::Viewer_interface* viewer) const { - GLfloat point_size; viewer->glGetFloatv(GL_POINT_SIZE, &point_size); viewer->setGlPointSize(GLfloat(d->point_Slider->value())); @@ -735,18 +732,16 @@ drawPoints(CGAL::Three::Viewer_interface* viewer) const { if(!d->m_points->has_colors()) getPointContainer(Priv::Points)->setColor(color()); - std::size_t real_size = - getPointContainer(Priv::Points)->getFlatDataSize(); + std::size_t real_size = getPointContainer(Priv::Points)->getFlatDataSize(); getPointContainer(Priv::Points)->setFlatDataSize(ratio_displayed * real_size); getPointContainer(Priv::Points)->setFlatDataSize(real_size); - getPointContainer(Priv::Points)->draw( viewer, !d->m_points->has_colors()); + getPointContainer(Priv::Points)->draw(viewer, !d->m_points->has_colors()); - real_size = - getPointContainer(Priv::Selected_points)->getFlatDataSize(); + real_size = getPointContainer(Priv::Selected_points)->getFlatDataSize(); getPointContainer(Priv::Selected_points)->setColor(QColor(Qt::red)); getPointContainer(Priv::Selected_points)->setFlatDataSize(ratio_displayed * real_size); getPointContainer(Priv::Selected_points)->setFlatDataSize(real_size); - getPointContainer(Priv::Selected_points)->draw( viewer, true); + getPointContainer(Priv::Selected_points)->draw(viewer, true); } viewer->setGlPointSize(point_size); diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h index 7594dba0ef4..e306b96dee2 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h @@ -36,11 +36,11 @@ class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item public: Scene_points_with_normal_item(); + Scene_points_with_normal_item(const SMesh& input_mesh); Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy); - Scene_points_with_normal_item(const SMesh& input_mesh); - ~Scene_points_with_normal_item(); + Scene_points_with_normal_item* clone() const Q_DECL_OVERRIDE; // Is selection empty? diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h index 9fd1aed124f..eeb51d0ca3a 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h @@ -9,6 +9,7 @@ #include struct Scene_polygon_soup_item_priv; + struct Polygon_soup { typedef EPICK::Point_3 Point_3; diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index 75db7480aaa..21a550c6b70 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -296,45 +296,33 @@ struct Scene_surface_mesh_item_priv{ }; const char* aabb_property_name = "Scene_surface_mesh_item aabb tree"; + +void Scene_surface_mesh_item::initialize_priv() +{ + CGAL_precondition(d != nullptr); + + d->floated = false; + setRenderingMode(CGAL::Three::Three::defaultSurfaceMeshRenderingMode()); + d->checkFloat(); + d->textVItems = new TextListItem(this); + d->textEItems = new TextListItem(this); + d->textFItems = new TextListItem(this); + + are_buffers_filled = false; + invalidate(ALL); +} + Scene_surface_mesh_item::Scene_surface_mesh_item() { d = new Scene_surface_mesh_item_priv(new SMesh(), this); - d->floated = false; - setRenderingMode(CGAL::Three::Three::defaultSurfaceMeshRenderingMode()); - d->checkFloat(); - d->textVItems = new TextListItem(this); - d->textEItems = new TextListItem(this); - d->textFItems = new TextListItem(this); - - are_buffers_filled = false; - invalidate(ALL); + initialize_priv(); } -Scene_surface_mesh_item::Scene_surface_mesh_item(const Scene_surface_mesh_item& other) -{ - d = new Scene_surface_mesh_item_priv(other, this); - setRenderingMode(CGAL::Three::Three::defaultSurfaceMeshRenderingMode()); - d->floated = false; - d->checkFloat(); - d->textVItems = new TextListItem(this); - d->textEItems = new TextListItem(this); - d->textFItems = new TextListItem(this); - - are_buffers_filled = false; - invalidate(ALL); -} - -void Scene_surface_mesh_item::standard_constructor(SMesh* sm) +Scene_surface_mesh_item::Scene_surface_mesh_item(SMesh* sm) { d = new Scene_surface_mesh_item_priv(sm, this); - d->floated = false; - setRenderingMode(CGAL::Three::Three::defaultSurfaceMeshRenderingMode()); - d->checkFloat(); - d->textVItems = new TextListItem(this); - d->textEItems = new TextListItem(this); - d->textFItems = new TextListItem(this); - are_buffers_filled = false; - invalidate(ALL); + initialize_priv(); + std::size_t isolated_v = 0; for(vertex_descriptor v : vertices(*sm)) { @@ -344,21 +332,20 @@ void Scene_surface_mesh_item::standard_constructor(SMesh* sm) } } setNbIsolatedvertices(isolated_v); - -} -Scene_surface_mesh_item::Scene_surface_mesh_item(SMesh* sm) -{ - standard_constructor(sm); } Scene_surface_mesh_item::Scene_surface_mesh_item(const SMesh& sm) -{ - standard_constructor(new SMesh(sm)); -} + : Scene_surface_mesh_item(new SMesh(sm)) +{ } Scene_surface_mesh_item::Scene_surface_mesh_item(SMesh&& sm) + : Scene_surface_mesh_item(new SMesh(std::move(sm))) +{ } + +Scene_surface_mesh_item::Scene_surface_mesh_item(const Scene_surface_mesh_item& other) { - standard_constructor(new SMesh(std::move(sm))); + d = new Scene_surface_mesh_item_priv(other, this); + initialize_priv(); } Scene_surface_mesh_item* @@ -751,7 +738,6 @@ void Scene_surface_mesh_item_priv::initialize_colors() const void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const { - item->getTriangleContainer(1)->initializeBuffers(viewer); item->getTriangleContainer(0)->initializeBuffers(viewer); item->getEdgeContainer(1)->initializeBuffers(viewer); @@ -2397,7 +2383,7 @@ void Scene_surface_mesh_item::setAlpha(int alpha) QSlider* Scene_surface_mesh_item::alphaSlider() { return d->alphaSlider; } -void Scene_surface_mesh_item::computeElements()const +void Scene_surface_mesh_item::computeElements() const { d->compute_elements(ALL); setBuffersFilled(true); @@ -2405,7 +2391,7 @@ void Scene_surface_mesh_item::computeElements()const } void -Scene_surface_mesh_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const +Scene_surface_mesh_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer) const { const_cast(this)->//temporary, until the drawing pipeline is not const anymore. d->initializeBuffers(viewer); @@ -2425,8 +2411,9 @@ void Scene_surface_mesh_item::computeItemColorVectorAutomatically(bool b) this->setProperty("recompute_colors",b); } -void write_in_vbo(Vbo* vbo, cgal_gl_data* data, - std::size_t size) +void write_in_vbo(Vbo* vbo, + cgal_gl_data* data, + std::size_t size) { vbo->bind(); vbo->vbo.write(static_cast((3*size)*sizeof(cgal_gl_data)), diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h index 7639c066a5e..59ac5537a6e 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h @@ -28,33 +28,37 @@ #include "properties.h" - class QSlider; + struct Scene_surface_mesh_item_priv; + class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item - : public CGAL::Three::Scene_item_rendering_helper, + : public CGAL::Three::Scene_item_rendering_helper, public CGAL::Three::Scene_item_with_properties, public CGAL::Three::Scene_zoomable_item_interface, - public CGAL::Three::Scene_print_item_interface{ + public CGAL::Three::Scene_print_item_interface +{ Q_INTERFACES(CGAL::Three::Scene_print_item_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0") Q_OBJECT Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0") + public: typedef SMesh Face_graph; typedef SMesh::Property_map Vertex_selection_map; typedef SMesh::Property_map Face_selection_map; + + void initialize_priv(); Scene_surface_mesh_item(); // Takes ownership of the argument. Scene_surface_mesh_item(SMesh*); Scene_surface_mesh_item(const SMesh&); - Scene_surface_mesh_item(SMesh&&); + Scene_surface_mesh_item(SMesh&&); Scene_surface_mesh_item(const Scene_surface_mesh_item& other); ~Scene_surface_mesh_item(); - Scene_surface_mesh_item* clone() const Q_DECL_OVERRIDE; void draw(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE; void drawEdges(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE; @@ -100,7 +104,6 @@ public: void compute_bbox()const Q_DECL_OVERRIDE; - void standard_constructor(SMesh *sm); bool save(std::ostream& out) const; bool save_obj(std::ostream& out) const; bool load_obj(std::istream& in); diff --git a/Polyhedron/demo/Polyhedron/Use_ssh.cpp b/Polyhedron/demo/Polyhedron/Use_ssh.cpp index 965abf23024..a4495160fbc 100644 --- a/Polyhedron/demo/Polyhedron/Use_ssh.cpp +++ b/Polyhedron/demo/Polyhedron/Use_ssh.cpp @@ -26,6 +26,10 @@ #include #include + +#include +#include + bool test_result(int res) { switch(res){ @@ -240,21 +244,22 @@ bool push_file(ssh_session &session, const char* dest_path, const char* filepath) { + std::size_t processed = 0; + sftp_file sftpfile; //copy a file - ssh_scp scp = ssh_scp_new( - session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, "/tmp"); - if (scp == nullptr) + sftp_session sftp = sftp_new(session); + if (sftp == nullptr) { - std::cerr<<"Error allocating scp session: %s\n" + std::cerr<<"Error allocating sftp session:\n" << ssh_get_error(session)< timespan(size); - std::this_thread::sleep_for(timespan); - if (res != SSH_OK) + while ( size > 0 ) { - std::cerr<< "Can't write to remote file: %s\n" - << ssh_get_error(session)< 16384) + s = 16384; + res = sftp_write(sftpfile, buffer.data() + processed, s); + if ( res < 0) + { + std::cerr<< "Can't write data to file:\n" + << ssh_get_error(session)< buffer; - - ssh_scp scp = ssh_scp_new( - session, SSH_SCP_READ | SSH_SCP_RECURSIVE, from_path); - if (scp == nullptr) + sftp_file sftpfile; + sftp_session sftp = sftp_new(session); + if (sftp == nullptr) { - std::cerr<<"Error allocating scp session: %s\n" + std::cerr<<"Error allocating sftp session:\n" << ssh_get_error(session)<size; buffer.resize(size); - if(ssh_scp_accept_request(scp) != SSH_OK) + while ( size > 0 ) { - std::cerr<< "Could not accept request."< 16384) + s = 16384; + res = sftp_read(sftpfile, buffer.data() + processed, s); + if ( res < 0) { - std::cerr<< "Error receiving file data: %s\n"<< ssh_get_error(session)<size; std::ofstream file(to_path, std::ios::binary |std::ios::trunc); if(!file.write(buffer.data(), size)) { std::cerr<<"Error while writing file."<border halfedges
    and have no incident facet. An edge is a border edge if one of its halfedges is a border halfedge. A surface is closed if it contains no border halfedges. A closed surface is a boundary - representation for polyhedra in three dimensions. The convention is + representation for a polyhedron in three dimensions. The convention is that the halfedges are oriented counterclockwise around facets as seen from the outside of the polyhedron. An implication is that the halfedges are oriented clockwise around the vertices. The notion of @@ -32,7 +32,7 @@ namespace CGAL { always an orientable and oriented 2-manifold with border edges, i.e., the neighborhood of each point on the polyhedral surface is either homeomorphic to a disc or to a half disc, except for vertices where - many holes and surfaces with boundary can join. Another implication is + multiple holes join. Another implication is that the smallest representable surface is a triangle (for polyhedral surfaces with border edges) or a tetrahedron (for polyhedra). Boundary representations of orientable 2-manifolds are closed under Euler diff --git a/Polyhedron/doc/Polyhedron/Polyhedron.txt b/Polyhedron/doc/Polyhedron/Polyhedron.txt index 0cef005c0ab..cff55a73257 100644 --- a/Polyhedron/doc/Polyhedron/Polyhedron.txt +++ b/Polyhedron/doc/Polyhedron/Polyhedron.txt @@ -15,7 +15,7 @@ edges, facets and an incidence relationship on them. The organization beneath is a halfedge data structure, which restricts the class of representable surfaces to orientable 2-manifolds - with and without boundary. If the surface is closed we call it a polyhedron, for -example, see the following model of a hammerhead: +example, see the following model of a hammerhead: \image html shark.png \image latex shark.png @@ -26,8 +26,8 @@ the combinatorial integrity of them. It is based on the highly flexible design of the halfedge data structure, see the introduction in Chapter \ref chapterHalfedgeDS "Halfedge Data Structures" and \cgalCite{k-ugpdd-99}. However, the polyhedral surface can be used and understood without knowing the -underlying design. Some of the examples in this chapter introduce also -gradually into first applications of this flexibility. +underlying design. Some of the examples in this chapter gradually +introduce applications of this flexibility. \section PolyhedronDefinition Definition @@ -41,13 +41,15 @@ halfedge are illustrated in the following figure: \image latex halfedge_small.png Vertices represent points in space. Edges are straight line segments -between two endpoints. Facets are planar polygons without +between two endpoints. Facets are planar, possibly non-convex, polygons without holes. Facets are defined by the circular sequence of halfedges along their boundary. The polyhedral surface itself can have holes (with at least two facets surrounding it since a single facet cannot have a -hole). The halfedges along the boundary of a hole are called border halfedges and have no incident facet. An edge is a border edge if one of its halfedges is a border halfedge. A +hole). The halfedges along the boundary of a hole are called +border halfedges and have no incident facet. An edge is a +border edge if one of its halfedges is a border halfedge. A surface is closed if it contains no border halfedges. A closed -surface is a boundary representation for polyhedra in three +surface is a boundary representation for a polyhedron in three dimensions. The convention is that the halfedges are oriented counterclockwise around facets as seen from the outside of the polyhedron. An implication is that the halfedges are oriented @@ -62,7 +64,7 @@ implication of this definition is that the polyhedral surface is always an orientable and oriented 2-manifold with border edges, i.e., the neighborhood of each point on the polyhedral surface is either homeomorphic to a disc or to a half disc, except for vertices where -many holes and surfaces with boundary can join. Another implication is +multiple holes join. Another implication is that the smallest representable surface avoiding self intersections is a triangle (for polyhedral surfaces with border edges) or a tetrahedron (for polyhedra). Boundary representations of orientable @@ -109,7 +111,7 @@ are provided too. The example continues with a test if the halfedge actually refers to a tetrahedron. This test checks the connected component referred to by the halfedge `h` and not the polyhedral -surface as a whole. This examples works only on the combinatorial +surface as a whole. This example works only on the combinatorial level of a polyhedral surface. The next example adds the geometry. \cgalExample{Polyhedron/polyhedron_prog_simple.cpp} diff --git a/Polyhedron/include/CGAL/Polyhedron_3_to_lcc.h b/Polyhedron/include/CGAL/Polyhedron_3_to_lcc.h index 363ef73cfa2..c284f6e60b1 100644 --- a/Polyhedron/include/CGAL/Polyhedron_3_to_lcc.h +++ b/Polyhedron/include/CGAL/Polyhedron_3_to_lcc.h @@ -30,7 +30,7 @@ namespace CGAL { typename LCC::Dart_descriptor import_from_polyhedron_3(LCC& alcc, const Polyhedron &apoly) { - CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==3 ); + static_assert( LCC::dimension>=2 && LCC::ambient_dimension==3 ); typedef typename Polyhedron::Halfedge_const_handle Halfedge_handle; typedef typename Polyhedron::Facet_const_iterator Facet_iterator; diff --git a/Polynomial/include/CGAL/Exponent_vector.h b/Polynomial/include/CGAL/Exponent_vector.h index 72c5e1d8f26..1a06965514d 100644 --- a/Polynomial/include/CGAL/Exponent_vector.h +++ b/Polynomial/include/CGAL/Exponent_vector.h @@ -59,7 +59,7 @@ public: :v(begin,end){ typedef typename std::iterator_traits::value_type value_type; CGAL_USE_TYPE(value_type); - CGAL_static_assertion(( ::std::is_same::value)); + static_assert(::std::is_same::value); } diff --git a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h index b5576f5489c..f989b8ff201 100644 --- a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h +++ b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h @@ -273,9 +273,9 @@ class Polynomial_algebraic_structure_traits_base< POLY, Field_tag > template < class NT1, class NT2 > void operator()( const NT1& x, const NT2& y, POLY& q, POLY& r ) const { - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< typename Coercion_traits< NT1, NT2 >::Type, POLY - >::value)); + >::value); typename Coercion_traits< NT1, NT2 >::Cast cast; operator()( cast(x), cast(y), q, r ); diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index f1055bedbd0..e2529d2e349 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -545,8 +545,8 @@ public: * Also available as non-member function. */ CGAL::Sign sign() const { -// CGAL_static_assertion( (std::is_same< typename Real_embeddable_traits::Is_real_embeddable, -// CGAL::Tag_true>::value) ); +// static_assert(std::is_same< typename Real_embeddable_traits::Is_real_embeddable, +// CGAL::Tag_true>::value); return CGAL::sign(lcoeff()); } diff --git a/Polynomial/include/CGAL/Polynomial/subresultants.h b/Polynomial/include/CGAL/Polynomial/subresultants.h index 4ea568bf212..e6f4eb40fcd 100644 --- a/Polynomial/include/CGAL/Polynomial/subresultants.h +++ b/Polynomial/include/CGAL/Polynomial/subresultants.h @@ -775,7 +775,7 @@ namespace CGAL { CGAL::Integral_domain_without_division_tag) { // polynomial_subresultants_with_cofactors requires // a model of IntegralDomain as coefficient type; - CGAL_static_assertion(sizeof(Polynomial_traits_d)==0); + static_assert(sizeof(Polynomial_traits_d)==0); return sres_out; } diff --git a/Polynomial/include/CGAL/Polynomial_traits_d.h b/Polynomial/include/CGAL/Polynomial_traits_d.h index 8172dd12395..f7a4d3993e3 100644 --- a/Polynomial/include/CGAL/Polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Polynomial_traits_d.h @@ -566,7 +566,7 @@ public: template Polynomial_d construct_value_type(Input_iterator begin, Input_iterator end, NT) const { typedef CGAL::Coercion_traits CT; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); typename CT::Cast cast; return Polynomial_d( boost::make_transform_iterator(begin,cast), @@ -667,7 +667,7 @@ public: typedef Polynomial_traits_d PT; typename PT::Construct_polynomial construct; - CGAL_static_assertion(PT::d != 0); // Coefficient_type is a Polynomial + static_assert(PT::d != 0); // Coefficient_type is a Polynomial std::vector coefficients; Coefficient_type zero(0); diff --git a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h index c9097031598..b40a6d882f7 100644 --- a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h @@ -50,7 +50,7 @@ static CGAL::Random my_rnd(346); // some seed #define ASSERT_IS_NULL_FUNCTOR(T) \ - CGAL_static_assertion((std::is_same::value)) + static_assert(std::is_same::value) @@ -178,10 +178,10 @@ void test_construct_polynomial(const Polynomial_traits_d&){ } { // Construct_polynomial typedef typename PT::Construct_polynomial Constructor; - CGAL_static_assertion( + static_assert( !(std::is_same< Constructor , CGAL::Null_functor >::value)); typedef typename Constructor::result_type result_type; - CGAL_static_assertion( + static_assert( (std::is_same< result_type , Polynomial_d >::value)); CGAL_USE_TYPE(result_type); typedef typename PT::Shift Shift; @@ -1802,23 +1802,23 @@ void test_rebind(const PT& /*traits*/){ { typedef typename PT:: template Rebind::Other PT_IC_1; CGAL_USE_TYPE(PT_IC_1); - CGAL_static_assertion((std::is_same< typename PT_IC_1::Innermost_coefficient_type, - IC>::value)); - CGAL_static_assertion((PT_IC_1::d==1)); + static_assert(std::is_same< typename PT_IC_1::Innermost_coefficient_type, + IC>::value); + static_assert(PT_IC_1::d==1); } { typedef typename PT:: template Rebind::Other PT_IC_2; CGAL_USE_TYPE(PT_IC_2); - CGAL_static_assertion((std::is_same< typename PT_IC_2::Innermost_coefficient_type, - IC>::value)); - CGAL_static_assertion((PT_IC_2::d==2)); + static_assert(std::is_same< typename PT_IC_2::Innermost_coefficient_type, + IC>::value); + static_assert(PT_IC_2::d==2); } { typedef typename PT:: template Rebind::Other PT_IC_3; CGAL_USE_TYPE(PT_IC_3); - CGAL_static_assertion((std::is_same< typename PT_IC_3::Innermost_coefficient_type, - IC>::value)); - CGAL_static_assertion((PT_IC_3::d==3)); + static_assert(std::is_same< typename PT_IC_3::Innermost_coefficient_type, + IC>::value); + static_assert(PT_IC_3::d==3); } { typedef typename PT:: template Rebind::Other PT_IC_1; @@ -1831,12 +1831,12 @@ void test_rebind(const PT& /*traits*/){ typedef typename PT_IC_1::Polynomial_d Poly1; typedef typename PT_IC_2::Polynomial_d Poly2; - CGAL_static_assertion((std::is_same< typename PT_IC_1::Coefficient_type, - IC>::value)); - CGAL_static_assertion((std::is_same< typename PT_IC_2::Coefficient_type, - Poly1>::value)); - CGAL_static_assertion((std::is_same< typename PT_IC_3::Coefficient_type, - Poly2>::value)); + static_assert(std::is_same< typename PT_IC_1::Coefficient_type, + IC>::value); + static_assert(std::is_same< typename PT_IC_2::Coefficient_type, + Poly1>::value); + static_assert(std::is_same< typename PT_IC_3::Coefficient_type, + Poly2>::value); } @@ -1850,12 +1850,12 @@ void test_rebind(const PT& /*traits*/){ CGAL_USE_TYPE(PT_Integer_4); typedef typename PT:: template Rebind::Other PT_Rational_4; CGAL_USE_TYPE(PT_Rational_4); - CGAL_static_assertion((std::is_same< typename PT_Integer_4::Innermost_coefficient_type, - Integer>::value)); - CGAL_static_assertion((std::is_same< typename PT_Rational_4::Innermost_coefficient_type, - Rational>::value)); - CGAL_static_assertion((PT_Integer_4::d==dimension)); - CGAL_static_assertion((PT_Rational_4::d==dimension)); + static_assert(std::is_same< typename PT_Integer_4::Innermost_coefficient_type, + Integer>::value); + static_assert(std::is_same< typename PT_Rational_4::Innermost_coefficient_type, + Rational>::value); + static_assert(PT_Integer_4::d==dimension); + static_assert(PT_Rational_4::d==dimension); } #endif #ifdef CGAL_USE_CORE @@ -1867,12 +1867,12 @@ void test_rebind(const PT& /*traits*/){ typedef typename PT:: template Rebind::Other PT_Rational_4; CGAL_USE_TYPE(PT_Integer_4); CGAL_USE_TYPE(PT_Rational_4); - CGAL_static_assertion((std::is_same< typename PT_Integer_4::Innermost_coefficient_type, - Integer>::value)); - CGAL_static_assertion((std::is_same< typename PT_Rational_4::Innermost_coefficient_type, - Rational>::value)); - CGAL_static_assertion((PT_Integer_4::d==4)); - CGAL_static_assertion((PT_Rational_4::d==4)); + static_assert(std::is_same< typename PT_Integer_4::Innermost_coefficient_type, + Integer>::value); + static_assert(std::is_same< typename PT_Rational_4::Innermost_coefficient_type, + Rational>::value); + static_assert(PT_Integer_4::d==4); + static_assert(PT_Rational_4::d==4); } #endif { @@ -1880,12 +1880,12 @@ void test_rebind(const PT& /*traits*/){ typedef typename PT:: template Rebind::Other PT_Rational_4; CGAL_USE_TYPE(PT_Integer_4); CGAL_USE_TYPE(PT_Rational_4); - CGAL_static_assertion((std::is_same< typename PT_Integer_4::Innermost_coefficient_type, - int>::value)); - CGAL_static_assertion((std::is_same< typename PT_Rational_4::Innermost_coefficient_type, - double>::value)); - CGAL_static_assertion((PT_Integer_4::d==4)); - CGAL_static_assertion((PT_Rational_4::d==4)); + static_assert(std::is_same< typename PT_Integer_4::Innermost_coefficient_type, + int>::value); + static_assert(std::is_same< typename PT_Rational_4::Innermost_coefficient_type, + double>::value); + static_assert(PT_Integer_4::d==4); + static_assert(PT_Rational_4::d==4); } } diff --git a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp index d2b0c931512..8d8497ed139 100644 --- a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp +++ b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp @@ -12,14 +12,14 @@ int main(){ { typedef CGAL::Polynomial_type_generator::Type Polynomial; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); } } diff --git a/Polynomial/test/Polynomial/test_polynomial.h b/Polynomial/test/Polynomial/test_polynomial.h index 5637578e945..c1943d96ae9 100644 --- a/Polynomial/test/Polynomial/test_polynomial.h +++ b/Polynomial/test/Polynomial/test_polynomial.h @@ -34,7 +34,7 @@ inline void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Coercion_type RET; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); r = typename CT::Cast()(x); } } //namespace CGAL @@ -887,7 +887,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typename SFT::Scalar_factor sfac; @@ -913,7 +913,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - CGAL_static_assertion((::std::is_same::value)); + static_assert(::std::is_same::value); typename SFT::Scalar_factor sfac; diff --git a/Polynomial/test/Polynomial/test_polynomial_Coercion_traits.cpp b/Polynomial/test/Polynomial/test_polynomial_Coercion_traits.cpp index 5760a12eda0..ca30d9e8ed0 100644 --- a/Polynomial/test/Polynomial/test_polynomial_Coercion_traits.cpp +++ b/Polynomial/test/Polynomial/test_polynomial_Coercion_traits.cpp @@ -147,9 +147,9 @@ void test_coercion_traits(){ /* { typedef CGAL::Coercion_traits CT; - CGAL_static_assertion(( + static_assert( ::std::is_same< typename CT::Are_implicit_interoperable, - CGAL::Tag_false>::value)); + CGAL::Tag_false>::value); } */ diff --git a/Polynomial/test/Polynomial/test_polynomial_Get_arithmetic_kernel.cpp b/Polynomial/test/Polynomial/test_polynomial_Get_arithmetic_kernel.cpp index 7107ed8f04e..5edd4a40835 100644 --- a/Polynomial/test/Polynomial/test_polynomial_Get_arithmetic_kernel.cpp +++ b/Polynomial/test/Polynomial/test_polynomial_Get_arithmetic_kernel.cpp @@ -7,11 +7,11 @@ void test_get_arithmetic_kernel(){ { typedef CGAL::Polynomial POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); }{ typedef CGAL::Polynomial > POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); } } diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index e09c6eaf571..d4052642864 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -190,10 +190,10 @@ class Ridge_approximation //requirements for the templates TriangleMesh and VertexFTMap or VertexVectorMap - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); typedef std::pair< halfedge_descriptor, FT> Ridge_halfedge; typedef Ridge_halfedge Ridge_halfhedge; // kept for backward compatibility diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index 945fb986ae7..f815b9c18ca 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -110,10 +110,10 @@ class Umbilic_approximation typedef typename boost::graph_traits::vertex_iterator Vertex_const_iterator; //requirements for the templates TriangleMesh and VertexFTMap or VertexVectorMap - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); + static_assert(std::is_same::value); typedef CGAL::Umbilic Umbilic; diff --git a/SMDS_3/include/CGAL/IO/output_to_vtu.h b/SMDS_3/include/CGAL/IO/output_to_vtu.h index e78f1b680a2..28818b8ba68 100644 --- a/SMDS_3/include/CGAL/IO/output_to_vtu.h +++ b/SMDS_3/include/CGAL/IO/output_to_vtu.h @@ -333,7 +333,7 @@ void output_to_vtu_with_attributes(std::ostream& os, os << "\n_"; write_c3t3_points(os,tr,V); // fills V if the mode is BINARY write_cells(os,c3t3,V); - for(std::size_t i = 0; i< attributes.size(); ++i) + for(std::size_t i = 0; i< attributes.size(); ++i) { switch(attributes[i].second.which()){ case 0: write_attributes(os, *boost::get* >(attributes[i].second)); @@ -345,6 +345,8 @@ void output_to_vtu_with_attributes(std::ostream& os, write_attributes(os, *boost::get* >(attributes[i].second)); break; } + } + os << "\n\n"; } os << "\n"; } diff --git a/STL_Extension/include/CGAL/Handle_with_policy.h b/STL_Extension/include/CGAL/Handle_with_policy.h index 004c8b4d96f..5f952a66e15 100644 --- a/STL_Extension/include/CGAL/Handle_with_policy.h +++ b/STL_Extension/include/CGAL/Handle_with_policy.h @@ -355,8 +355,8 @@ namespace Intern { typedef ::CGAL::Reference_counted_hierarchy_with_union Reference_counted_hierarchy_with_union; CGAL_USE_TYPE(Reference_counted_hierarchy_with_union); - CGAL_static_assertion(( - ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value )); + static_assert( + ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value ); } typedef T Rep; }; @@ -760,7 +760,7 @@ private: static Rep_allocator allocator; static Rep* new_rep( const Rep& rep) { - CGAL_static_assertion( !( + static_assert( !( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); Rep* p = allocator.allocate(1); std::allocator_traits::construct(allocator, p, rep); @@ -855,8 +855,8 @@ protected: //! argument, and the single argument template constructor no other //! constructor will work for class hierarchies of representations. Handle_with_policy( Rep* p) : ptr_( p) { - CGAL_static_assertion(( - ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); + static_assert( + ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ); //Bind bind_; // trigger compile-time check //(void)bind_; (void)Bind(); @@ -869,8 +869,8 @@ protected: //! version of \c initialize_with is applicable in this case except //! the template version with one argument. void initialize_with( Rep* p) { - CGAL_static_assertion(( - ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); + static_assert( + ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value ); //Bind bind_; // trigger compile-time check //(void)bind_; (void)Bind(); diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index 1daa82ed9e8..d0f1648f816 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -182,7 +182,7 @@ typename Get_param, Query_tag>::type get_parameter_impl(const Named_params_impl& np, Query_tag tag) { #ifndef CGAL_NO_STATIC_ASSERTION_TEST - CGAL_static_assertion( (!std::is_same::value) ); + static_assert(!std::is_same::value); #endif return get_parameter_impl(static_cast(np), tag); } @@ -243,7 +243,7 @@ template typename Get_param, Query_tag>::reference get_parameter_reference_impl(const Named_params_impl& np, Query_tag tag) { - CGAL_static_assertion( (!std::is_same::value) ); + static_assert(!std::is_same::value); return get_parameter_reference_impl(static_cast(np), tag); } @@ -569,7 +569,7 @@ namespace boost template void get_param(CGAL::Named_function_parameters, Tag2) { - CGAL_static_assertion(B && "You must use CGAL::parameters::get_parameter instead of boost::get_param"); + static_assert(B && "You must use CGAL::parameters::get_parameter instead of boost::get_param"); } } #endif @@ -577,6 +577,6 @@ namespace boost // For disambiguation using SFINAE BOOST_MPL_HAS_XXX_TRAIT_DEF(CGAL_Named_function_parameters_class) template -CGAL_CPP17_INLINE constexpr bool is_named_function_parameter = has_CGAL_Named_function_parameters_class::value; +inline constexpr bool is_named_function_parameter = has_CGAL_Named_function_parameters_class::value; #endif // CGAL_BOOST_FUNCTION_PARAMS_HPP diff --git a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h index 7c6ab2d39b8..9ed4420bbbb 100644 --- a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h +++ b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h @@ -209,7 +209,7 @@ public: int index_x = static_cast( (CGAL::to_double(point.x()) - m_bbox.xmin()) * m_resolution_x); //index_x = std::max( 0, std::min(index_x, m_num_grid_cells_per_axis - 1) ); index_x = - (index_x < 0 ? + (index_x < 0 ? /// @TODO: use std::clamp 0 : (index_x >= m_num_grid_cells_per_axis ? m_num_grid_cells_per_axis - 1 diff --git a/STL_Extension/include/CGAL/assertions.h b/STL_Extension/include/CGAL/assertions.h index 32d7524f7b2..cf793f466be 100644 --- a/STL_Extension/include/CGAL/assertions.h +++ b/STL_Extension/include/CGAL/assertions.h @@ -137,12 +137,6 @@ inline bool possibly(Uncertain c); # define CGAL_unreachable() CGAL_assertion(false) # endif // CGAL_UNREACHABLE -# define CGAL_static_assertion(EX) \ - static_assert(EX, #EX) - -# define CGAL_static_assertion_msg(EX,MSG) \ - static_assert(EX, MSG) - #if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS) # define CGAL_exactness_assertion(EX) (static_cast(0)) # define CGAL_exactness_assertion_msg(EX,MSG) (static_cast(0)) diff --git a/STL_Extension/include/CGAL/for_each.h b/STL_Extension/include/CGAL/for_each.h index f68bba0e80b..69a3e7dcdfe 100644 --- a/STL_Extension/include/CGAL/for_each.h +++ b/STL_Extension/include/CGAL/for_each.h @@ -102,7 +102,7 @@ void for_each (const Range& range, ::reference)>& functor) { #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #endif @@ -118,7 +118,7 @@ void for_each (Range& range, ::reference)>& functor) { #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #endif diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index ea9a964c8a3..956cc88a8c2 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1340,7 +1340,7 @@ class Dispatch_output_iterator < std::tuple, std::tuple > : private internal::Derivator, std::tuple >, std::tuple, std::tuple > , public std::tuple { - CGAL_static_assertion_msg(sizeof...(V) == sizeof...(O), + static_assert(sizeof...(V) == sizeof...(O), "The number of explicit template parameters has to match the number of arguments"); static const int size = sizeof...(V); diff --git a/STL_Extension/include/CGAL/transforming_pair_iterator.h b/STL_Extension/include/CGAL/transforming_pair_iterator.h index 4e59bb9282a..020a0b6d7c7 100644 --- a/STL_Extension/include/CGAL/transforming_pair_iterator.h +++ b/STL_Extension/include/CGAL/transforming_pair_iterator.h @@ -25,7 +25,7 @@ namespace CGAL { namespace internal { template ::value> struct Min_category { - CGAL_static_assertion((boost::is_convertible::value)); + static_assert(std::is_convertible::value); typedef Cat1 type; }; diff --git a/STL_Extension/include/CGAL/type_traits/is_iterator.h b/STL_Extension/include/CGAL/type_traits/is_iterator.h index f8010ab35b3..e1b43ac7a04 100644 --- a/STL_Extension/include/CGAL/type_traits/is_iterator.h +++ b/STL_Extension/include/CGAL/type_traits/is_iterator.h @@ -69,7 +69,7 @@ struct is_iterator { }; template -CGAL_CPP17_INLINE constexpr bool is_iterator_v = is_iterator::value; +inline constexpr bool is_iterator_v = is_iterator::value; template struct is_iterator_type @@ -77,7 +77,7 @@ struct is_iterator_type { }; template -CGAL_CPP17_INLINE constexpr bool is_iterator_type_v = is_iterator_type::value; +inline constexpr bool is_iterator_type_v = is_iterator_type::value; template ::value> @@ -91,7 +91,7 @@ struct is_iterator_to { }; template -CGAL_CPP17_INLINE constexpr bool is_iterator_to_v = is_iterator_to::value; +inline constexpr bool is_iterator_to_v = is_iterator_to::value; } // namespace CGAL diff --git a/STL_Extension/test/STL_Extension/test_Cache.cpp b/STL_Extension/test/STL_Extension/test_Cache.cpp index a5c9de6e5a3..fc645fe5be0 100644 --- a/STL_Extension/test/STL_Extension/test_Cache.cpp +++ b/STL_Extension/test/STL_Extension/test_Cache.cpp @@ -57,16 +57,16 @@ struct Int_t : public CGAL::Handle_with_policy< Int_rep, Unify > { void test_typedefs(){ typedef CGAL::Cache Cache; CGAL_USE_TYPE(Cache); - CGAL_static_assertion(( ::std::is_same< Cache::Input, int >::value )); - CGAL_static_assertion(( ::std::is_same< Cache::Output,double>::value )); + static_assert(::std::is_same< Cache::Input, int >::value ); + static_assert(::std::is_same< Cache::Output,double>::value ); typedef CGAL::Creator_1 Creator_double; CGAL_USE_TYPE(Creator_double); - CGAL_static_assertion(( ::std::is_same::value )); + static_assert(::std::is_same::value ); typedef CGAL::Creator_1 Creator_int; CGAL_USE_TYPE(Creator_int); - CGAL_static_assertion(( ::std::is_same::value )); - CGAL_static_assertion(( ::std::is_same >::value )); - CGAL_static_assertion(( ::std::is_same >::value )); + static_assert(::std::is_same::value ); + static_assert(::std::is_same >::value ); + static_assert(::std::is_same >::value ); } int main(){ { diff --git a/STL_Extension/test/STL_Extension/test_Compact_container.cpp b/STL_Extension/test/STL_Extension/test_Compact_container.cpp index d2d96cdfc4b..566e15dddc2 100644 --- a/STL_Extension/test/STL_Extension/test_Compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Compact_container.cpp @@ -346,7 +346,7 @@ int main() } // Check that Compact_container does not require a complete type. - CGAL_static_assertion(sizeof(CGAL::Compact_container) > 0); + static_assert(sizeof(CGAL::Compact_container) > 0); // Test increment policy CGAL::Compact_container > C5; diff --git a/STL_Extension/test/STL_Extension/test_cgal_named_params.cpp b/STL_Extension/test/STL_Extension/test_cgal_named_params.cpp index 2ae445fbfd5..c5fba6ce23b 100644 --- a/STL_Extension/test/STL_Extension/test_cgal_named_params.cpp +++ b/STL_Extension/test/STL_Extension/test_cgal_named_params.cpp @@ -24,7 +24,7 @@ template void check_same_type(T) { static const bool b = std::is_same< A, T >::value; - CGAL_static_assertion(b); + static_assert(b); assert(b); } @@ -46,7 +46,7 @@ template void test_no_copyable(const NamedParameters& np) { typedef typename inp::Get_param::type NP_type; - CGAL_static_assertion( (std::is_same >::value) ); + static_assert(std::is_same >::value); const A<4>& a = params::choose_parameter(params::get_parameter_reference(np, inp::edge_index), A<4>(4)); assert(a.v==4); @@ -60,31 +60,31 @@ void test_references(const NamedParameters& np) // std::reference_wrapper typedef typename inp::Lookup_named_param_def::reference Visitor_reference_type; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); Visitor_reference_type vis_ref = params::choose_parameter(params::get_parameter_reference(np, inp::visitor), default_value); CGAL_USE(vis_ref); // std::reference_wrapper of const typedef typename inp::Lookup_named_param_def::reference FIM_reference_type; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); FIM_reference_type fim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::face_index), default_value); CGAL_USE(fim_ref); // non-copyable typedef typename inp::Lookup_named_param_def::reference VPM_reference_type; - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); VPM_reference_type vpm_ref = params::choose_parameter(params::get_parameter_reference(np, inp::vertex_point), default_value); CGAL_USE(vpm_ref); // passed by copy typedef typename inp::Lookup_named_param_def::reference VIM_reference_type; - CGAL_static_assertion( (std::is_same, VIM_reference_type>::value) ); + static_assert(std::is_same, VIM_reference_type>::value); VIM_reference_type vim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::vertex_index), default_value); CGAL_USE(vim_ref); // default typedef typename inp::Lookup_named_param_def::reference EIM_reference_type; - CGAL_static_assertion(( std::is_same::value) ); + static_assert(std::is_same::value); EIM_reference_type eim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::edge_index), default_value); assert(&eim_ref==&default_value); } @@ -103,12 +103,12 @@ int main() ); auto d = CGAL::parameters::default_values(); - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); #ifndef CGAL_NO_DEPRECATED_CODE auto d1 = CGAL::parameters::all_default(); - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); auto d2 = CGAL::Polygon_mesh_processing::parameters::all_default(); - CGAL_static_assertion( (std::is_same::value) ); + static_assert(std::is_same::value); #endif return EXIT_SUCCESS; diff --git a/STL_Extension/test/STL_Extension/test_is_iterator.cpp b/STL_Extension/test/STL_Extension/test_is_iterator.cpp index 7305fe62da0..f308d9b4880 100644 --- a/STL_Extension/test/STL_Extension/test_is_iterator.cpp +++ b/STL_Extension/test/STL_Extension/test_is_iterator.cpp @@ -17,17 +17,17 @@ int main() { CGAL_USE_TYPE(vector_it); CGAL_USE_TYPE(list_it); CGAL_USE_TYPE(int_p); - CGAL_static_assertion(is_iterator::value); - CGAL_static_assertion(is_iterator::value); - CGAL_static_assertion(!is_iterator::value); - CGAL_static_assertion(!is_iterator::value); - CGAL_static_assertion(is_iterator::value); + static_assert(is_iterator::value); + static_assert(is_iterator::value); + static_assert(!is_iterator::value); + static_assert(!is_iterator::value); + static_assert(is_iterator::value); - CGAL_static_assertion((is_iterator_type::value)); - CGAL_static_assertion((!is_iterator_type::value)); - CGAL_static_assertion((!is_iterator_type::value)); + static_assert(is_iterator_type::value); + static_assert(!is_iterator_type::value); + static_assert(!is_iterator_type::value); - CGAL_static_assertion((is_iterator_to::value)); - CGAL_static_assertion((!is_iterator_to::value)); - CGAL_static_assertion((!is_iterator_to::value)); + static_assert(is_iterator_to::value); + static_assert(!is_iterator_to::value); + static_assert(!is_iterator_to::value); } diff --git a/STL_Extension/test/STL_Extension/test_is_streamable.cpp b/STL_Extension/test/STL_Extension/test_is_streamable.cpp index 7d1c81a892c..fc248fc7e6e 100644 --- a/STL_Extension/test/STL_Extension/test_is_streamable.cpp +++ b/STL_Extension/test/STL_Extension/test_is_streamable.cpp @@ -21,12 +21,12 @@ istream& operator>>(istream& is, const D&) { return is; } int main() { using CGAL::is_streamable; - CGAL_static_assertion(!is_streamable
    ::value); - CGAL_static_assertion(is_streamable::value); - CGAL_static_assertion(!is_streamable::value); - CGAL_static_assertion(!is_streamable::value); - CGAL_static_assertion(is_streamable::value); - CGAL_static_assertion(is_streamable::value); - CGAL_static_assertion(! (is_streamable >::value) ); - CGAL_static_assertion( (is_streamable >::value) ); + static_assert(!is_streamable::value); + static_assert(is_streamable::value); + static_assert(!is_streamable::value); + static_assert(!is_streamable::value); + static_assert(is_streamable::value); + static_assert(is_streamable::value); + static_assert(!is_streamable >::value); + static_assert(is_streamable >::value); } diff --git a/STL_Extension/test/STL_Extension/test_stl_extension.cpp b/STL_Extension/test/STL_Extension/test_stl_extension.cpp index d361ed8b610..29e078c46c7 100644 --- a/STL_Extension/test/STL_Extension/test_stl_extension.cpp +++ b/STL_Extension/test/STL_Extension/test_stl_extension.cpp @@ -8117,10 +8117,10 @@ void test_tuple(){ CGAL_USE_TYPE(T0); CGAL_USE_TYPE(T2); - CGAL_static_assertion( std::tuple_size::value == 0 ); - CGAL_static_assertion( std::tuple_size::value == 2 ); - CGAL_static_assertion( std::tuple_size::value == 4 ); - CGAL_static_assertion( (std::is_same::type,My_to_int>::value) ); + static_assert( std::tuple_size::value == 0 ); + static_assert( std::tuple_size::value == 2 ); + static_assert( std::tuple_size::value == 4 ); + static_assert( std::is_same::type,My_to_int>::value ); T1 t1=std::make_tuple(1,2); T1 t1_2=std::make_tuple(1,2); @@ -8206,17 +8206,17 @@ void test_make_sorted_pair() { assert(p3==p4); int i=2; assert( CGAL::make_sorted_pair(1,i) == std::make_pair(1,i) ); - CGAL_static_assertion( (std::is_same< + static_assert( std::is_same< BOOST_TYPEOF(CGAL::make_sorted_pair(1L,i)), - std::pair >::value) ); + std::pair >::value); assert( (CGAL::make_sorted_pair(i,1L) == std::pair(1L,2L)) ); - CGAL_static_assertion( (std::is_same< + static_assert( std::is_same< BOOST_TYPEOF(CGAL::make_sorted_pair(1,2L)), - std::pair >::value) ); - CGAL_static_assertion( (std::is_same< + std::pair >::value) ; + static_assert( std::is_same< BOOST_TYPEOF(CGAL::make_sorted_pair(1,2L)), - std::pair >::value) ); + std::pair >::value); } void test_result_of() { @@ -8237,8 +8237,8 @@ void test_result_of() { typedef CGAL::cpp11::result_of::type result_type_float; CGAL_USE_TYPE(result_type); CGAL_USE_TYPE(result_type_float); - CGAL_static_assertion((std::is_same::value)); - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); + static_assert(std::is_same::value); } diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt index 2446884a162..4f96d83d450 100644 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt +++ b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt @@ -1,5 +1,6 @@ /*! \example Scale_space_reconstruction_3/scale_space.cpp +\example Scale_space_reconstruction_3/scale_space_sm.cpp \example Scale_space_reconstruction_3/scale_space_incremental.cpp \example Scale_space_reconstruction_3/scale_space_manifold.cpp \example Scale_space_reconstruction_3/scale_space_advancing_front.cpp diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 8a7397b76d3..f08b349b318 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -19,6 +19,8 @@ include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program("scale_space.cpp") target_link_libraries(scale_space PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("scale_space_sm.cpp") + target_link_libraries(scale_space_sm PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("scale_space_incremental.cpp") target_link_libraries(scale_space_incremental PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("scale_space_manifold.cpp") diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp index 7164d7aa376..bb0f308b034 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -16,19 +17,6 @@ typedef Reconstruction::Point Point; typedef Reconstruction::Facet_const_iterator Facet_iterator; -// function for writing the reconstruction output in the off format -void dump_reconstruction(const Reconstruction& reconstruct, std::string name) -{ - std::ofstream output(name.c_str()); - output << "OFF " << reconstruct.number_of_points() << " " - << reconstruct.number_of_facets() << " 0\n"; - - std::copy(reconstruct.points_begin(), - reconstruct.points_end(), - std::ostream_iterator(output,"\n")); - for( Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it ) - output << "3 " << *it << std::endl; -} int main(int argc, char* argv[]) { @@ -70,14 +58,18 @@ int main(int argc, char* argv[]) if (i == 0) { std::cout << "First reconstruction done." << std::endl; - // Write the reconstruction. - dump_reconstruction(reconstruct, "reconstruction1.off"); + CGAL::IO::write_OFF("reconstruction1.off", + reconstruct.points(), + reconstruct.facets(), + CGAL::parameters::stream_precision(17)); } else { std::cout << "Second reconstruction done." << std::endl; - // Write the reconstruction. - dump_reconstruction(reconstruct, "reconstruction2.off"); + CGAL::IO::write_OFF("reconstruction2.off", + reconstruct.points(), + reconstruct.facets(), + CGAL::parameters::stream_precision(17)); } } diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp index 0344b6454a5..61fb8efb57a 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp @@ -21,7 +21,7 @@ typedef Mesher::Facet_const_iterator Mesher_iterator; typedef CGAL::Timer Timer; int main(int argc, char* argv[]) { - // Read the dat + // Read the data std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1]; std::cerr << "Reading " << std::flush; @@ -49,22 +49,18 @@ int main(int argc, char* argv[]) { reconstruct.reconstruct_surface(mesher); std::cerr << "Reconstruction done in " << t.time() << " sec." << std::endl; - t.reset(); + std::ofstream out("out.off"); // Write the reconstruction. for(Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it ) - out << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file - - std::cerr << "Writing result in " << t.time() << " sec." << std::endl; - + // We write a '3' in front so that it can be assembled into an OFF file + out << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n'; out.close(); - t.reset(); std::ofstream garbage("garbage.off"); // Write facets that were removed to force manifold output for(Mesher_iterator it = mesher.garbage_begin(); it != mesher.garbage_end(); ++it ) - garbage << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file - std::cerr << "Writing garbage facets in " << t.time() << " sec." << std::endl; + garbage << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n'; std::cerr << "Done." << std::endl; diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp new file mode 100644 index 00000000000..a562362bfcf --- /dev/null +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp @@ -0,0 +1,73 @@ +#include + +#include + +#include +#include +#include +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + +typedef CGAL::Scale_space_surface_reconstruction_3< Kernel > Reconstruction; +typedef CGAL::Scale_space_reconstruction_3::Weighted_PCA_smoother< Kernel > Smoother; +typedef CGAL::Scale_space_reconstruction_3::Alpha_shape_mesher< Kernel > Mesher; + +typedef Reconstruction::Point Point; +typedef Reconstruction::Facet_const_iterator Facet_iterator; + +typedef CGAL::Surface_mesh Surface_mesh; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; + +int main(int argc, char* argv[]) { + // Read the data + std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1]; + + std::cerr << "Reading " << std::flush; + std::vector points; + if(!CGAL::IO::read_points(fname, std::back_inserter(points))) + { + std::cerr << "Error: cannot read file" << std::endl; + return EXIT_FAILURE; + } + + std::cerr << "done: " << points.size() << " points." << std::endl; + + // Construct the mesh in a scale space. + Reconstruction reconstruct(points.begin(), points.end() ); + Smoother smoother(10, 200 ); + reconstruct.increase_scale(4, smoother); + + Mesher mesher(smoother.squared_radius(), + false, // Do not separate shells + true // Force manifold output + ); + reconstruct.reconstruct_surface(mesher); + + Reconstruction::Point_range smoothed(reconstruct.points()); + Reconstruction::Facet_range polygons(reconstruct.facets()); + + CGAL::Polygon_mesh_processing::orient_polygon_soup(smoothed, polygons); + + Surface_mesh mesh; + CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(smoothed, polygons, mesh); + + // Also store the input points as vertex property + Surface_mesh::Property_map original; + bool created; + boost::tie(original, created) = mesh.add_property_map("v:original"); + assert(created); + + int i = 0; + for(auto v : vertices(mesh)){ + put(original, v, points[i++]); + } + + + std::cerr << "Done." << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h index bc4ba9ec616..a32aacd681b 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Weighted_PCA_smoother.h @@ -198,7 +198,7 @@ private: void try_parallel (const F& func, std::size_t begin, std::size_t end) { #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else if (boost::is_convertible::value) diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h index 47410046e0e..d84d5842c2f 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h @@ -53,21 +53,23 @@ public: typedef std::array Facet; ///< defines a facet of the surface (triple of point indices). #ifdef DOXYGEN_RUNNING + typedef unspecified_type Point_range; ///< defines a range points. typedef unspecified_type Point_iterator; ///< defines an iterator over the points. typedef const unspecified_type Point_const_iterator; ///< defines a constant iterator over the points. #else - typedef typename std::vector Point_vector; - typedef typename Point_vector::iterator Point_iterator; - typedef typename Point_vector::const_iterator Point_const_iterator; + typedef typename std::vector Point_range; + typedef typename Point_range::iterator Point_iterator; + typedef typename Point_range::const_iterator Point_const_iterator; #endif #ifdef DOXYGEN_RUNNING + typedef unspecified_type Facet_range; ///< defines a range of facets typedef unspecified_type Facet_iterator; ///< defines an iterator over the facets. typedef const unspecified_type Facet_const_iterator; ///< defines a constant iterator over the facets. #else - typedef typename std::vector Facet_vector; - typedef typename Facet_vector::iterator Facet_iterator; - typedef typename Facet_vector::const_iterator Facet_const_iterator; + typedef typename std::vector Facet_range; + typedef typename Facet_range::iterator Facet_iterator; + typedef typename Facet_range::const_iterator Facet_const_iterator; #endif // Default algorithms used (same as in old API) @@ -76,8 +78,8 @@ public: private: - Point_vector m_points; - Facet_vector m_facets; + Point_range m_points; + Facet_range m_facets; FT m_internal_squared_radius; // For backward compatibility @@ -233,6 +235,9 @@ public: /// gives the number of points of the surface. std::size_t number_of_points() const { return m_points.size(); } + /// gives the range of points + const Point_range& points() const { return m_points; } + /// gives an iterator to the first point at the current scale. /** \warning Changes to the scale-space do not cause an automatic update to * the surface. @@ -254,6 +259,9 @@ public: /// gives the number of facets of the surface. std::size_t number_of_facets() const { return m_facets.size(); } + /// gives the range of facets + const Facet_range& facets() const { return m_facets; } + /// gives an iterator to the first triple in the surface. /** \warning Changes to the surface may change its topology. */ @@ -292,16 +300,4 @@ std::ostream& operator<< (std::ostream& os, const CGAL::Scale_space_surface_reco } // namespace CGAL -template< typename T > -std::ostream& -operator<<( std::ostream& os, const std::array< T, 3 >& t ) { - return os << t[0] << " " << t[1] << " " << t[2]; -} - -template< typename T > -std::istream& -operator>>( std::istream& is, std::array< T, 3 >& t ) { - return is >> get<0>(t) >> get<1>(t) >> get<2>(t); -} - #endif // CGAL_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_H diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index ab124cf51e2..c984ac9ae23 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -429,6 +429,13 @@ setup_dirs() for PLATFORM in ${PLATFORMS}; do + # MSVC2015 does not support C++17 + if [ "$CGAL_RELEASE_ID" \> "CGAL-6.0" ]; then + if [ "$PLATFORMS" = "MSVC2015-Release-64bits" ]; then + continue + fi + fi + CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${PLATFORM} if [ ! -d "${CGAL_BINARY_DIR}" ]; then diff --git a/Scripts/developer_scripts/autotest_cgal_with_ctest b/Scripts/developer_scripts/autotest_cgal_with_ctest index ccf560ac808..e9b0c851dbb 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_ctest +++ b/Scripts/developer_scripts/autotest_cgal_with_ctest @@ -16,6 +16,7 @@ export CURL="curl" export CURL_OPTS="-k --remote-name --silent --location-trusted" export CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases" export UPLOAD_RESULT_DESTINATION="cgaltest@cgaltest.geometryfactory.com:incoming" +export UPLOAD_DEMOS_DESTINATION="cgaltest@cgaltest.geometryfactory.com:public_html/incoming" export LATEST_LOCATION="${CGAL_URL}/LATEST" export TAR="tar" export GUNZIP="gunzip" diff --git a/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh b/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh index 58b1b906fd2..2af501d48c0 100644 --- a/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh +++ b/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh @@ -43,4 +43,4 @@ for file in "${files[@]}"; do done; #check dependencies done #loop over directories mkdir -p "$target_directory/platforms" -cp "$Qt5_DIR/../../../plugins/platforms/qwindows.dll" "$target_directory/platforms" +cp "$Qt5_INSTALLATION_DIR/plugins/platforms/qwindows.dll" "$target_directory/platforms" diff --git a/Scripts/developer_scripts/run_testsuite_with_ctest b/Scripts/developer_scripts/run_testsuite_with_ctest index 69d5adf8d0e..8c93c47f074 100644 --- a/Scripts/developer_scripts/run_testsuite_with_ctest +++ b/Scripts/developer_scripts/run_testsuite_with_ctest @@ -203,7 +203,45 @@ put_on_web() "$SCP" "${1}" "$UPLOAD_RESULT_DESTINATION/$2" >> "${ACTUAL_LOGFILE}" } +put_demos_on_web() +{ + log "${ACTUAL_LOGFILE}" "Uploading demos ${1} to $UPLOAD_DEMOS_DESTINATION/$2" + "$SCP" "${1}" "$UPLOAD_DEMOS_DESTINATION/$2" >> "${ACTUAL_LOGFILE}" +} + + +collect_demos_binaries() +{ + PLATFORM=${1} + + cd "${CGAL_TEST_DIR}" + + echo "COLLECT_DEMOS_BINARIES=$COLLECT_DEMOS_BINARIES" + if [ -n "$COLLECT_DEMOS_BINARIES" ]; then + echo 'COLLECTING DEMOS BINARIES' + + + DEMOS_TEST_DIR="${CGAL_DIR}/cmake/platforms/${PLATFORM}/test" + cp "${CGAL_DIR}/${SCRIPTS_DIR}developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh" "${DEMOS_TEST_DIR}" + + cd ${DEMOS_TEST_DIR} + + for demo_dir in *_Demo; do + echo "pushd ${demo_dir}" + pushd "${demo_dir}" + bash ${DEMOS_TEST_DIR}/cgal_demo_copy_all_dlls_cygwin.sh "${demo_dir}_with_dlls" "${CONFIG_TYPE}" + mv "${demo_dir}_with_dlls" ${DEMOS_TEST_DIR} + popd + done + + ${TAR} cf "demos_${CGAL_TESTER}_${PLATFORM}.tar" *_Demo_with_dlls/*; + ${COMPRESSOR} -9f "demos_${CGAL_TESTER}_${PLATFORM}.tar" + mv "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" ${CGAL_TEST_DIR} + else + echo "Don't collect demos binaries for platform $PLATFORM"; + fi +} publish_results() { @@ -241,7 +279,7 @@ publish_results() log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "PUTTING RESULTS ON THE WEB" put_on_web "test_results-${HOST}_${PLATFORM}.tar.gz" "${FILENAME}" if [ -e "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" ]; then - put_on_web "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" "demos-${FILENAME}" + put_demos_on_web "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" "demos-${FILENAME}" fi log_done "${ACTUAL_LOGFILE}" fi @@ -304,6 +342,7 @@ run_test_on_platform() else ctest ${TO_TEST:+-L ${TO_TEST} } ${CTEST_OPTS} -j${NUMBER_OF_PROCESSORS} ${KEEP_TESTS:+-FC .}|tee tmp.txt fi + ##################### ## GET RESULTS ## ##################### @@ -369,7 +408,9 @@ run_test_on_host() for PLATFORM in ${PLATFORMS}; do run_test_on_platform "${PLATFORM}" + collect_demos_binaries "${PLATFORM}" publish_results "${PLATFORM}" + if [ -z "${KEEP_TESTS}" ]; then rm -rf $CGAL_DIR/cmake/platforms/${PLATFORM} fi diff --git a/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h b/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h index 94713899f34..b86325e6d39 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h @@ -296,7 +296,7 @@ namespace Planes { using PlaneIndexMap = typename CGAL::Point_set_processing_3::GetPlaneIndexMap::type; - CGAL_static_assertion_msg((!is_default_parameter::value), + static_assert(!is_default_parameter::value, "Error: no plane index map"); const PlaneIndexMap index_map = diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h index add923b15e2..f7894c74eb5 100644 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h @@ -107,7 +107,7 @@ public: template class Multiple_kd_tree { - CGAL_static_assertion_msg((boost::is_pointer::value), "SAVED_OBJECT is not a pointer."); + static_assert(boost::is_pointer::value, "SAVED_OBJECT is not a pointer."); private: typedef Traits_ Traits; typedef typename Traits::FT NT; diff --git a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h index 002b6acba83..261c4c514b0 100644 --- a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h +++ b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h @@ -44,9 +44,9 @@ namespace CGAL { number type that `FieldNumberType` \note The `FT` type is provided for convenience. Internally, this FT type is converted - to `c_float` type that can be set either to `float` or `double`. By default, the `double` - type is used. After the optimization is complete, the `c_float` type is converted back to `FT`. - See more about `c_float` here. + to `OSQPFloat` type that can be set either to `float` or `double`. By default, the `double` + type is used. After the optimization is complete, the `OSQPFloat` type is converted back to `FT`. + See more about `OSQPFloat` here. \cgalModels `QuadraticProgramTraits` */ @@ -192,27 +192,27 @@ public: CGAL_precondition(q_vec.size() == n); CGAL_precondition(l_vec.size() == m && l_vec.size() == m); - const c_int P_nnz = static_cast(P_vec.size()); - auto P_x = std::make_unique(P_nnz); - auto P_i = std::make_unique(P_nnz); - auto P_p = std::make_unique(n + 1); + const OSQPInt P_nnz = static_cast(P_vec.size()); + auto P_x = std::make_unique(P_nnz); + auto P_i = std::make_unique(P_nnz); + auto P_p = std::make_unique(n + 1); set_matrix_from_triplets("P", P_vec, P_x.get(), P_i.get(), P_p.get()); if(verbose) std::cout << "P_nnz: " << P_nnz << std::endl; - const c_int A_nnz = static_cast(A_vec.size()); - auto A_x = std::make_unique(A_nnz); - auto A_i = std::make_unique(A_nnz); - auto A_p = std::make_unique(n + 1); + const OSQPInt A_nnz = static_cast(A_vec.size()); + auto A_x = std::make_unique(A_nnz); + auto A_i = std::make_unique(A_nnz); + auto A_p = std::make_unique(n + 1); set_matrix_from_triplets("A", A_vec, A_x.get(), A_i.get(), A_p.get()); if(verbose) std::cout << "A_nnz: " << A_nnz << std::endl; - const c_int q_size = static_cast(q_vec.size()); - const c_int l_size = static_cast(l_vec.size()); - const c_int u_size = static_cast(u_vec.size()); + const OSQPInt q_size = static_cast(q_vec.size()); + const OSQPInt l_size = static_cast(l_vec.size()); + const OSQPInt u_size = static_cast(u_vec.size()); - auto q_x = std::make_unique(q_size); - auto l_x = std::make_unique(l_size); - auto u_x = std::make_unique(u_size); + auto q_x = std::make_unique(q_size); + auto l_x = std::make_unique(l_size); + auto u_x = std::make_unique(u_size); set_qlu_data(q_x.get(), l_x.get(), u_x.get()); // Problem settings. @@ -220,22 +220,11 @@ public: CGAL_assertion(settings); // Structures. - OSQPWorkspace *work; - OSQPData *data = (OSQPData *) malloc(sizeof(OSQPData)); - CGAL_assertion(data); + OSQPCscMatrix* P = static_cast(malloc(sizeof(OSQPCscMatrix))); + OSQPCscMatrix* A = static_cast(malloc(sizeof(OSQPCscMatrix))); - // Populate data. - data->n = static_cast(n); - data->m = static_cast(m); - data->P = csc_matrix(data->n, data->n, P_nnz, P_x.get(), P_i.get(), P_p.get()); - CGAL_assertion(data->P); - - data->q = q_x.get(); - data->A = csc_matrix(data->m, data->n, A_nnz, A_x.get(), A_i.get(), A_p.get()); - CGAL_assertion(data->A); - - data->l = l_x.get(); - data->u = u_x.get(); + csc_set_data(A, m, n, A_nnz, A_x.get(), A_i.get(), A_p.get()); + csc_set_data(P, n, n, P_nnz, P_x.get(), P_i.get(), P_p.get()); // Set solver settings. osqp_set_default_settings(settings); @@ -243,38 +232,33 @@ public: settings->eps_rel = eps_rel; settings->verbose = verbose; - // Set workspace. - osqp_setup(&work, data, settings); + OSQPSolver* solver = NULL; + OSQPInt exitflag = osqp_setup(&solver, P, q_x.get(), A, l_x.get(), u_x.get(), m, n, settings); - // Solve problem. - c_int exitflag = -1; try { - exitflag = osqp_solve(work); + if (!exitflag) + exitflag = osqp_solve(solver); + + const OSQPFloat* x = solver->solution->x; + for (std::size_t i = 0; i < n; ++i) + { + const FT value{ x[i] }; + *(++solution) = value; + } } - catch(std::exception& e) + catch (std::exception& e) { std::cerr << "ERROR: OSQP solver has thrown an exception!" << std::endl; std::cerr << e.what() << std::endl; } - const bool success = (exitflag == 0); - // Create solution. - const c_float *x = work->solution->x; - for(std::size_t i=0; iA); - c_free(data->P); - c_free(data); - c_free(settings); - - return success; + return (exitflag == 0); } /// \endcond @@ -282,9 +266,9 @@ private: // Based on the code in scipy, function coo_tocsr() void set_matrix_from_triplets(const std::string /* name */, const std::vector& triplets, - c_float *M_x, - c_int *M_i, - c_int *M_p) const + OSQPFloat *M_x, + OSQPInt *M_i, + OSQPInt *M_p) const { const std::size_t nnz = triplets.size(); @@ -296,10 +280,10 @@ private: } // Fill M_p - c_int cumsum = 0; + OSQPInt cumsum = 0; for(std::size_t j=0; j(std::get<1>(triplets[k])); - const c_int dest = M_p[col]; + const OSQPInt col = static_cast(std::get<1>(triplets[k])); + const OSQPInt dest = M_p[col]; - M_i[dest] = static_cast(std::get<0>(triplets[k])); - M_x[dest] = c_float(CGAL::to_double(std::get<2>(triplets[k]))); + M_i[dest] = static_cast(std::get<0>(triplets[k])); + M_x[dest] = OSQPFloat(CGAL::to_double(std::get<2>(triplets[k]))); M_p[col]++; } - c_int last = 0; + OSQPInt last = 0; for(std::size_t j=0; j<=n; ++j) { - const c_int tmp = M_p[j]; + const OSQPInt tmp = M_p[j]; M_p[j] = last; last = tmp; } @@ -341,19 +325,19 @@ private: // std::cout << std::endl; } - void set_qlu_data(c_float *q_x, - c_float *l_x, - c_float *u_x) const + void set_qlu_data(OSQPFloat *q_x, + OSQPFloat *l_x, + OSQPFloat *u_x) const { for(std::size_t i=0; iincremental nearest neighbor searching in the sense that having obtained the `k` nearest -neighbors, the `k + 1`st neighbor can be obtained without having +neighbors, the `k + 1`th neighbor can be obtained without having to calculate the `k + 1` nearest neighbor from scratch. Spatial searching typically consists of a preprocessing phase and a @@ -400,7 +400,7 @@ splitting rule, needed to set the maximal allowed bucket size. This example program has two 2-dimensional data sets: The first one containing collinear points with exponential increasing distances and the second -one with collinear points in the firstdimension and one point with a distance +one with collinear points in the first dimension and one point with a distance exceeding the spread of the other points in the second dimension. These are the worst cases for the midpoint/median rules and can also occur in higher dimensions. @@ -426,13 +426,13 @@ how to perform parallel queries: \section Performance Performance -\subsection OrthogonalPerfomance Performance of the Orthogonal Search +\subsection OrthogonalPerformance Performance of the Orthogonal Search We took the gargoyle data set (Surface) from aim\@shape, and generated the same number of random points in the bbox of the gargoyle (Random). We then consider three scenarios as data/queries. The data set contains 800K points. For each query point we compute the K=10,20,30 closest points, with the default splitter and for the bucket size 10 (default) and 20. -The results were produced with the release 5.1 of \cgal, on an Intel i7 2.3 Ghz +The results were produced with the release 5.1 of \cgal, on an Intel i7 2.3 GHz laptop with 16 GB RAM, compiled with CLang++ 6 with the O3 option. The values are the average of ten tests each. We show timings in seconds for both the building of the tree and the queries. diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index b0958bc44ee..317f6a78bad 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -335,7 +335,7 @@ public: } #ifndef CGAL_TBB_STRUCTURE_IN_KD_TREE - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #endif diff --git a/Spatial_sorting/include/CGAL/Hilbert_sort_median_2.h b/Spatial_sorting/include/CGAL/Hilbert_sort_median_2.h index 722ccc3acbc..59df305b5c4 100644 --- a/Spatial_sorting/include/CGAL/Hilbert_sort_median_2.h +++ b/Spatial_sorting/include/CGAL/Hilbert_sort_median_2.h @@ -157,7 +157,7 @@ public: #ifndef CGAL_LINKED_WITH_TBB CGAL_USE(begin); CGAL_USE(end); - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else const int y = (x + 1) % 2; diff --git a/Spatial_sorting/include/CGAL/Hilbert_sort_median_3.h b/Spatial_sorting/include/CGAL/Hilbert_sort_median_3.h index ebf71afed5a..6fc128cd61a 100644 --- a/Spatial_sorting/include/CGAL/Hilbert_sort_median_3.h +++ b/Spatial_sorting/include/CGAL/Hilbert_sort_median_3.h @@ -180,7 +180,7 @@ public: #ifndef CGAL_LINKED_WITH_TBB CGAL_USE(begin); CGAL_USE(end); - CGAL_static_assertion_msg (!(boost::is_convertible::value), + static_assert (!(boost::is_convertible::value), "Parallel_tag is enabled but TBB is unavailable."); #else const int y = (x + 1) % 3, z = (x + 2) % 3; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h index 37a9307dcaf..d521dc4257c 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/Stream_support/include/CGAL/IO/helpers.h b/Stream_support/include/CGAL/IO/helpers.h index 36cd5e2a89c..175f95b189d 100644 --- a/Stream_support/include/CGAL/IO/helpers.h +++ b/Stream_support/include/CGAL/IO/helpers.h @@ -84,7 +84,7 @@ struct is_Range { }; template -CGAL_CPP17_INLINE constexpr bool is_Range_v = is_Range::value; +inline constexpr bool is_Range_v = is_Range::value; // For polygon meshes template @@ -93,7 +93,7 @@ struct is_Point_set_or_Range_or_Iterator { }; template -CGAL_CPP17_INLINE constexpr bool is_Point_set_or_Range_or_Iterator_v = is_Point_set_or_Range_or_Iterator::value; +inline constexpr bool is_Point_set_or_Range_or_Iterator_v = is_Point_set_or_Range_or_Iterator::value; } // end namespace internal } // end namespace IO diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index e287fe8e16f..1034f74abff 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -698,6 +698,25 @@ inline const char* mode_name( IO::Mode m ) return names[m]; } +namespace internal { + +template constexpr auto has_exact(int) -> decltype(exact(P()), bool()) { return true; } +template constexpr bool has_exact(...) { return false; } + +} + +template +auto +serialize(const P& p) { + if constexpr (internal::has_exact

    (0)) { + return exact(p); + } else { + return p; + } +} + + + } // IO namespace #ifndef CGAL_NO_DEPRECATED_CODE diff --git a/Stream_support/test/Stream_support/test_ioformat.cpp b/Stream_support/test/Stream_support/test_ioformat.cpp index e4e4e13e67e..d85c7c0577c 100644 --- a/Stream_support/test/Stream_support/test_ioformat.cpp +++ b/Stream_support/test/Stream_support/test_ioformat.cpp @@ -50,8 +50,8 @@ void test_io(const NT& x){ } int main() { - CGAL_static_assertion(CGAL::Output_rep::is_specialized == false); - CGAL_static_assertion(CGAL::Input_rep::is_specialized == false); + static_assert(CGAL::Output_rep::is_specialized == false); + static_assert(CGAL::Input_rep::is_specialized == false); std::cout << "test_io: short "<< std::endl; test_io(12); diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/iterative_authalic_parameterizer.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/iterative_authalic_parameterizer.cpp index 6d517e965bc..88cec4c04dc 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/iterative_authalic_parameterizer.cpp +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/iterative_authalic_parameterizer.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -45,7 +44,7 @@ int main(int argc, char** argv) UV_pmap uv_map(uv_uhm); typedef SMP::Circular_border_arc_length_parameterizer_3 Border_parameterizer; - Border_parameterizer border_parameterizer; // the border parameterizer will automatically compute the corner vertices + Border_parameterizer border_parameterizer; typedef SMP::Iterative_authalic_parameterizer_3 Parameterizer; Parameterizer parameterizer(border_parameterizer); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h index 7a281a09f78..485da4c6975 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h @@ -176,7 +176,7 @@ public: Two_vertices_parameterizer_3 >::type Border_parameterizer; #if !defined(CGAL_EIGEN3_ENABLED) - CGAL_static_assertion_msg(!(std::is_same::value), + static_assert(!(std::is_same::value), "Error: You must either provide 'SolverTraits_' or link CGAL with the Eigen library"); #endif diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h index 015e61348b8..d32929793c3 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h @@ -104,7 +104,7 @@ public: Circular_border_arc_length_parameterizer_3 >::type Border_parameterizer; #if !defined(CGAL_EIGEN3_ENABLED) - CGAL_static_assertion_msg(!(std::is_same::value), + static_assert(!(std::is_same::value), "Error: You must either provide 'SolverTraits_' or link CGAL with the Eigen library"); #endif diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h index 3e603ad5459..2e0f32ed7fd 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h @@ -384,7 +384,7 @@ class Orbifold_Tutte_parameterizer_3 public: #ifndef DOXYGEN_RUNNING #if !defined(CGAL_EIGEN3_ENABLED) - CGAL_static_assertion_msg(!(std::is_same::value), + static_assert(!(std::is_same::value), "Error: You must either provide 'SolverTraits_' or link CGAL with the Eigen library"); #endif diff --git a/Surface_mesh_segmentation/doc/Surface_mesh_segmentation/Surface_Mesh_Segmentation.txt b/Surface_mesh_segmentation/doc/Surface_mesh_segmentation/Surface_Mesh_Segmentation.txt index da59f097d30..c947aac7dd7 100644 --- a/Surface_mesh_segmentation/doc/Surface_mesh_segmentation/Surface_Mesh_Segmentation.txt +++ b/Surface_mesh_segmentation/doc/Surface_mesh_segmentation/Surface_Mesh_Segmentation.txt @@ -126,9 +126,10 @@ where: +Note both terms of the energy function, \f$ e_1 \f$ and \f$ e_2 \f$, are always non-negative. The first term of the energy function provides the contribution of the soft clustering probabilities. -The second term of the energy function is a geometric criterion that is larger when two adjacent facets sharing a sharp and concave edge are in the same cluster. -The smoothness parameter makes this geometric criteria more or less prevalent. +The second term of the energy function is a geometric criterion that is larger when two adjacent facets sharing a sharp and concave edge are not in the same cluster. +The smoothness parameter makes this geometric criterion more or less prevalent. Assigning a high value to the smoothness parameter results in a small number of segments (since constructing a segment boundary would be expensive). In other words, merging facets that are placed under different clusters is less expensive than separating them and creating boundaries. @@ -216,7 +217,7 @@ When using a `Surface_mesh`, you can use the built-in property mechanism. The following tables provide the runtime of the functions `sdf_values()` and `segmentation_from_sdf_values()`. -The results were produced with the release 4.4 of \cgal, on an Intel i7 3.2 Ghz laptop with 8 GB RAM, compiled by Visual C++ 2010 with /O2 option. +The results were produced with the release 4.4 of \cgal, on an Intel i7 3.2 GHz laptop with 8 GB RAM, compiled by Visual C++ 2010 with /O2 option. The polyhedron types are using `Polyhedron_items_with_id_3` as item class. The models used for the benchmarks are the dinosaur model with 7,828 facets, the bear model with 20,188 facets and the elephant model with 88,928 facets. diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 31c3939c926..7ca5146ab1f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -306,7 +306,7 @@ int r = edge_collapse(surface_mesh, stop_predicate, .edge_is_border_map(ebmap) .get_cost(cf) .get_placement(pf) - .filter(filter + .filter(filter) .visitor(vis)); \endcode diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h index 59a33fa465c..04303b90353 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Bounded_distance_placement.h @@ -49,7 +49,7 @@ private: template void initialize_tree(const Profile& profile) const { - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); typedef typename Profile::Triangle_mesh Triangle_mesh; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h index 28b22b3e079..86fd7c87544 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/FastEnvelope_filter.h @@ -43,7 +43,7 @@ private: template void initialize_envelope(const Profile& profile) const { - CGAL_static_assertion((std::is_same::value)); + static_assert(std::is_same::value); typedef typename Profile::Triangle_mesh Triangle_mesh; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h index 46c1a253cc4..2541ef6ff30 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h @@ -51,9 +51,9 @@ namespace CGAL { typedef typename Oracle_a::Intersection_point Intersection_point; - CGAL_static_assertion((::std::is_same< + static_assert(::std::is_same< Intersection_point, - typename Oracle_b::Intersection_point>::value)); + typename Oracle_b::Intersection_point>::value); typedef ::CGAL::Multi_surface_3 #include #include +#include #include diff --git a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h index 21aa9eaa8c7..33a85cde6ff 100644 --- a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h +++ b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h @@ -129,8 +129,8 @@ public: typedef typename Traits_adaptor_2::Top_side_category Top_side_category; typedef typename Traits_adaptor_2::Right_side_category Right_side_category; - CGAL_static_assertion((Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, - Top_side_category, Right_side_category >::value)); + static_assert(Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::value); protected: /*! diff --git a/TDS_2/doc/TDS_2/TDS_2.txt b/TDS_2/doc/TDS_2/TDS_2.txt index f326e6e1ebf..0f6184ea1c9 100644 --- a/TDS_2/doc/TDS_2/TDS_2.txt +++ b/TDS_2/doc/TDS_2/TDS_2.txt @@ -72,7 +72,7 @@ the set of maintained faces is topologically equivalent to a two-dimensional triangulated sphere. -This rules extends to lower dimensional triangulation data structure +This rule extends to lower dimensional triangulation data structure arising in degenerate cases or when the triangulations have fewer than three vertices. A one dimensional triangulation structure maintains a set of vertices diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index b47f2971231..6f63f08162d 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -130,7 +130,7 @@ public: >::type Cell_range; # else - CGAL_static_assertion_msg + static_assert (!(std::is_convertible::value), "In CGAL triangulations, `Parallel_tag` can only be used with the Intel TBB library. " "Make TBB available in the build system and then define the macro `CGAL_LINKED_WITH_TBB`."); diff --git a/Three/include/CGAL/Three/Point_container.h b/Three/include/CGAL/Three/Point_container.h index 5407ac40692..f468fe8e534 100644 --- a/Three/include/CGAL/Three/Point_container.h +++ b/Three/include/CGAL/Three/Point_container.h @@ -55,6 +55,8 @@ struct DEMO_FRAMEWORK_EXPORT Point_container :public Primitive_container //! Point_container(int program, bool indexed); + ~Point_container(); + //! //! \brief initGL creates the `Vbo`s and `Vao`s of this `Point_container`. //! \attention It must be called within a valid OpenGL context. The `draw()` function of an item is always a safe place to call this. diff --git a/Three/include/CGAL/Three/Primitive_container.h b/Three/include/CGAL/Three/Primitive_container.h index 34dea54aa66..613af38b7e9 100644 --- a/Three/include/CGAL/Three/Primitive_container.h +++ b/Three/include/CGAL/Three/Primitive_container.h @@ -19,6 +19,8 @@ #include #include +#include // for std::unique_ptr + using namespace CGAL::Three; #ifdef demo_framework_EXPORTS @@ -248,7 +250,7 @@ public: //! private: friend struct D; - mutable D* d; + std::unique_ptr d; }; //end of class Triangle_container } diff --git a/Three/include/CGAL/Three/Scene_item.h b/Three/include/CGAL/Three/Scene_item.h index f22b9be5f52..ca65c413f3c 100644 --- a/Three/include/CGAL/Three/Scene_item.h +++ b/Three/include/CGAL/Three/Scene_item.h @@ -187,11 +187,11 @@ public: //! If the diagonal's length has never been computed, computes it and //! saves the result for further calls. //! @returns the item's bounding box's diagonal length. - virtual double diagonalBbox() const { - if(!is_diag_bbox_computed) - compute_diag_bbox(); - is_diag_bbox_computed = true; - return _diag_bbox; + virtual double bboxDiagonal() const { + if(!is_bbox_diag_computed) + compute_diag_bbox(); + is_bbox_diag_computed = true; + return _diag_bbox; } // Function about manipulation @@ -413,7 +413,7 @@ protected: mutable Bbox _bbox; mutable double _diag_bbox; mutable bool is_bbox_computed; - mutable bool is_diag_bbox_computed; + mutable bool is_bbox_diag_computed; virtual void compute_bbox()const{} virtual void compute_diag_bbox()const; // The four basic properties diff --git a/Three/include/CGAL/Three/Scene_item_rendering_helper.h b/Three/include/CGAL/Three/Scene_item_rendering_helper.h index 66857738ccc..72fd4ce154a 100644 --- a/Three/include/CGAL/Three/Scene_item_rendering_helper.h +++ b/Three/include/CGAL/Three/Scene_item_rendering_helper.h @@ -41,7 +41,7 @@ struct Point_container; //! be rendered. //! class DEMO_FRAMEWORK_EXPORT Scene_item_rendering_helper - :public Scene_item + : public Scene_item { Q_OBJECT public: @@ -100,11 +100,11 @@ public: //! //! \brief getEdgeContainer returns the `id`th `Edge_container`. //! - CGAL::Three::Edge_container* getEdgeContainer(std::size_t id)const; + CGAL::Three::Edge_container* getEdgeContainer(std::size_t id) const; //! //! \brief getPointContainer returns the `id`th `Point_container`. //! - CGAL::Three::Point_container* getPointContainer(std::size_t id)const; + CGAL::Three::Point_container* getPointContainer(std::size_t id) const; //! //! \brief setTriangleContainer sets the `id`th `Triangle_container` to `tc`. @@ -134,7 +134,7 @@ public: //! decreasingly. //! void setPointContainer(std::size_t id, - Point_container* tc); + Point_container* tc); //! //! \brief setBuffersFilled specifies if the data should be re-computed. @@ -149,13 +149,13 @@ public: //! \brief getBuffersFilled returns `false` if the item rendering data needs to be re-computed., //! `true` otherwise. //! \see `setBuffersFilled()` - bool getBuffersFilled()const; + bool getBuffersFilled() const; //! //! \brief getBuffersInit returns true if the `Vao`s of `viewer` are ready //! for rendering. //! - bool getBuffersInit(Viewer_interface *viewer)const; + bool getBuffersInit(Viewer_interface *viewer) const; //! //! \brief setBuffersInit specifies if the `Vbo`s need to be initialized. @@ -174,7 +174,7 @@ public: //! saves the result for further calls. //! @returns the item's bounding box's diagonal length. //! @todo must replace the one from Scene_item eventually - virtual double diagonalBbox() const Q_DECL_OVERRIDE; + virtual double bboxDiagonal() const Q_DECL_OVERRIDE; //! //! \brief newViewer adds Vaos for `viewer`. //! \param viewer the new viewer. @@ -190,7 +190,7 @@ protected: QSlider* alphaSlider(); //!Returns`true` if `initGL()` was called for `viewer`. - bool isInit(CGAL::Three::Viewer_interface* viewer)const; + bool isInit(CGAL::Three::Viewer_interface* viewer) const; //!Returns the float alpha value of an item. //! This value is between 0.0f and 1.0f. @@ -198,7 +198,7 @@ protected: /*! Fills the `Vbo`s with data. */ - virtual void initializeBuffers(Viewer_interface*)const{} + virtual void initializeBuffers(Viewer_interface*) const {} //!Creates the VAOs and VBOs for viewer. virtual void initGL(CGAL::Three::Viewer_interface* viewer) const; @@ -210,9 +210,10 @@ protected: //! \brief setBbox allows to set the Bbox in compute_bbox(); //! \param b //! - void setBbox(Bbox b)const ; + void setBbox(Bbox b) const; + + virtual void computeElements() const {} - virtual void computeElements()const{} protected: friend struct PRIV; mutable PRIV* priv; diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/mark_domain_in_triangulation.h b/Triangulation_2/doc/Triangulation_2/CGAL/mark_domain_in_triangulation.h index 9c98da9b802..b82bf923434 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/mark_domain_in_triangulation.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/mark_domain_in_triangulation.h @@ -2,7 +2,8 @@ namespace CGAL { /*! \ingroup PkgTriangulation2Miscellaneous -marks faces connected with non constrained edges + +\brief marks faces connected with non constrained edges as inside of the domain based on the nesting level. The function starts from facets incident to the infinite vertex, with a nesting @@ -10,6 +11,8 @@ level of 0. Then recursively considers the non-explored facets incident to constrained edges bounding the former set and increase the nesting level by 1. Facets in the domain are those with an odd nesting level. +For this overload, the "in domain" information is set in `ipm`. + \tparam CT a constrained triangulation \tparam InDomainPmap a class model of `ReadWritePropertyMap` with `CT::Face_handle` as key type and `bool` as value type. @@ -23,9 +26,17 @@ mark_domain_in_triangulation(CT& ct, InDomainPmap ipm); /*! \ingroup PkgTriangulation2Miscellaneous -As the function above. -Requires that the face type of `CT` has the methods `bool is_in_domain()` and `void set_in_domain(bool)`. +\brief marks faces connected with non constrained edges +as inside of the domain based on the nesting level. + +The function starts from facets incident to the infinite vertex, with a nesting +level of 0. Then recursively considers the non-explored facets incident +to constrained edges bounding the former set and increase the nesting level by 1. +Facets in the domain are those with an odd nesting level. + +For this overload, the "in domain" marker is contained in the face type of `CT`, which must provide +the methods `bool is_in_domain()` and `void set_in_domain(bool)`. \tparam CT a constrained triangulation diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_vertex_base_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_vertex_base_2.h index 36ec36f2309..cc937b133c6 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_vertex_base_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_vertex_base_2.h @@ -16,8 +16,8 @@ #include - #include +#include namespace CGAL { @@ -81,7 +81,7 @@ operator<<(std::ostream &os, const Regular_triangulation_vertex_base_2 &v) // non combinatorial information. Default = point { - return os << static_cast(v) << v.point(); + return os << static_cast(v) << IO::serialize(v.point()); } } //namespace CGAL diff --git a/Triangulation_2/include/CGAL/Triangulation_2_to_lcc.h b/Triangulation_2/include/CGAL/Triangulation_2_to_lcc.h index 41a72c1e9de..86d9a71f51e 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_to_lcc.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_to_lcc.h @@ -31,7 +31,7 @@ namespace CGAL { std::map* aface_to_dart=nullptr) { - CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 ); + static_assert( LCC::dimension>=2 && LCC::ambient_dimension==2 ); // Case of empty triangulations. if (atr.number_of_vertices()==0) return LCC::null_descriptor; diff --git a/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h b/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h index 7936ae66336..0e2bb5e0333 100644 --- a/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_vertex_base_2.h @@ -18,6 +18,7 @@ #include #include +#include namespace CGAL { @@ -109,7 +110,7 @@ std::ostream& operator<<(std::ostream &os, const Triangulation_vertex_base_2 &v) // non combinatorial information. Default = point { - return os << static_cast(v) << v.point(); + return os << static_cast(v) << IO::serialize(v.point()); } #ifndef CGAL_NO_DEPRECATED_CODE diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index ea9525febbf..2c600548c69 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -2613,8 +2613,17 @@ remove(Vertex_handle v, bool *could_lock_zone) if(!vertex_validity_check(v, tds())) return true; // vertex is already gone from the TDS, nothing to do - Vertex_handle hint = v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0); - +#ifndef CGAL_LINKED_WITH_TBB + using Vertex_handle_and_point = Vertex_handle; +#endif // not CGAL_LINKED_WITH_TBB + Vertex_handle_and_point hint_and_point{v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0)}; +#ifdef CGAL_LINKED_WITH_TBB + const Vertex_handle& hint = hint_and_point.vh; + const Weighted_point& hint_point_mem = hint_and_point.wpt; +#else // not CGAL_LINKED_WITH_TBB + const Vertex_handle& hint = hint_and_point; + const Weighted_point& hint_point_mem = hint_and_point->point(); +#endif // not CGAL_LINKED_WITH_TBB Self tmp; Vertex_remover remover(tmp); removed = Tr_Base::remove(v, remover, could_lock_zone); @@ -2641,13 +2650,12 @@ remove(Vertex_handle v, bool *could_lock_zone) // the hint. if(!vertex_validity_check(hint, tds())) { - hint = finite_vertices_begin(); + hint_and_point = finite_vertices_begin(); continue; } // We need to make sure that while are locking the position P1 := hint->point(), 'hint' // does not get its position changed to P2 != P1. - const Weighted_point hint_point_mem = hint->point(); if(this->try_lock_point(hint_point_mem) && this->try_lock_point(wp)) { @@ -2657,7 +2665,7 @@ remove(Vertex_handle v, bool *could_lock_zone) if(!vertex_validity_check(hint, tds()) || hint->point() != hint_point_mem) { - hint = finite_vertices_begin(); + hint_and_point = finite_vertices_begin(); this->unlock_all_elements(); continue; } @@ -2668,7 +2676,7 @@ remove(Vertex_handle v, bool *could_lock_zone) { success = true; if(hv != Vertex_handle()) - hint = hv; + hint_and_point = hv; } } diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_vertex_base_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_vertex_base_3.h index f9f642cfbb1..cdd1bce326b 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_vertex_base_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_vertex_base_3.h @@ -18,6 +18,7 @@ #include #include #include +#include namespace CGAL { @@ -75,7 +76,7 @@ std::ostream& operator<<(std::ostream &os, const Regular_triangulation_vertex_base_3 &v) // non combinatorial information. Default = point { - return os << static_cast(v) << v.point(); + return os << static_cast(v) << IO::serialize(v.point()); } } //namespace CGAL diff --git a/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h b/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h index 01a5dbb8535..14f718f0b13 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h +++ b/Triangulation_3/include/CGAL/Triangulation_3_to_lcc.h @@ -49,7 +49,7 @@ namespace CGAL { std::map* avol_to_dart=nullptr) { - CGAL_static_assertion( LCC::dimension>=3 && LCC::ambient_dimension==3 ); + static_assert( LCC::dimension>=3 && LCC::ambient_dimension==3 ); // Case of empty triangulations. if (atr.number_of_vertices() == 0) return LCC::null_descriptor; diff --git a/Triangulation_3/include/CGAL/Triangulation_vertex_base_3.h b/Triangulation_3/include/CGAL/Triangulation_vertex_base_3.h index b4527f6c403..99a589740e2 100644 --- a/Triangulation_3/include/CGAL/Triangulation_vertex_base_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_vertex_base_3.h @@ -17,6 +17,7 @@ #include #include +#include namespace CGAL { @@ -61,6 +62,7 @@ private: Point _p; }; + template < class GT, class DSVb > std::istream& operator>>(std::istream &is, Triangulation_vertex_base_3 &v) @@ -74,7 +76,7 @@ std::ostream& operator<<(std::ostream &os, const Triangulation_vertex_base_3 &v) // non combinatorial information. Default = point { - return os << static_cast(v) << v.point(); + return os << static_cast(v) << IO::serialize(v.point()); } } //namespace CGAL diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index ffd521512de..88d63413f64 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -28,6 +28,7 @@ create_single_source_cgal_program("test_segment_simplex_traverser_3.cpp" ) create_single_source_cgal_program("test_static_filters.cpp") create_single_source_cgal_program("test_triangulation_3.cpp") create_single_source_cgal_program("test_io_triangulation_3.cpp") +create_single_source_cgal_program("test_triangulation_serialization_3.cpp") if(TARGET CGAL::TBB_support) message(STATUS "Found TBB") diff --git a/Triangulation_3/test/Triangulation_3/test_triangulation_serialization_3.cpp b/Triangulation_3/test/Triangulation_3/test_triangulation_serialization_3.cpp new file mode 100644 index 00000000000..91a969dcc98 --- /dev/null +++ b/Triangulation_3/test/Triangulation_3/test_triangulation_serialization_3.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include + +#include + + +#include + +template +void test() +{ + typedef typename K::FT FT; + CGAL::Delaunay_triangulation_3 dt3; + + + // create a bunch of points + CGAL::Random random; + FT x,y,z; + for (int n=0;n<50;++n) + { + x=random.get_int(-500,500); + y=random.get_int(-500,500); + z=random.get_int(-500,500); + dt3.insert(typename K::Point_3(x/FT(3),y/FT(5),z/FT(7))); + } + + std::stringstream buffer; + buffer << std::setprecision(17) << dt3; + decltype(dt3) dt3_bis; + buffer >> dt3_bis; + + assert(dt3==dt3_bis); +} + +int main() +{ + test>(); + test(); + test(); +} \ No newline at end of file diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp index 9b492a82213..99bf18bc2ec 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp @@ -13,8 +13,6 @@ #include #include -#include - #include #include diff --git a/Triangulation_on_sphere_2/doc/Triangulation_on_sphere_2/Triangulation_on_sphere_2.txt b/Triangulation_on_sphere_2/doc/Triangulation_on_sphere_2/Triangulation_on_sphere_2.txt index eb04ce3ebc2..287df7c9382 100644 --- a/Triangulation_on_sphere_2/doc/Triangulation_on_sphere_2/Triangulation_on_sphere_2.txt +++ b/Triangulation_on_sphere_2/doc/Triangulation_on_sphere_2/Triangulation_on_sphere_2.txt @@ -143,7 +143,7 @@ Two traits classes are offered with this package as models of the concept `Delau for points on the sphere: given a point `p` in 3D space, this traits class manipulates directly its projection on the sphere (that is, the intersection of the sphere and the segment with endpoints `p` and the center of the sphere). Consequently, all points to be inserted are on the sphere. - This traits enable manipulating points that are not on the sphere, but whose triangulation + This traits class enables manipulating points that are not on the sphere, but whose triangulation on the sphere is still interesting, such as geographical coordinates with altitude.

  • diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp index 05a9135b26c..01a32e9e9a6 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp @@ -36,7 +36,7 @@ int main(int, char**) std::cout << "It has:\n"; std::cout << dtos.number_of_vertices() << " vertices\n"; std::cout << dtos.number_of_edges() << " edges\n"; - std::cout << dtos.number_of_faces() << " solid faces\n"; + std::cout << dtos.number_of_solid_faces() << " solid faces\n"; std::cout << dtos.number_of_ghost_faces() << " ghost faces\n" << std::endl; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp index f2dcb474906..23bed505d5b 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp @@ -54,7 +54,7 @@ int main(int argc, char** argv) DToS2 dtos(points.begin(), points.end(), traits); std::cout << dtos.number_of_vertices() << " vertices" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl; CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17)); diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp index 814c36b7089..3dafdcf9bca 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp @@ -3,8 +3,6 @@ #include #include -#include - typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Projection_on_sphere_traits_3 Traits; @@ -36,7 +34,7 @@ int main(int, char**) std::cout << "The triangulation now has dimension: " << dtos.dimension() << " and\n"; std::cout << dtos.number_of_vertices() << " vertices" << std::endl; std::cout << dtos.number_of_edges() << " edges" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp index c6c433f824c..682eb394ffe 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) DToS2 dtos(points.begin(), points.end(), traits); std::cout << dtos.number_of_vertices() << " vertices" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17)); diff --git a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h index a447bc7e335..c6751c2a3cb 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h @@ -27,7 +27,6 @@ #include #include -#include #include #include @@ -632,8 +631,8 @@ insert(InputIterator first, InputIterator beyond, { typedef Point_3_with_iterator P3_wit; - CGAL_static_assertion((std::is_same::value_type, Point>::value)); - CGAL_static_assertion(!(std::is_same::value)); + static_assert(std::is_same::value_type, Point>::value); + static_assert(!std::is_same::value); const size_type n = number_of_vertices(); diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h index fbe52979939..98dc2f54c65 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h @@ -56,7 +56,7 @@ double get_theta(typename Kernel::Point_3& pt, #endif >::type Col; - CGAL_static_assertion_msg(!(std::is_same::value), + static_assert(!(std::is_same::value), "Eigen is required to perform arc subsampling!"); auto V1c = V1.cartesian_begin(), V2c = V2.cartesian_begin(), V3c = V3.cartesian_begin();