diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h index 6d72346f333..02a84af783b 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Michael Kerber // @@ -17,7 +17,7 @@ namespace CGAL { #include - + #include #include @@ -39,7 +39,7 @@ public: typedef typename Algebraic_kernel_d_1::Algebraic_real_1 Algebraic_real_1; - Bitstream_coefficient_kernel_at_alpha_rep() {} + Bitstream_coefficient_kernel_at_alpha_rep() : _m_kernel(nullptr) {} Bitstream_coefficient_kernel_at_alpha_rep(Algebraic_kernel_d_1* kernel, Algebraic_real_1 alpha) @@ -52,14 +52,14 @@ private: Algebraic_kernel_d_1* _m_kernel; Algebraic_real_1 _m_alpha; - + }; template < typename AlgebraicKernel_1 > class Bitstream_coefficient_kernel_at_alpha : public CGAL::Handle_with_policy < CGAL::internal::Bitstream_coefficient_kernel_at_alpha_rep - + > { @@ -71,19 +71,19 @@ public: typedef AlgebraicKernel_1 Algebraic_kernel_d_1; typedef typename Algebraic_kernel_d_1::Algebraic_real_1 Algebraic_real_1; - + typedef typename Algebraic_kernel_d_1::Polynomial_1 Polynomial_1; typedef Polynomial_1 Coefficient; - typedef typename + typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel - Arithmetic_kernel; + Arithmetic_kernel; typedef typename Arithmetic_kernel::Integer Integer; typedef typename Algebraic_kernel_d_1::Bound Bound; - + typedef typename Arithmetic_kernel::Bigfloat_interval Bigfloat_interval; typedef CGAL::internal::Bitstream_coefficient_kernel_at_alpha_rep @@ -99,13 +99,13 @@ public: Bitstream_coefficient_kernel_at_alpha() : Base(Rep()) {} -#ifdef DOXYGEN_RUNNING +#ifdef DOXYGEN_RUNNING Bitstream_coefficient_kernel_at_alpha(const Self& traits) : Base(static_cast(traits)) {} #endif - + Bitstream_coefficient_kernel_at_alpha(Algebraic_kernel_d_1* kernel, - Algebraic_real_1 alpha) + Algebraic_real_1 alpha) : Base(kernel,alpha) {} //@} @@ -114,8 +114,8 @@ public: //! @{ struct Is_zero : public CGAL::cpp98::unary_function { - - Is_zero(Algebraic_kernel_d_1* kernel,Algebraic_real_1 alpha) + + Is_zero(Algebraic_kernel_d_1* kernel,Algebraic_real_1 alpha) : _m_kernel(kernel),_m_alpha(alpha) {} bool operator() (Coefficient f) const { @@ -132,51 +132,51 @@ public: return Is_zero(this->ptr()->_m_kernel,this->ptr()->_m_alpha); } - struct Convert_to_bfi + struct Convert_to_bfi : public CGAL::cpp98::unary_function { - + Convert_to_bfi(Algebraic_kernel_d_1* kernel, - Algebraic_real_1 alpha) - : _m_kernel(kernel), _m_alpha(alpha) {} + Algebraic_real_1 alpha) + : _m_kernel(kernel), _m_alpha(alpha) {} Bigfloat_interval operator() (Coefficient f) const { typename CGAL::Polynomial_traits_d ::template Rebind::Other::Type f_bfi; + + typename Algebraic_kernel_d_1::Approximate_relative_1 approx_alpha + =_m_kernel->approximate_relative_1_object(); - typename Algebraic_kernel_d_1::Approximate_relative_1 approx_alpha - =_m_kernel->approximate_relative_1_object(); - - typedef typename Algebraic_kernel_d_1::Bound Bound; - - Bigfloat_interval alpha_bfi, f_alpha_bfi; - + typedef typename Algebraic_kernel_d_1::Bound Bound; + + Bigfloat_interval alpha_bfi, f_alpha_bfi; + long p = CGAL::get_precision(Bigfloat_interval()); - + long prec = 16; - + long wbit = 0; - - while(true) { + + while(true) { CGAL::set_precision(Bigfloat_interval(),prec); - + f_bfi = this->_convert_polynomial_to_bfi(f); - - std::pair alpha_bounds - = approx_alpha(_m_alpha,prec); - - alpha_bfi = CGAL::hull - (CGAL::convert_to_bfi(alpha_bounds.first), - CGAL::convert_to_bfi(alpha_bounds.second)); - - f_alpha_bfi = f_bfi.evaluate(alpha_bfi); - + + std::pair alpha_bounds + = approx_alpha(_m_alpha,prec); + + alpha_bfi = CGAL::hull + (CGAL::convert_to_bfi(alpha_bounds.first), + CGAL::convert_to_bfi(alpha_bounds.second)); + + f_alpha_bfi = f_bfi.evaluate(alpha_bfi); + if(!CGAL::singleton(f_alpha_bfi)) { long ceil = CGAL::internal::ceil_log2_abs(f_alpha_bfi); long signi = CGAL::get_significant_bits(f_alpha_bfi); wbit = ceil - signi + p; - - } - + + } + if(wbit<-5 || CGAL::singleton(f_alpha_bfi)) { break; } else { @@ -186,9 +186,9 @@ public: CGAL::set_precision(Bigfloat_interval(),p); return f_alpha_bfi; } - + private: - + typename CGAL::Polynomial_traits_d ::template Rebind::Other::Type _convert_polynomial_to_bfi(Coefficient f) const { @@ -201,11 +201,11 @@ public: } return typename CGAL::Polynomial_traits_d ::template Rebind::Other - ::Construct_polynomial()(coeffs.begin(),coeffs.end()); + ::Construct_polynomial()(coeffs.begin(),coeffs.end()); } Algebraic_kernel_d_1* _m_kernel; - + Algebraic_real_1 _m_alpha; }; diff --git a/Alpha_shapes_3/examples/Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp index 1a3c372274f..1df9c1c13bf 100644 --- a/Alpha_shapes_3/examples/Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_weighted_periodic_alpha_shapes_3.cpp @@ -41,8 +41,8 @@ int main() int n; is >> n; std::cout << "Reading " << n << " points " << std::endl; - Bare_point bp; for( ; n>0 ; n--) { + Bare_point bp; is >> bp; Weighted_point p(bp, 0.0001 * random.get_double(0., 0.015625)); // arbitrary weights pts.push_back(p); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp index 1d8b8924fdd..97aad8daa24 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/cone_spanners.cpp @@ -60,7 +60,7 @@ private: void Cone_spanners_ipelet::protected_run(int fn) { std::vector lst; - int number_of_cones; + int number_of_cones = 0; switch (fn){ case 0: case 1: diff --git a/Cartesian_kernel/include/CGAL/Cartesian/ConicCPA2.h b/Cartesian_kernel/include/CGAL/Cartesian/ConicCPA2.h index 35731896215..0461b383ba8 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/ConicCPA2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/ConicCPA2.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000,2001 +// Copyright (c) 2000,2001 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Bernd Gaertner, Sven Schoenherr @@ -48,8 +48,8 @@ class ConicCPA2 Conic_type type; CGAL::Orientation o; bool empty, trivial, degenerate; - - + + void set_linear_combination (const FT& a1, const ConicCPA2& c1, const FT& a2, const ConicCPA2& c2) @@ -61,7 +61,7 @@ class ConicCPA2 _v = a1 * c1.v() + a2 * c2.v(); _w = a1 * c1.w() + a2 * c2.w(); } - + static void set_two_linepairs (const PT& p1, const PT& p2, const PT& p3, @@ -75,7 +75,7 @@ class ConicCPA2 da.get (p2, x2, y2); da.get (p3, x3, y3); da.get (p4, x4, y4); - + CGAL::Orientation side1_24 = (CGAL::Orientation)(CGAL_NTS sign (-x1*y4+x2*y4 +x4*y1-x2*y1 @@ -104,7 +104,7 @@ class ConicCPA2 } } } - + void set_ellipse (const ConicCPA2& pair1, const ConicCPA2& pair2) { @@ -113,14 +113,14 @@ class ConicCPA2 set_linear_combination (pair2.det()-b, pair1, pair1.det()-b, pair2); } - + void set (const ConicCPA2& c1, const ConicCPA2& c2, const PT& p) { set_linear_combination (c2.evaluate(p), c1, -c1.evaluate(p), c2); } - + CGAL::Sign vol_derivative (FT dr, FT ds, FT dt, FT du, FT dv, FT dw) const { @@ -133,10 +133,10 @@ class ConicCPA2 b0 = (FT(4)*r()*s()-t()*t())*w() -u()*u()*s()-v()*v()*r()+u()*v()*t(), c0 = -FT(2)*a0*b1 + FT(3)*a1*b0; - + return CGAL_NTS sign ((int)-CGAL_NTS sign (c0)*o); } - + double vol_minimum (FT dr, FT ds, FT dt, FT du, FT dv, FT dw) const { FT a2 = FT(4)*dr*ds-dt*dt, @@ -156,7 +156,7 @@ class ConicCPA2 c2 = -FT(6)*a0*b3 - a1*b2 + FT(4)*a2*b1, c1 = -FT(4)*a0*b2 + a1*b1 + FT(6)*a2*b0, c0 = -FT(2)*a0*b1 + FT(3)*a1*b0; - + double roots[3]; int nr_roots = solve_cubic (CGAL::to_double(c3), CGAL::to_double(c2), @@ -169,15 +169,15 @@ class ConicCPA2 CGAL::to_double(b2), CGAL::to_double(b1), CGAL::to_double(b0)); } - - + + protected: FT det () const { return FT(4)*s()*r() - t()*t(); } - + void analyse( ) { FT d = det(); @@ -189,8 +189,8 @@ class ConicCPA2 FT z_prime = d*w() - u()*u()*s() - v()*v()*r() + u()*v()*t(); o = (CGAL::Orientation)(CGAL_NTS sign (z_prime)); degenerate = (o == CGAL::ZERO); - - + + } break; case PARABOLA: @@ -256,8 +256,8 @@ class ConicCPA2 else o = CGAL::ZERO; } - - + + } break; case ELLIPSE: @@ -272,72 +272,69 @@ class ConicCPA2 empty ? o = CGAL::NEGATIVE : o = CGAL::POSITIVE; } degenerate = empty || CGAL_NTS is_zero (z_prime); - - + + } break; } } - + FT evaluate (const PT& p) const { FT x, y; dao.get (p, x, y); return r()*x*x + s()*y*y + t()*x*y + u()*x + v()*y + w(); } - - + + public: ConicCPA2 ( const DA& da = DA()) : dao( da) { } - + ConicCPA2 (FT r, FT s, FT t, FT u, FT v, FT w, const DA& da = DA()) : dao( da), _r(r), _s(s), _t(t), _u(u), _v(v), _w(w) { analyse(); } - + const DA& da() const { return dao; } - + FT r() const { return _r;} FT s() const { return _s;} FT t() const { return _t;} FT u() const { return _u;} FT v() const { return _v;} FT w() const { return _w;} - + PT center () const { CGAL_kernel_precondition (type != PARABOLA); - // PT p; - // replaced previous line by following hack (no idea - // why original version doesn't work) - typename DA::Point p; - FT two = FT(2); - FT div = -det(); - dao.set( p, (two*s()*u() - t()*v()) / div, - (two*r()*v() - t()*u()) / div); - return p; - } + const FT two = FT(2); + const FT div = -det(); + + return PT((two*s()*u() - t()*v()) / div, + (two*r()*v() - t()*u()) / div); + } + Conic_type conic_type () const { return type; } - + bool is_hyperbola () const { return (type == HYPERBOLA); } - + bool is_parabola () const { return (type == PARABOLA); } - + bool is_ellipse () const { return (type == ELLIPSE); @@ -347,53 +344,53 @@ class ConicCPA2 { return (type == ELLIPSE && (r()==s()) && CGAL_NTS is_zero (t())); } - + bool is_empty () const { return empty; } - + bool is_trivial () const { return trivial; } - + bool is_degenerate () const { return degenerate; } - + CGAL::Orientation orientation () const { return o; } - + CGAL::Oriented_side oriented_side (const PT& p) const { return (CGAL::Oriented_side)(CGAL_NTS sign (evaluate (p))); } - + bool has_on_positive_side (const PT& p) const { return (CGAL_NTS is_positive (evaluate(p))); } - + bool has_on_negative_side (const PT& p) const { return (CGAL_NTS is_negative (evaluate(p))); } - + bool has_on_boundary (const PT& p) const { return (CGAL_NTS is_zero (evaluate(p))); } - + bool has_on (const PT& p) const { return (CGAL_NTS is_zero (evaluate(p))); } - - + + Convex_side convex_side (const PT& p) const { switch (o) { @@ -407,17 +404,17 @@ class ConicCPA2 // keeps g++ happy return( Convex_side( 0)); } - + bool has_on_convex_side (const PT& p) const { return (convex_side (p) == ON_CONVEX_SIDE); } - + bool has_on_nonconvex_side (const PT& p) const { return (convex_side (p) == ON_NONCONVEX_SIDE); } - + bool operator == ( const ConicCPA2<_PT,_DA>& c) const { // find coefficient != 0 @@ -429,7 +426,7 @@ class ConicCPA2 if ( ! CGAL_NTS is_zero( v())) factor1 = v(); else if ( ! CGAL_NTS is_zero( w())) factor1 = w(); else CGAL_kernel_assertion_msg( false, "all coefficients zero"); - + // find coefficient != 0 FT factor2(0); if ( ! CGAL_NTS is_zero( c.r())) factor2 = c.r(); else @@ -439,7 +436,7 @@ class ConicCPA2 if ( ! CGAL_NTS is_zero( c.v())) factor2 = c.v(); else if ( ! CGAL_NTS is_zero( c.w())) factor2 = c.w(); else CGAL_kernel_assertion_msg( false, "all coefficients zero"); - + return( ( r()*factor2 == c.r()*factor1) && ( s()*factor2 == c.s()*factor1) && ( t()*factor2 == c.t()*factor1) @@ -447,27 +444,27 @@ class ConicCPA2 && ( v()*factor2 == c.v()*factor1) && ( w()*factor2 == c.w()*factor1)); } - + void set (FT r_, FT s_, FT t_, FT u_, FT v_, FT w_) { _r = r_; _s = s_; _t = t_; _u = u_; _v = v_; _w = w_; analyse(); } - + void set_opposite () { _r = -r(); _s = -s(); _t = -t(); _u = -u(); _v = -v(); _w = -w(); o = CGAL::opposite(orientation()); } - - void set_circle (const PT& p1, const PT& p2, const PT& p3) + + void set_circle (const PT& p1, const PT& p2, const PT& p3) { // the circle will have r = s = det, t=0 FT x1, y1, x2, y2, x3, y3; dao.get (p1, x1, y1); dao.get (p2, x2, y2); dao.get (p3, x3, y3); - + // precondition: p1, p2, p3 not collinear FT det = -x3*y2+x1*y2+x2*y3-x1*y3+x3*y1-x2*y1; CGAL_kernel_precondition (!CGAL_NTS is_zero (det)); @@ -483,7 +480,7 @@ class ConicCPA2 _r = det; _s = det; _t = FT(0); - + analyse(); CGAL_kernel_postcondition(is_circle()); CGAL_kernel_postcondition(has_on_boundary(p1)); @@ -498,76 +495,76 @@ class ConicCPA2 dao.get (p2, x2, y2); dao.get (p3, x3, y3); dao.get (p4, x4, y4); - + // precondition: p1 != p2, p3 != p4 CGAL_kernel_precondition ( ((x1 != x2) || (y1 != y2)) && ((x3 != x4) || (y3 != y4)) ); - + FT x2_x1 = x2-x1; FT x4_x3 = x4-x3; FT y1_y2 = y1-y2; FT y3_y4 = y3-y4; FT x1y2_y1x2 = x1*y2-y1*x2; FT x3y4_y3x4 = x3*y4-y3*x4; - + _r = y1_y2 * y3_y4; _s = x2_x1 * x4_x3; _t = x2_x1 * y3_y4 + y1_y2 * x4_x3; _u = x1y2_y1x2 * y3_y4 + y1_y2 * x3y4_y3x4; _v = x1y2_y1x2 * x4_x3 + x2_x1 * x3y4_y3x4; _w = x1y2_y1x2 * x3y4_y3x4; - + analyse(); } - + void set_ellipse (const PT& p1, const PT& p2, const PT& p3) { FT x1, y1, x2, y2, x3, y3; dao.get (p1, x1, y1); dao.get (p2, x2, y2); dao.get (p3, x3, y3); - + // precondition: p1, p2, p3 not collinear FT det = -x3*y2+x1*y2+x2*y3-x1*y3+x3*y1-x2*y1; CGAL_kernel_precondition (!CGAL_NTS is_zero (det)); - + FT x1x1 = x1*x1, y1y1 = y1*y1, x2x2 = x2*x2, y2y2 = y2*y2, x3x3 = x3*x3, y3y3 = y3*y3, // x_i^2, y_i^2 two = FT(2); - + _r = y1y1 - y1*y2 - y1*y3 + y2y2 - y2*y3 + y3y3; - + _s = x1x1 - x1*x2 - x1*x3 + x2x2 - x2*x3 + x3x3; - + _t = -two*x1*y1 + x1*y2 + x1*y3 + y1*x2 -two*x2*y2 + x2*y3 + y1*x3 + y2*x3 -two*x3*y3; - + _u = -(y2y2*x3 - x2*y2*y3 - y2*x3*y3 + x1*y3y3 + x2*y3y3 + y1y1*x2 + y1y1*x3 - x1*y1*y2 - y1*x2*y2 - x1*y1*y3 - y1*x3*y3 + x1*y2y2); - + _v = -(x2x2*y3 - x2*y2*x3 - x2*x3*y3 + y1*x3x3 + y2*x3x3 + x1x1*y2 + x1x1*y3 - x1*y1*x2 - x1*x2*y2 - x1*y1*x3 - x1*x3*y3 + y1*x2x2); - + _w = y1y1*x2*x3 - x1*y1*y2*x3 - y1*x2*y2*x3 + y1*y2*x3x3 - x1*y1*x2*y3 + y1*x2x2*y3 - y1*x2*x3*y3 + x1*y2y2*x3 + x1x1*y2*y3 - x1*x2*y2*y3 - x1*y2*x3*y3 + x1*x2*y3y3; - + type = ELLIPSE; degenerate = trivial = empty = false; o = CGAL::NEGATIVE; if (CGAL_NTS is_positive (det)) set_opposite(); } - + void set_ellipse (const PT& p1, const PT& p2, const PT& p3, const PT& p4, CGAL::Orientation _o = POSITIVE) @@ -578,7 +575,7 @@ class ConicCPA2 analyse(); if (o != _o) set_opposite(); } - + void set (const PT& p1, const PT& p2, const PT& p3, const PT& p4, const PT& p5, CGAL::Orientation _o = POSITIVE) { @@ -591,8 +588,8 @@ class ConicCPA2 CGAL_kernel_precondition (!is_trivial()); if (o != _o) set_opposite(); } - - + + }; diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index c5066bec4d0..b340100fc96 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -1,16 +1,16 @@ -// Copyright (c) 2000 +// Copyright (c) 2000 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Sven Schoenherr, Herve Bronnimann, Sylvain Pion @@ -178,10 +178,10 @@ inline void line_from_pointsC2(const FT &px, const FT &py, const FT &qx, const FT &qy, - FT &a, FT &b, FT &c) + FT &a, FT &b, FT &c) { // The horizontal and vertical line get a special treatment - // in order to make the intersection code robust for doubles + // in order to make the intersection code robust for doubles if(py == qy){ a = 0 ; if(qx > px){ @@ -218,7 +218,7 @@ inline void line_from_point_directionC2(const FT &px, const FT &py, const FT &dx, const FT &dy, - FT &a, FT &b, FT &c) + FT &a, FT &b, FT &c) { a = - dy; b = dx; @@ -229,8 +229,8 @@ template < class FT > CGAL_KERNEL_INLINE void bisector_of_pointsC2(const FT &px, const FT &py, - const FT &qx, const FT &qy, - FT &a, FT &b, FT& c ) + const FT &qx, const FT &qy, + FT &a, FT &b, FT& c ) { a = 2 * (px - qx); b = 2 * (py - qy); @@ -242,8 +242,8 @@ template < class FT > CGAL_KERNEL_INLINE void bisector_of_linesC2(const FT &pa, const FT &pb, const FT &pc, - const FT &qa, const FT &qb, const FT &qc, - FT &a, FT &b, FT &c) + const FT &qa, const FT &qb, const FT &qc, + FT &a, FT &b, FT &c) { // We normalize the equations of the 2 lines, and we then add them. FT n1 = CGAL_NTS sqrt(CGAL_NTS square(pa) + CGAL_NTS square(pb)); @@ -268,7 +268,7 @@ line_y_at_xC2(const FT &a, const FT &b, const FT &c, const FT &x) return (-a*x-c) / b; } -template < class FT > +template < class FT > inline void line_get_pointC2(const FT &a, const FT &b, const FT &c, const FT &i, @@ -276,15 +276,12 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, const FT &i, { if (CGAL_NTS is_zero(b)) { - // Laurent Rineau, 2018/12/07: I add this CGAL_assume to calm - // down a warning from MSVC 2017: + // Silence a warning for MSVC 2017 // > include\cgal\constructions\kernel_ftc2.h(287) : // > warning C4723: potential divide by 0 - // The test `!boost::is_integral::value` is there to avoid - // that `a != 0` is tested on anything but integral types, for - // performance reasons. - CGAL_assume(!boost::is_integral::value || a != FT(0)); - +#if defined(BOOST_MSVC) +#pragma warning(suppress:4723) +#endif x = -c/a; y = 1 - i * a; } @@ -295,12 +292,12 @@ line_get_pointC2(const FT &a, const FT &b, const FT &c, const FT &i, } } -template < class FT > +template < class FT > inline void perpendicular_through_pointC2(const FT &la, const FT &lb, - const FT &px, const FT &py, - FT &a, FT &b, FT &c) + const FT &px, const FT &py, + FT &a, FT &b, FT &c) { a = -lb; b = la; @@ -311,8 +308,8 @@ template < class FT > CGAL_KERNEL_MEDIUM_INLINE void line_project_pointC2(const FT &la, const FT &lb, const FT &lc, - const FT &px, const FT &py, - FT &x, FT &y) + const FT &px, const FT &py, + FT &x, FT &y) { if (certainly(is_zero(la))) // horizontal line { diff --git a/Convex_hull_d/test/Convex_hull_d/chull_d-test.cpp b/Convex_hull_d/test/Convex_hull_d/chull_d-test.cpp index 821ff7f6c71..cff7617e743 100644 --- a/Convex_hull_d/test/Convex_hull_d/chull_d-test.cpp +++ b/Convex_hull_d/test/Convex_hull_d/chull_d-test.cpp @@ -24,7 +24,7 @@ typedef double RT; int main() { - CGAL_KD_SETDTHREAD(11); + CGAL_KD_SETDTHREAD(11); CGAL::set_pretty_mode ( std::cerr ); CGAL_TEST_START; { @@ -36,7 +36,7 @@ int main() typedef Convex_hull_d::Facet_handle Facet_handle; typedef Convex_hull_d::Vertex_handle Vertex_handle; - Convex_hull_d T1(2); + Convex_hull_d T1(2); const Convex_hull_d* pT1 = &T1; Point p1(0,0,1); Point p2(1,0,1); @@ -73,15 +73,21 @@ int main() CGAL_TEST(h.has_on(pf0)&&h.has_on(pf1)); std::list G = T1.facets_visible_from(p4); CGAL_TEST(G.size()==1); - CGAL_TEST(T1.bounded_side(p4)==CGAL::ON_UNBOUNDED_SIDE && + CGAL_TEST(T1.bounded_side(p4)==CGAL::ON_UNBOUNDED_SIDE && T1.bounded_side(Point(1,1,10))==CGAL::ON_BOUNDED_SIDE); Convex_hull_d::Point_const_iterator pit; Convex_hull_d::Vertex_iterator vit; Convex_hull_d::Simplex_iterator sit; - for (pit = T1.points_begin(); pit != T1.points_end(); pit++) *pit; - for (vit = T1.vertices_begin(); vit != T1.vertices_end(); vit++) *vit; - for (sit = T1.simplices_begin(); sit != T1.simplices_end(); sit++) *sit; + for (pit = T1.points_begin(); pit != T1.points_end(); pit++) { + const Point& p = *pit; + CGAL_USE(p); + } + for (vit = T1.vertices_begin(); vit != T1.vertices_end(); vit++) + *vit; + for (sit = T1.simplices_begin(); sit != T1.simplices_end(); sit++) + *sit; + T1.is_valid(); T1.clear(2); CGAL_TEST(T1.number_of_vertices()==0); @@ -97,17 +103,17 @@ int main() #ifndef _MSC_VER // truncation due to name length exceeded Convex_hull_d::Hull_vertex_iterator hvit; int vnum(0); - for (hvit = T1.hull_vertices_begin(); - hvit != T1.hull_vertices_end(); ++vnum, ++hvit) *hvit; + for (hvit = T1.hull_vertices_begin(); + hvit != T1.hull_vertices_end(); ++vnum, ++hvit) *hvit; CGAL_TEST(vnum==4); - Convex_hull_d::Facet_const_iterator fcit; + Convex_hull_d::Facet_const_iterator fcit; for (fcit = pT1->facets_begin(); fcit != pT1->facets_end(); ++fcit) *fcit; - Convex_hull_d::Hull_vertex_const_iterator hvcit; - for (hvcit = pT1->hull_vertices_begin(); + Convex_hull_d::Hull_vertex_const_iterator hvcit; + for (hvcit = pT1->hull_vertices_begin(); hvcit != pT1->hull_vertices_end(); ++hvcit) *hvcit; - Convex_hull_d::Hull_point_const_iterator hpcit; - for (hpcit = pT1->hull_points_begin(); + Convex_hull_d::Hull_point_const_iterator hpcit; + for (hpcit = pT1->hull_points_begin(); hpcit != pT1->hull_points_end(); ++hpcit) *hpcit; #endif } @@ -122,7 +128,7 @@ int main() typedef Convex_hull_d::Simplex_handle Simplex_handle; typedef Convex_hull_d::Facet_handle Facet_handle; typedef Convex_hull_d::Vertex_handle Vertex_handle; - Convex_hull_d T2(3); + Convex_hull_d T2(3); Point p1(0,0,0,1); Point p2(1,0,0,1); Point p3(0,1,0,1); @@ -167,7 +173,7 @@ int main() std::list G = T2.facets_visible_from(p5); CGAL_TEST(G.size()==1); - CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && + CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && T2.bounded_side(Point(1,1,1,10))==CGAL::ON_BOUNDED_SIDE); T2.is_valid(); T2.clear(3); @@ -185,7 +191,7 @@ int main() typedef Convex_hull_d::Simplex_handle Simplex_handle; typedef Convex_hull_d::Facet_handle Facet_handle; typedef Convex_hull_d::Vertex_handle Vertex_handle; - Convex_hull_d T2(3); + Convex_hull_d T2(3); Point p1(0,0,0,1); Point p2(1,0,0,1); Point p3(0,1,0,1); @@ -230,7 +236,7 @@ int main() std::list G = T2.facets_visible_from(p5); CGAL_TEST(G.size()==1); - CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && + CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && T2.bounded_side(Point(1,1,1,10))==CGAL::ON_BOUNDED_SIDE); T2.is_valid(); T2.clear(3); @@ -245,7 +251,7 @@ int main() typedef Convex_hull_d::Simplex_handle Simplex_handle; typedef Convex_hull_d::Facet_handle Facet_handle; typedef Convex_hull_d::Vertex_handle Vertex_handle; - Convex_hull_d T2(3); + Convex_hull_d T2(3); Point p1(0,0,0,1); Point p2(1,0,0,1); Point p3(0,1,0,1); @@ -290,7 +296,7 @@ int main() std::list G = T2.facets_visible_from(p5); CGAL_TEST(G.size()==1); - CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && + CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && T2.bounded_side(Point(1,1,1,10))==CGAL::ON_BOUNDED_SIDE); T2.is_valid(); T2.clear(3); @@ -305,7 +311,7 @@ int main() typedef Convex_hull_d::Simplex_handle Simplex_handle; typedef Convex_hull_d::Facet_handle Facet_handle; typedef Convex_hull_d::Vertex_handle Vertex_handle; - Convex_hull_d T2(3); + Convex_hull_d T2(3); Point p1(0,0,0,1); Point p2(1,0,0,1); Point p3(0,1,0,1); @@ -350,7 +356,7 @@ int main() std::list G = T2.facets_visible_from(p5); CGAL_TEST(G.size()==1); - CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && + CGAL_TEST(T2.bounded_side(p5)==CGAL::ON_UNBOUNDED_SIDE && T2.bounded_side(Point(1,1,1,10))==CGAL::ON_BOUNDED_SIDE); T2.is_valid(); T2.clear(3); diff --git a/Hash_map/test/Hash_map/Hash.cpp b/Hash_map/test/Hash_map/Hash.cpp index beb15ce87f0..11c54cfcb0a 100644 --- a/Hash_map/test/Hash_map/Hash.cpp +++ b/Hash_map/test/Hash_map/Hash.cpp @@ -41,7 +41,8 @@ fct(const P& ) { std::map M; Descriptor d; - M.find(d); + typename std::map::const_iterator it = M.find(d); + CGAL_USE(it); boost::unordered_map U; U[d] = 12; @@ -56,7 +57,9 @@ void fct2() { // For dart handle std::map M; dh e; - M.find(e); + typename std::map::const_iterator it = M.find(e); + CGAL_USE(it); + boost::unordered_map U; U[e] = 12; } @@ -64,7 +67,9 @@ void fct2() { // For vertex attribute handle std::map M; vh e; - M.find(e); + typename std::map::const_iterator it = M.find(e); + CGAL_USE(it); + boost::unordered_map U; U[e] = 12; } diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index aff32baba7b..63c02abf9fe 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -1373,7 +1373,6 @@ private: std::size_t vertex_id(const std::size_t& i) const { - CGAL_precondition(i >= 0); CGAL_precondition((infinite_ && i < 3) || i < 4); return vertices_[i]; } diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h b/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h index 320659a8638..ee4e7c2dad0 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_overlayer.h @@ -6,7 +6,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Michael Seel // Peter Hachenberger @@ -58,7 +58,7 @@ struct SMO_from_segs { SMO_from_segs(SM_decorator Gi, const Iterator_map& Mi) : G(Gi),M(Mi) {} Vertex_handle new_vertex(const Point& p) - { Vertex_handle v = G.new_svertex(p); + { Vertex_handle v = G.new_svertex(p); #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO geninfo::create(G.info(v)); #else @@ -67,12 +67,12 @@ struct SMO_from_segs { return v; } - void link_as_target_and_append(Vertex_handle v, Halfedge_handle e) + void link_as_target_and_append(Vertex_handle v, Halfedge_handle e) { G.link_as_target_and_append(v,e); } Halfedge_handle new_halfedge_pair_at_source(Vertex_handle v) - { Halfedge_handle e = - G.new_shalfedge_pair_at_source(v,SM_decorator::BEFORE); + { Halfedge_handle e = + G.new_shalfedge_pair_at_source(v,SM_decorator::BEFORE); return e; } @@ -92,9 +92,9 @@ struct SMO_from_segs { { if ( M[it] ) v->mark() = true; } void halfedge_below(Vertex_handle v, Halfedge_handle e) const - { + { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::access(G.info(v)) = e; + geninfo::access(G.info(v)) = e; #else G.info(v)=e; #endif @@ -103,24 +103,24 @@ struct SMO_from_segs { Halfedge_handle halfedge_below(Vertex_handle v) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - return geninfo::access(G.info(v)); + return geninfo::access(G.info(v)); #else - return + return boost::any_cast( G.info(v) ); #endif } - void assert_equal_marks(Vertex_handle v1, Vertex_handle v2) const - { + void assert_equal_marks(Vertex_handle v1, Vertex_handle v2) const + { CGAL_USE(v1); CGAL_USE(v2); CGAL_assertion(v1->mark()==v2->mark()); } - void discard_info(Vertex_handle v) const - { + void discard_info(Vertex_handle v) const + { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::clear(G.info(v)); + geninfo::clear(G.info(v)); #else G.info(v)=boost::any(); #endif @@ -143,7 +143,7 @@ struct SMO_from_segs { #else G.info(v)=boost::any(); #endif - + } @@ -160,9 +160,9 @@ struct SMO_from_sm { SM_overlayer G; CGAL::Unique_hash_map& M; - SMO_from_sm(SM_overlayer Gi, - SM_const_decorator* /* pGIi */, - CGAL::Unique_hash_map& Mi) : + SMO_from_sm(SM_overlayer Gi, + SM_const_decorator* /* pGIi */, + CGAL::Unique_hash_map& Mi) : G(Gi), M(Mi) {} Vertex_handle new_vertex(const Point& p) @@ -173,24 +173,24 @@ Vertex_handle new_vertex(const Point& p) } void link_as_target_and_append(Vertex_handle v, Halfedge_handle e) - { CGAL_NEF_TRACEN(" link as target and append " - << e->source()->point() << "->" - << v->point()); - G.link_as_target_and_append(v,e); } + { CGAL_NEF_TRACEN(" link as target and append " + << e->source()->point() << "->" + << v->point()); + G.link_as_target_and_append(v,e); } Halfedge_handle new_halfedge_pair_at_source(Vertex_handle v) { CGAL_NEF_TRACEN(" new halfedge pair at source " << v->point()); - Halfedge_handle e = - G.new_shalfedge_pair_at_source(v,SM_overlayer::BEFORE); + Halfedge_handle e = + G.new_shalfedge_pair_at_source(v,SM_overlayer::BEFORE); G.assoc_info(e); return e; } void halfedge_below(Vertex_handle v, Halfedge_handle e) const -{ +{ CGAL_NEF_TRACEN(" edge below " << v->point() << ":"); CGAL_NEF_TRACEN(&*e); - G.halfedge_below(v) = e; + G.halfedge_below(v) = e; } void supporting_segment(Halfedge_handle e, IT it) const @@ -221,8 +221,8 @@ void trivial_segment(Vertex_handle v, IT it) const G.supp_object(v,si._from) = si._o; } else CGAL_error_msg( "wrong handle"); - - CGAL_NEF_TRACEN("trivial_segment " << si._from << ":" << v->point()); + + CGAL_NEF_TRACEN("trivial_segment " << si._from << ":" << v->point()); // debug(); } @@ -235,13 +235,13 @@ void starting_segment(Vertex_handle v, IT it) const if(se->source()->point() != v->point()) { se = se->twin(); if(se->source()->point() != v->point()) { - G.supp_object(v,si._from) = si._o; - return; + G.supp_object(v,si._from) = si._o; + return; } } G.supp_object(v,si._from) = make_object(se->source()); - CGAL_NEF_TRACEN("starting_segment " << si._from << ":"<< - v->point() << " " << se->source()->point()); + CGAL_NEF_TRACEN("starting_segment " << si._from << ":"<< + v->point() << " " << se->source()->point()); } else if(CGAL::assign(sl, si._o)) { G.supp_object(v,si._from) = si._o; } else @@ -258,15 +258,15 @@ void ending_segment(Vertex_handle v, IT it) const if(se->source()->point() != v->point()) { se = se->twin(); if(se->source()->point() != v->point()) { - G.supp_object(v,si._from) = si._o; - return; + G.supp_object(v,si._from) = si._o; + return; } } G.supp_object(v,si._from) = make_object(se->source()); - CGAL_NEF_TRACEN("ending_segment " << si._from << ":"<< - v->point() << ":" << - se->source()->point() << "->" << - se->twin()->source()->point()); + CGAL_NEF_TRACEN("ending_segment " << si._from << ":"<< + v->point() << ":" << + se->source()->point() << "->" << + se->twin()->source()->point()); } else if(CGAL::assign(sl, si._o)) { G.supp_object(v,si._from) = si._o; } else @@ -277,34 +277,34 @@ void ending_segment(Vertex_handle v, IT it) const void passing_segment(Vertex_handle v, IT it) const { INFO& si = M[it]; if ( si._from == -1 ) return; - G.supp_object(v,si._from) = si._o; - CGAL_NEF_TRACEN("passing_segment " << si._from << ":"<< v->point()); + G.supp_object(v,si._from) = si._o; + CGAL_NEF_TRACEN("passing_segment " << si._from << ":"<< v->point()); // debug(); } Halfedge_handle halfedge_below(Vertex_handle v) const { return G.halfedge_below(v); } -void assert_equal_marks(Vertex_handle v1, Vertex_handle v2) const +void assert_equal_marks(Vertex_handle v1, Vertex_handle v2) const { CGAL_USE(v1); CGAL_USE(v2); CGAL_NEF_TRACEV(G.mark(v1,0));CGAL_NEF_TRACEV(G.mark(v1,1)); CGAL_NEF_TRACEV(G.mark(v2,0));CGAL_NEF_TRACEV(G.mark(v2,1)); CGAL_assertion(G.mark(v1,0)==G.mark(v2,0)&& - G.mark(v1,1)==G.mark(v2,1)); } -void discard_info(Vertex_handle v) const + G.mark(v1,1)==G.mark(v2,1)); } +void discard_info(Vertex_handle v) const { G.discard_info(v); } void assert_equal_marks(Halfedge_handle e1, Halfedge_handle e2) const -{ +{ CGAL_USE(e1); CGAL_USE(e2); - CGAL_assertion(G.mark(e1,0)==G.mark(e2,0) && - G.mark(e1,1)==G.mark(e2,1)); + CGAL_assertion(G.mark(e1,0)==G.mark(e2,0) && + G.mark(e1,1)==G.mark(e2,1)); } -void discard_info(Halfedge_handle e) const +void discard_info(Halfedge_handle e) const { G.discard_info(e); } void debug() const { @@ -330,7 +330,7 @@ void debug() const { }; // SMO_from_sm template -class SMO_decorator { +class SMO_decorator { public: typedef SM_decorator Graph; typedef typename SM_decorator::SVertex_handle SVertex_handle; @@ -430,7 +430,7 @@ public: typedef CGAL::SM_const_decorator SM_const_decorator; typedef CGAL::SM_point_locator SM_point_locator; - // typedef typename SM_const_decorator::Constructor_parameter + // typedef typename SM_const_decorator::Constructor_parameter // Constructor_const_parameter; typedef typename SM_const_decorator::SVertex_const_handle SVertex_const_handle; typedef typename SM_const_decorator::SHalfedge_const_handle SHalfedge_const_handle; @@ -450,11 +450,11 @@ public: typedef typename Base::SFace_iterator SFace_iterator; typedef typename Base::Object_handle Object_handle; - typedef typename Base::SHalfedge_around_svertex_circulator + typedef typename Base::SHalfedge_around_svertex_circulator SHalfedge_around_svertex_circulator; - typedef typename Base::SHalfedge_around_sface_circulator + typedef typename Base::SHalfedge_around_sface_circulator SHalfedge_around_sface_circulator; - typedef typename Base::SFace_cycle_iterator + typedef typename Base::SFace_cycle_iterator SFace_cycle_iterator; typedef std::pair SHalfedge_pair; @@ -515,15 +515,15 @@ public: Object_handle _o; int _from; Seg_info() : _o(), _from(-1) {} - Seg_info(SVertex_const_handle v, int i) + Seg_info(SVertex_const_handle v, int i) { _o=make_object(v); _from=i; } - Seg_info(SHalfedge_const_handle e, int i) + Seg_info(SHalfedge_const_handle e, int i) { _o=make_object(e); _from=i; } - Seg_info(SHalfloop_const_handle l, int i) + Seg_info(SHalfloop_const_handle l, int i) { _o=make_object(l); _from=i; } - Seg_info(const Seg_info& si) + Seg_info(const Seg_info& si) { _o=si._o; _from=si._from; } - Seg_info& operator=(const Seg_info& si) + Seg_info& operator=(const Seg_info& si) { _o=si._o; _from=si._from; return *this; } LEDA_MEMORY(Seg_info) }; // Seg_info @@ -540,15 +540,20 @@ public: Mark m[2]; Object_handle o_supp[2]; SHalfedge_handle e_below; + vertex_info() - { o_supp[0]=o_supp[1]=Object_handle(); } + { + m[0]=m[1]=Mark(); + o_supp[0]=o_supp[1]=Object_handle(); + } + LEDA_MEMORY(vertex_info) }; // vertex_info void assoc_info(SVertex_handle v) const - { + { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::create(info(v)); + geninfo::create(info(v)); #else info(v)=vertex_info(); #endif @@ -557,7 +562,7 @@ public: void discard_info(SVertex_handle v) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::clear(info(v)); + geninfo::clear(info(v)); #else info(v)=boost::any(); #endif @@ -566,10 +571,10 @@ public: vertex_info& ginfo(SVertex_handle v) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - return geninfo::access(info(v)); + return geninfo::access(info(v)); #else - return - *boost::any_cast(&info(v)); + return + *boost::any_cast(&info(v)); #endif } @@ -590,8 +595,8 @@ public: Object_handle o_supp[2]; bool forw; edge_info() - { m[0]=m[1]=mf[0]=mf[1]=Mark(); - o_supp[0]=o_supp[1]=Object_handle(); + { m[0]=m[1]=mf[0]=mf[1]=Mark(); + o_supp[0]=o_supp[1]=Object_handle(); forw=false; } LEDA_MEMORY(edge_info) }; @@ -608,9 +613,9 @@ public: } void discard_info(SHalfedge_handle e) const - { + { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::clear(info(e)); + geninfo::clear(info(e)); geninfo::clear(info(e->twin())); #else info(e)=boost::any(); @@ -619,11 +624,11 @@ public: } edge_info& ginfo(SHalfedge_handle e) const - { + { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - return geninfo::access(info(e)); + return geninfo::access(info(e)); #else - return + return *boost::any_cast(&info(e)); #endif } @@ -632,8 +637,8 @@ public: { return ginfo(e).m[i]; } Object_handle& supp_object(SHalfedge_handle e, int i) const - // uedge information we store in the smaller one - { if (&*e < &*(e->twin())) return ginfo(e).o_supp[i]; + // uedge information we store in the smaller one + { if (&*e < &*(e->twin())) return ginfo(e).o_supp[i]; else return ginfo(e->twin()).o_supp[i]; } Mark& incident_mark(SHalfedge_handle e, int i) const @@ -655,7 +660,7 @@ public: void assoc_info(SFace_handle f) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::create(info(f)); + geninfo::create(info(f)); #else info(f)=face_info(); #endif @@ -664,7 +669,7 @@ public: void discard_info(SFace_handle f) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - geninfo::clear(info(f)); + geninfo::clear(info(f)); #else info(f)=boost::any(); #endif @@ -673,7 +678,7 @@ public: face_info& ginfo(SFace_handle f) const { #ifdef CGAL_I_DO_WANT_TO_USE_GENINFO - return geninfo::access(info(f)); + return geninfo::access(info(f)); #else return *boost::any_cast(&info(f)); @@ -686,7 +691,7 @@ public: // --------------------------------------------------------------- template - SFace_handle determine_face(SHalfedge_handle e, + SFace_handle determine_face(SHalfedge_handle e, const std::vector& MinimalSHalfedge, const CGAL::Unique_hash_map& SFaceCycle, const Below_accessor& D) @@ -697,7 +702,7 @@ public: if(e_below == SHalfedge_handle()) return SFace_handle(); SFace_handle f = e_below->incident_sface(); - if ( f != SFace_handle() ) return f; // has already a face + if ( f != SFace_handle() ) return f; // has already a face // e_below also has no face f = determine_face(e_below, MinimalSHalfedge, SFaceCycle,D); if(f != SFace_handle()) @@ -705,34 +710,34 @@ public: return f; } - Sphere_segment segment(SM_const_decorator , + Sphere_segment segment(SM_const_decorator , SHalfedge_const_handle e) const { return K.construct_segment(e->source()->point(), - e->target()->point(), - e->circle()); } + e->target()->point(), + e->circle()); } - Sphere_segment trivial_segment(SM_const_decorator , + Sphere_segment trivial_segment(SM_const_decorator , SVertex_const_handle v) const - { Sphere_point p = v->point(); + { Sphere_point p = v->point(); return K.construct_segment(p,p); } - Seg_pair two_segments(SM_const_decorator , + Seg_pair two_segments(SM_const_decorator , SHalfedge_const_handle e) const // we know that e->source()==e->target() { return e->circle().split_at(e->source()->point()); } - Seg_pair two_segments(SM_const_decorator , + Seg_pair two_segments(SM_const_decorator , SHalfloop_const_handle l) const { return l->circle().split_at_xy_plane(); } // --------------------------------------------------------------- - // INTERFACE INTERFACE INTERFACE INTERFACE INTERFACE INTERFACE + // INTERFACE INTERFACE INTERFACE INTERFACE INTERFACE INTERFACE // --------------------------------------------------------------- /*{\Mcreation 6}*/ - SM_overlayer(Map* M, + SM_overlayer(Map* M, const Sphere_kernel& G = Sphere_kernel()) : Base(M), K(G) {} /*{\Mcreate |\Mvar| is a decorator object manipulating the map of |v|.}*/ @@ -741,7 +746,7 @@ public: template void create_from_segments( - Forward_iterator start, Forward_iterator end); + Forward_iterator start, Forward_iterator end); /*{\Mop produces the sphere map which is the overlay of the segments from the iterator range |[start,end)|. \precond |Forward_iterator| has value type |Sphere_segment|.}*/ @@ -756,13 +761,13 @@ public: /*{\Mop produces the sphere map which consists of one loop and the two halfspheres incident to it.}*/ - void subdivide(const Map* M0, const Map* M1, - bool with_trivial_segments = false); - + void subdivide(const Map* M0, const Map* M1, + bool with_trivial_segments = false); + template - void subdivide(const Map* M0, const Map* M1, - Association& A, - bool with_trivial_segments = false); + void subdivide(const Map* M0, const Map* M1, + Association& A, + bool with_trivial_segments = false); /*{\Mop constructs the overlay of the sphere maps |M0| and |M1| in |M|, where all objects (vertices, halfedges, faces) of |M| are \emph{enriched} by the marks of the supporting objects of the two @@ -771,7 +776,7 @@ public: type |SM_decorator| on |M0|,|M1|. Then |\Mvar.mark(v,0) = D0.v0->mark()| and |\Mvar.mark(v,1) = D1.f1->mark()|.}*/ - template + template void select(const Selection& SP) const; /*{\Mop sets the marks of all objects according to the selection predicate |SP|. |Selection| has to be a function object type with a @@ -798,7 +803,7 @@ public: void subdivide_segments(Iterator start, Iterator end) const; template void partition_to_halfsphere(Iterator start, Iterator end, - Seg_list& L, CGAL::Unique_hash_map& M, + Seg_list& L, CGAL::Unique_hash_map& M, Sphere_circle xycircle, Sphere_circle yzcircle, bool include_equator) const; template @@ -810,9 +815,9 @@ public: template void create_face_objects(SHalfedge_iterator e_start, SHalfedge_iterator e_end, - SVertex_iterator v_start, SVertex_iterator v_end, - const Below_accessor& D, - const Halfsphere_geometry& SG); + SVertex_iterator v_start, SVertex_iterator v_end, + const Below_accessor& D, + const Halfsphere_geometry& SG); template void complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end, @@ -841,25 +846,25 @@ create_from_segments(Forward_iterator start, Forward_iterator end) Seg_iterator it; CGAL_forall_iterators(it,L) From_input[it]=true; Seg_list L_pos,L_neg; - partition_to_halfsphere(L.begin(), L.end(), L_pos, From_input, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); - partition_to_halfsphere(L.begin(), L.end(), L_neg, From_input, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_pos, From_input, + Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From_input, + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); typedef SMO_from_segs SM_output; typedef typename Sphere_kernel::Positive_halfsphere_geometry PH_geometry; - typedef CGAL::Segment_overlay_traits< + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, PH_geometry> PHS_traits; typedef CGAL::generic_sweep Positive_halfsphere_sweep; typedef typename Sphere_kernel::Negative_halfsphere_geometry NH_geometry; - typedef CGAL::Segment_overlay_traits< + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, NH_geometry> NHS_traits; typedef CGAL::generic_sweep Negative_halfsphere_sweep; SVertex_iterator v; SHalfedge_iterator e; - SM_output O(*this,From_input); + SM_output O(*this,From_input); typedef typename PHS_traits::INPUT Input_range; PH_geometry ph_g; @@ -915,24 +920,24 @@ create_from_circles(Forward_iterator start, Forward_iterator end) CGAL_forall_iterators(it,L) From_input[it]=true; Seg_list L_pos,L_neg; partition_to_halfsphere(L.begin(), L.end(), L_pos, From_input, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); + Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); partition_to_halfsphere(L.begin(), L.end(), L_neg, From_input, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); typedef SMO_from_segs SM_output; typedef typename Sphere_kernel::Positive_halfsphere_geometry PH_geometry; - typedef CGAL::Segment_overlay_traits< + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, PH_geometry> PHS_traits; typedef CGAL::generic_sweep Positive_halfsphere_sweep; typedef typename Sphere_kernel::Negative_halfsphere_geometry NH_geometry; - typedef CGAL::Segment_overlay_traits< + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, NH_geometry> NHS_traits; typedef CGAL::generic_sweep Negative_halfsphere_sweep; SVertex_iterator v; SHalfedge_iterator e; - SM_output O(*this,From_input); + SM_output O(*this,From_input); typedef typename PHS_traits::INPUT Input_range; PH_geometry ph_g; @@ -978,7 +983,7 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { int chsp = 0; CGAL_NEF_TRACEN("chsp " << chsp); - + typename Seg_list::const_iterator it; CGAL_forall_iterators(it,L) { CGAL_NEF_TRACEN("source " << it->source()); @@ -1023,11 +1028,11 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { CGAL_NEF_TRACEN("not short"); CGAL_NEF_TRACEN("circle " << it->sphere_circle()); if(it->is_long()) { - if((chsp&60)!=60 && + if((chsp&60)!=60 && it->sphere_circle().orthogonal_vector().x()!=0) chsp|=60; - if((chsp&51)!=51 && + if((chsp&51)!=51 && it->sphere_circle().orthogonal_vector().y()!=0) chsp|=51; - if((chsp&15)!=15 && + if((chsp&15)!=15 && it->sphere_circle().orthogonal_vector().z()!=0) chsp|=15; } else { @@ -1036,15 +1041,15 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { if(it->source().hy()==0) ++n; if(it->source().hz()==0) ++n; CGAL_assertion(n<3); - + CGAL_NEF_TRACEN("n " << n); CGAL_NEF_TRACEN("number of coordinats =0:" << n); if(n==0) { - if((chsp&60)!=60 && + if((chsp&60)!=60 && it->sphere_circle().orthogonal_vector().x()!=0) chsp|=60; - if((chsp&51)!=51 && + if((chsp&51)!=51 && it->sphere_circle().orthogonal_vector().y()!=0) chsp|=51; - if((chsp&15)!=15 && + if((chsp&15)!=15 && it->sphere_circle().orthogonal_vector().z()!=0) chsp|=15; } else if(n==1) { if((chsp&48)!=48 && it->source().z()==0) { @@ -1077,15 +1082,15 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { if((chsp&48)!=48) if(i.z() > 0) chsp|=16; else if(i.z() < 0) chsp|=32; - } else if((chsp&51)!=51 && it->source().y()!=0) { + } else if((chsp&51)!=51 && it->source().y()!=0) { Sphere_point i = intersection(it->sphere_circle(), Sphere_circle(0,1,0)); CGAL_NEF_TRACEN("intersection " << i); if(!it->has_on_after_intersection(i)) i=i.antipode(); if((chsp&3)!=3) if(i.x() > 0) chsp|=1; else if(i.x() < 0) chsp|=2; - if((chsp&48)!=48) - if(i.z() > 0) chsp|=16; + if((chsp&48)!=48) + if(i.z() > 0) chsp|=16; else if(i.z() < 0) chsp|=32; } else if((chsp&15)!=15 && it->source().z()!=0) { Sphere_point i = intersection(it->sphere_circle(), Sphere_circle(0,0,1)); @@ -1094,10 +1099,10 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { if((chsp&3)!=3) if(i.x() > 0) chsp|=1; else if(i.x() < 0) chsp|=2; - if((chsp&12)!=12) + if((chsp&12)!=12) if(i.y() > 0) chsp|=4; else if(i.y() < 0) chsp|=8; - } + } } } } @@ -1111,7 +1116,7 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { compute_halfsphere[2][0] = (chsp&16)==16; compute_halfsphere[2][1] = (chsp&32)==32; - if((chsp&1)==0) { + if((chsp&1)==0) { compute_halfsphere[0][1]=true; return 0; } @@ -1119,7 +1124,7 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { compute_halfsphere[0][0]=true; return 1; } - if((chsp&4)==0) { + if((chsp&4)==0) { compute_halfsphere[1][1]=true; return 2; } @@ -1127,11 +1132,11 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { compute_halfsphere[1][0]=true; return 3; } - if((chsp&16)==0) { - compute_halfsphere[2][1]=true; + if((chsp&16)==0) { + compute_halfsphere[2][1]=true; return 4; } - if((chsp&32)==0) { + if((chsp&32)==0) { compute_halfsphere[2][0]=true; return 5; } @@ -1144,7 +1149,7 @@ int SM_overlayer:: check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { for(int i=0; i<6; i++) - compute_halfsphere[i/2][i%2] = false; + compute_halfsphere[i/2][i%2] = false; CGAL_NEF_TRACEN("compute_halfsphere (at begin)"); for(int i=0; i<6; ++i) @@ -1154,22 +1159,22 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { CGAL_forall_iterators(it,L) { if(!compute_halfsphere[0][0]) if(it->source().hx()>0 || it->target().hx()>0) - compute_halfsphere[0][0] = true; + compute_halfsphere[0][0] = true; if(!compute_halfsphere[0][1]) if(it->source().hx()<0 || it->target().hx()<0) - compute_halfsphere[0][1] = true; + compute_halfsphere[0][1] = true; if(!compute_halfsphere[1][0]) if(it->source().hy()>0 || it->target().hy()>0) - compute_halfsphere[1][0] = true; + compute_halfsphere[1][0] = true; if(!compute_halfsphere[1][1]) if(it->source().hy()<0 || it->target().hy()<0) - compute_halfsphere[1][1] = true; + compute_halfsphere[1][1] = true; if(!compute_halfsphere[2][0]) if(it->source().hz()>0 || it->target().hz()>0) - compute_halfsphere[2][0] = true; + compute_halfsphere[2][0] = true; if(!compute_halfsphere[2][1]) if(it->source().hz()<0 || it->target().hz()<0) - compute_halfsphere[2][1] = true; + compute_halfsphere[2][1] = true; } CGAL_NEF_TRACEN("compute_halfsphere (after vertices)"); @@ -1179,24 +1184,24 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { if(!compute_halfsphere[2][0]) { CGAL_forall_iterators(it,L) { - if((it->source().hz()==0 && it->target().hz()==0) - || it->is_long()) { - compute_halfsphere[2][0] = true; - break; + if((it->source().hz()==0 && it->target().hz()==0) + || it->is_long()) { + compute_halfsphere[2][0] = true; + break; } } } - + if(!compute_halfsphere[2][0]) { compute_halfsphere[2][1] = true; return 4; } - + if(!compute_halfsphere[2][1]) { CGAL_forall_iterators(it,L) { - if(it->is_long() || (it->source().hz()==0 && it->target().hz()==0)) { - compute_halfsphere[2][1] = true; - break; + if(it->is_long() || (it->source().hz()==0 && it->target().hz()==0)) { + compute_halfsphere[2][1] = true; + break; } } } @@ -1206,9 +1211,9 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { if(!compute_halfsphere[0][0]) { CGAL_forall_iterators(it,L) { - if((it->source().hx()==0 && it->target().hx()==0) || it->is_long()) { - compute_halfsphere[0][0] = true; - break; + if((it->source().hx()==0 && it->target().hx()==0) || it->is_long()) { + compute_halfsphere[0][0] = true; + break; } } } @@ -1217,39 +1222,39 @@ check_sphere(const Seg_list& L, bool compute_halfsphere[3][2]) const { compute_halfsphere[0][1] = true; return 0; } - + if(!compute_halfsphere[0][1]) { CGAL_forall_iterators(it,L) { - if((it->source().hx()==0 && it->target().hx()==0) || it->is_long()) { - compute_halfsphere[0][1] = true; - break; + if((it->source().hx()==0 && it->target().hx()==0) || it->is_long()) { + compute_halfsphere[0][1] = true; + break; } } } if(!compute_halfsphere[0][1]) return 1; - + if(!compute_halfsphere[1][0]) { CGAL_forall_iterators(it,L) { - if((it->source().hy()==0 && it->target().hy()==0) || it->is_long()) { - compute_halfsphere[1][0] = true; - break; + if((it->source().hy()==0 && it->target().hy()==0) || it->is_long()) { + compute_halfsphere[1][0] = true; + break; } } } - + if(!compute_halfsphere[1][0]) { compute_halfsphere[1][1] = true; return 2; } - + if(!compute_halfsphere[1][1]) { CGAL_forall_iterators(it,L) { - if((it->source().hy()==0 && it->target().hy()==0) || it->is_long()) { - compute_halfsphere[1][1] = true; - break; + if((it->source().hy()==0 && it->target().hy()==0) || it->is_long()) { + compute_halfsphere[1][1] = true; + break; } } } @@ -1274,9 +1279,9 @@ create(const Sphere_circle& c) template void SM_overlayer:: -subdivide(const Map* M0, const Map* M1, - bool with_trivial_segments) { - PI[0] = SM_const_decorator(M0); +subdivide(const Map* M0, const Map* M1, + bool with_trivial_segments) { + PI[0] = SM_const_decorator(M0); PI[1] = SM_const_decorator(M1); bool compute_halfsphere[3][2]; int cs=0; @@ -1295,21 +1300,21 @@ subdivide(const Map* M0, const Map* M1, SHalfedge_const_iterator e; CGAL_forall_sedges(e,PI[i]) { if ( e->source() == e->target() ) { - if(with_trivial_segments) { - CGAL_NEF_TRACEN("trivial segment " << e->source()->point()); + if(with_trivial_segments) { + CGAL_NEF_TRACEN("trivial segment " << e->source()->point()); v = e->source(); L.push_back(trivial_segment(PI[i],v)); From[--L.end()] = Seg_info(v,i); } else { - CGAL_NEF_TRACEN("once around " << e->source()->point()); + CGAL_NEF_TRACEN("once around " << e->source()->point()); Seg_pair p = two_segments(PI[i],e); L.push_back(p.first); L.push_back(p.second); From[--L.end()] = From[--(--L.end())] = Seg_info(e,i); } } else { - CGAL_NEF_TRACEN("normal segment " << e->source()->point() - << "->" << e->twin()->source()->point()); + CGAL_NEF_TRACEN("normal segment " << e->source()->point() + << "->" << e->twin()->source()->point()); L.push_back(segment(PI[i],e)); From[--L.end()] = Seg_info(e,i); } @@ -1318,9 +1323,9 @@ subdivide(const Map* M0, const Map* M1, CGAL_NEF_TRACEN("loop "); SHalfloop_const_handle shl = PI[i].shalfloop(); Seg_pair p = two_segments(PI[i],shl); - L.push_back(p.first); + L.push_back(p.first); L.push_back(p.second.opposite()); - From[--L.end()] = From[--(--L.end())] = + From[--L.end()] = From[--(--L.end())] = Seg_info(shl,i); } } @@ -1343,41 +1348,41 @@ subdivide(const Map* M0, const Map* M1, Seg_list L_pos,L_neg; switch(cs) { - case 1: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(1,0,0), Sphere_circle(0,0,-1), - compute_halfsphere[0][1]); + case 1: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(1,0,0), Sphere_circle(0,0,-1), + compute_halfsphere[0][1]); break; case 0: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(-1,0,0), Sphere_circle(0,0,-1), - compute_halfsphere[0][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(-1,0,0), Sphere_circle(0,0,-1), + compute_halfsphere[0][0]); break; - case 3: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,1,0), Sphere_circle(1,0,0), - compute_halfsphere[1][1]); + case 3: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,1,0), Sphere_circle(1,0,0), + compute_halfsphere[1][1]); break; case 2: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,-1,0), Sphere_circle(1,0,0), - compute_halfsphere[1][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,-1,0), Sphere_circle(1,0,0), + compute_halfsphere[1][0]); break; - case 5: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), - compute_halfsphere[2][1]); + case 5: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,0,1), Sphere_circle(1,0,0), + compute_halfsphere[2][1]); break; case 4: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), - compute_halfsphere[2][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), + compute_halfsphere[2][0]); break; case -1: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); break; default: CGAL_error_msg( "wrong value"); } @@ -1387,16 +1392,16 @@ subdivide(const Map* M0, const Map* M1, #ifdef CGAL_NEF3_TIMER_SPHERE_SWEEPS timer_sphere_sweeps.start(); #endif - + typedef SMO_from_sm SM_output; typedef typename Sphere_kernel::Positive_halfsphere_geometry PH_geometry; typedef typename Sphere_kernel::Negative_halfsphere_geometry NH_geometry; - - typedef CGAL::Segment_overlay_traits< + + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, PH_geometry> PHS_traits; typedef CGAL::generic_sweep Positive_halfsphere_sweep; - - typedef CGAL::Segment_overlay_traits< + + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, NH_geometry> NHS_traits; typedef CGAL::generic_sweep Negative_halfsphere_sweep; @@ -1404,12 +1409,12 @@ subdivide(const Map* M0, const Map* M1, SVertex_handle v; SHalfedge_handle e; - SM_output O(*this,PI,From); + SM_output O(*this,PI,From); if(compute_halfsphere[cs][0]) { PH_geometry phg(cs); Positive_halfsphere_sweep SP( - Input_range(L_pos.begin(),L_pos.end()),O,phg); + Input_range(L_pos.begin(),L_pos.end()),O,phg); SP.sweep(); v=--this->svertices_end(); e=--this->shalfedges_end(); #ifdef CGAL_NEF3_TIMER_SPHERE_SWEEPS @@ -1433,11 +1438,11 @@ subdivide(const Map* M0, const Map* M1, #endif if(compute_halfsphere[cs][0]) { - ++v; + ++v; ++e; } else { - v = this->svertices_begin(); + v = this->svertices_begin(); e = this->shalfedges_begin(); } @@ -1446,10 +1451,10 @@ subdivide(const Map* M0, const Map* M1, PH_geometry(cs)); if(compute_halfsphere[cs][1]) create_face_objects(e, this->shalfedges_end(), v, this->svertices_end(), O, - NH_geometry(cs)); + NH_geometry(cs)); CGAL_forall_sedges(e,*this) { - e->circle() = Sphere_circle(e->source()->point(), e->twin()->source()->point()); + e->circle() = Sphere_circle(e->source()->point(), e->twin()->source()->point()); e->twin()->circle() = e->circle().opposite(); CGAL_NEF_TRACEN(PH(e) << " with circle " << e->circle()); } @@ -1457,7 +1462,7 @@ subdivide(const Map* M0, const Map* M1, std::vector mohs(4); SM_point_locator L0(M0); SM_point_locator L1(M1); - + L0.marks_of_halfspheres(mohs, 0, cs); L1.marks_of_halfspheres(mohs, 2, cs); @@ -1466,9 +1471,9 @@ subdivide(const Map* M0, const Map* M1, CGAL_NEF_TRACEN("mohs[2]=" << mohs[2]); CGAL_NEF_TRACEN("mohs[3]=" << mohs[3]); - CGAL_NEF_TRACEN("compute_halfsphrere\n cs = " << cs << - "\n [cs][0] = " << compute_halfsphere[cs][0] << - "\n [cs][1] = " << compute_halfsphere[cs][1]); + CGAL_NEF_TRACEN("compute_halfsphrere\n cs = " << cs << + "\n [cs][0] = " << compute_halfsphere[cs][0] << + "\n [cs][1] = " << compute_halfsphere[cs][1]); /* SVertex_iterator svii; CGAL_forall_svertices(svii, *this) { @@ -1489,11 +1494,11 @@ subdivide(const Map* M0, const Map* M1, } */ if(compute_halfsphere[cs][0]) - complete_face_support(this->svertices_begin(), v, O, mohs, 0, - compute_halfsphere[cs][1]); + complete_face_support(this->svertices_begin(), v, O, mohs, 0, + compute_halfsphere[cs][1]); if(compute_halfsphere[cs][1]) complete_face_support(v, this->svertices_end(), O, mohs, 1, - compute_halfsphere[cs][0]); + compute_halfsphere[cs][0]); complete_sface_marks(); @@ -1517,9 +1522,9 @@ subdivide(const Map* M0, const Map* M1, merge_halfsphere_maps(this->svertices_begin(),v,O); else set_outer_face_mark(compute_halfsphere[cs][1], mohs); - + CGAL_assertion_code(this->check_integrity_and_topological_planarity()); - + CGAL_NEF_TRACEN("subdivided"); CGAL_assertion_code(CGAL_forall_svertices(v,*this) CGAL_NEF_TRACEN(PH(v))); } @@ -1527,13 +1532,13 @@ subdivide(const Map* M0, const Map* M1, template template void SM_overlayer:: -subdivide(const Map* M0, const Map* M1, - Association& A, - bool with_trivial_segments) +subdivide(const Map* M0, const Map* M1, + Association& A, + bool with_trivial_segments) { - PI[0] = SM_const_decorator(M0); + PI[0] = SM_const_decorator(M0); PI[1] = SM_const_decorator(M1); - + bool compute_halfsphere[3][2]; int cs=0; @@ -1552,19 +1557,19 @@ subdivide(const Map* M0, const Map* M1, CGAL_forall_sedges(e,PI[i]) { if ( e->source() == e->target() ) { if(with_trivial_segments) { - CGAL_NEF_TRACEN("trivial segment " << e->source()->point()); + CGAL_NEF_TRACEN("trivial segment " << e->source()->point()); v = e->source(); L.push_back(trivial_segment(PI[i],v)); From[--L.end()] = Seg_info(v,i); } else { - CGAL_NEF_TRACEN("once around " << e->source()->point()); + CGAL_NEF_TRACEN("once around " << e->source()->point()); Seg_pair p = two_segments(PI[i],e); L.push_back(p.first); L.push_back(p.second); From[--L.end()] = From[--(--L.end())] = Seg_info(e,i); } } else { - CGAL_NEF_TRACEN("normal segment " << e->source()->point()); + CGAL_NEF_TRACEN("normal segment " << e->source()->point()); L.push_back(segment(PI[i],e)); From[--L.end()] = Seg_info(e,i); } @@ -1574,9 +1579,9 @@ subdivide(const Map* M0, const Map* M1, CGAL_NEF_TRACEN("loop "); SHalfloop_const_handle shl = PI[i].shalfloop(); Seg_pair p = two_segments(PI[i],shl); - L.push_back(p.first); + L.push_back(p.first); L.push_back(p.second.opposite()); - From[--L.end()] = From[--(--L.end())] = + From[--L.end()] = From[--(--L.end())] = Seg_info(shl,i); } } @@ -1600,41 +1605,41 @@ subdivide(const Map* M0, const Map* M1, Seg_list L_pos,L_neg; switch(cs) { - case 1: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(1,0,0), Sphere_circle(0,0,-1), - compute_halfsphere[0][1]); + case 1: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(1,0,0), Sphere_circle(0,0,-1), + compute_halfsphere[0][1]); break; case 0: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(-1,0,0), Sphere_circle(0,0,-1), - compute_halfsphere[0][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(-1,0,0), Sphere_circle(0,0,-1), + compute_halfsphere[0][0]); break; - case 3: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,1,0), Sphere_circle(1,0,0), - compute_halfsphere[1][1]); + case 3: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,1,0), Sphere_circle(1,0,0), + compute_halfsphere[1][1]); break; case 2: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,-1,0), Sphere_circle(1,0,0), - compute_halfsphere[1][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,-1,0), Sphere_circle(1,0,0), + compute_halfsphere[1][0]); break; - case 5: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), - compute_halfsphere[2][1]); + case 5: + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,0,1), Sphere_circle(1,0,0), + compute_halfsphere[2][1]); break; case 4: - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), - compute_halfsphere[2][0]); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), + compute_halfsphere[2][0]); break; case -1: - partition_to_halfsphere(L.begin(), L.end(), L_pos, From, - Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); - partition_to_halfsphere(L.begin(), L.end(), L_neg, From, - Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_pos, From, + Sphere_circle(0,0,1), Sphere_circle(1,0,0), true); + partition_to_halfsphere(L.begin(), L.end(), L_neg, From, + Sphere_circle(0,0,-1), Sphere_circle(1,0,0), true); break; default: CGAL_error_msg( "wrong value"); } @@ -1644,16 +1649,16 @@ subdivide(const Map* M0, const Map* M1, #ifdef CGAL_NEF3_TIMER_SPHERE_SWEEPS timer_sphere_sweeps.start(); #endif - + typedef SMO_from_sm SM_output; typedef typename Sphere_kernel::Positive_halfsphere_geometry PH_geometry; typedef typename Sphere_kernel::Negative_halfsphere_geometry NH_geometry; - - typedef CGAL::Segment_overlay_traits< + + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, PH_geometry> PHS_traits; typedef CGAL::generic_sweep Positive_halfsphere_sweep; - - typedef CGAL::Segment_overlay_traits< + + typedef CGAL::Segment_overlay_traits< Seg_iterator, SM_output, NH_geometry> NHS_traits; typedef CGAL::generic_sweep Negative_halfsphere_sweep; @@ -1661,32 +1666,32 @@ subdivide(const Map* M0, const Map* M1, SVertex_handle v; SHalfedge_handle e; - SM_output O(*this,PI,From); + SM_output O(*this,PI,From); if(compute_halfsphere[cs][0]) { PH_geometry phg(cs); - /* + /* // the following is only needed for indexed items SHalfedge_const_handle se; SHalfloop_const_handle sl; for(Seg_iterator it=L_pos.begin(); it!=L_pos.end();++it) { CGAL_NEF_TRACEN("pos " << *it); if(phg.compare_xy(it->target(),it->source())<0) { - Object_handle o = From[it]._o; - if(CGAL::assign(se, o)) { - if(it->sphere_circle() == se->circle()) - From[it] = Seg_info(se->twin(), From[it]._from); - } else if(CGAL::assign(sl, o)) { - if(it->sphere_circle() == sl->circle()) - From[it] = Seg_info(sl->twin(), From[it]._from); - } + Object_handle o = From[it]._o; + if(CGAL::assign(se, o)) { + if(it->sphere_circle() == se->circle()) + From[it] = Seg_info(se->twin(), From[it]._from); + } else if(CGAL::assign(sl, o)) { + if(it->sphere_circle() == sl->circle()) + From[it] = Seg_info(sl->twin(), From[it]._from); + } } } */ Positive_halfsphere_sweep SP( - Input_range(L_pos.begin(),L_pos.end()),O,phg); + Input_range(L_pos.begin(),L_pos.end()),O,phg); SP.sweep(); v=--this->svertices_end(); e=--this->shalfedges_end(); #ifdef CGAL_NEF3_TIMER_SPHERE_SWEEPS @@ -1703,14 +1708,14 @@ subdivide(const Map* M0, const Map* M1, for(Seg_iterator it=L_neg.begin(); it!=L_neg.end();++it) { CGAL_NEF_TRACEN("neg " << *it); if(nhg.compare_xy(it->target(),it->source())<0) { - Object_handle o = From[it]._o; - if(CGAL::assign(se, o)) { - if(it->sphere_circle() == se->circle()) - From[it] = Seg_info(se->twin(), From[it]._from); - } else if(CGAL::assign(sl, o)) { - if(it->sphere_circle() == sl->circle()) - From[it] = Seg_info(sl->twin(), From[it]._from); - } + Object_handle o = From[it]._o; + if(CGAL::assign(se, o)) { + if(it->sphere_circle() == se->circle()) + From[it] = Seg_info(se->twin(), From[it]._from); + } else if(CGAL::assign(sl, o)) { + if(it->sphere_circle() == sl->circle()) + From[it] = Seg_info(sl->twin(), From[it]._from); + } } } */ @@ -1729,11 +1734,11 @@ subdivide(const Map* M0, const Map* M1, #endif if(compute_halfsphere[cs][0]) { - ++v; + ++v; ++e; } else { - v = this->svertices_begin(); + v = this->svertices_begin(); e = this->shalfedges_begin(); } @@ -1742,10 +1747,10 @@ subdivide(const Map* M0, const Map* M1, PH_geometry(cs)); if(compute_halfsphere[cs][1]) create_face_objects(e, this->shalfedges_end(), v, this->svertices_end(), O, - NH_geometry(cs)); + NH_geometry(cs)); CGAL_forall_sedges(e,*this) { - e->circle() = Sphere_circle(e->source()->point(), e->twin()->source()->point()); + e->circle() = Sphere_circle(e->source()->point(), e->twin()->source()->point()); e->twin()->circle() = e->circle().opposite(); CGAL_NEF_TRACEN(PH(e) << " with circle " << e->circle()); } @@ -1753,7 +1758,7 @@ subdivide(const Map* M0, const Map* M1, std::vector mohs(4); SM_point_locator L0(M0); SM_point_locator L1(M1); - + L0.marks_of_halfspheres(mohs, 0, cs); L1.marks_of_halfspheres(mohs, 2, cs); @@ -1762,9 +1767,9 @@ subdivide(const Map* M0, const Map* M1, CGAL_NEF_TRACEN("mohs[2]=" << mohs[2]); CGAL_NEF_TRACEN("mohs[3]=" << mohs[3]); - CGAL_NEF_TRACEN("compute_halfsphrere\n cs = " << cs << - "\n [cs][0] = " << compute_halfsphere[cs][0] << - "\n [cs][1] = " << compute_halfsphere[cs][1]); + CGAL_NEF_TRACEN("compute_halfsphrere\n cs = " << cs << + "\n [cs][0] = " << compute_halfsphere[cs][0] << + "\n [cs][1] = " << compute_halfsphere[cs][1]); /* SVertex_iterator svii; CGAL_forall_svertices(svii, *this) { @@ -1785,11 +1790,11 @@ subdivide(const Map* M0, const Map* M1, } */ if(compute_halfsphere[cs][0]) - complete_face_support(this->svertices_begin(), v, O, mohs, 0, - compute_halfsphere[cs][1]); + complete_face_support(this->svertices_begin(), v, O, mohs, 0, + compute_halfsphere[cs][1]); if(compute_halfsphere[cs][1]) complete_face_support(v, this->svertices_end(), O, mohs, 1, - compute_halfsphere[cs][0]); + compute_halfsphere[cs][0]); complete_sface_marks(); @@ -1817,9 +1822,9 @@ subdivide(const Map* M0, const Map* M1, merge_halfsphere_maps(this->svertices_begin(),v,O); else set_outer_face_mark(compute_halfsphere[cs][1], mohs); - + CGAL_assertion_code(this->check_integrity_and_topological_planarity()); - + CGAL_NEF_TRACEN("subdivided"); CGAL_assertion_code(CGAL_forall_svertices(v,*this) CGAL_NEF_TRACEN(PH(v))); } @@ -1840,74 +1845,74 @@ transfer_data(Association& A) { Object_handle o0 = supp_object(sv,0), o1 = supp_object(sv,1); if(o0.empty()) { if(CGAL::assign(sv1, o1)) - A.handle_support(sv, sv1); + A.handle_support(sv, sv1); else - continue; + continue; } else if(CGAL::assign(se0, o0)) { - if(o1.empty()) - continue; + if(o1.empty()) + continue; else if(assign(se1, o1)) - A.handle_support(sv, se0, se1); + A.handle_support(sv, se0, se1); else if(CGAL::assign(sv1, o1)) - A.handle_support(sv, se0, sv1); + A.handle_support(sv, se0, sv1); else if(CGAL::assign(sl1, o1)) - A.handle_support(sv, se0, sl1); + A.handle_support(sv, se0, sl1); else - CGAL_error_msg( "wrong handle"); + CGAL_error_msg( "wrong handle"); } else if(CGAL::assign(sv0, o0)) { if(o1.empty()) - A.handle_support(sv, sv0); + A.handle_support(sv, sv0); else if(CGAL::assign(se1, o1)) - A.handle_support(sv, sv0, se1); + A.handle_support(sv, sv0, se1); else if(CGAL::assign(sv1, o1)) - A.handle_support(sv, sv0, sv1); + A.handle_support(sv, sv0, sv1); else if(CGAL::assign(sl1, o1)) - A.handle_support(sv, sv0, sl1); + A.handle_support(sv, sv0, sl1); else - CGAL_error_msg( "wrong handle"); + CGAL_error_msg( "wrong handle"); } else if(CGAL::assign(sl0, o0)) { if(o1.empty()) - continue; + continue; else if(CGAL::assign(sv1, o1)) - A.handle_support(sv, sl0, sv1); + A.handle_support(sv, sl0, sv1); else if(CGAL::assign(se1, o1)) - A.handle_support(sv, sl0, se1); + A.handle_support(sv, sl0, se1); else if(CGAL::assign(sl1, o1)) - A.handle_support(sv, sl0, sl1); - } else + A.handle_support(sv, sl0, sl1); + } else CGAL_error_msg( "wrong handle"); } CGAL_forall_sedges(se, *this) { CGAL_assertion(is_forward(se)); - Object_handle o0 = supp_object(se,0), o1 = supp_object(se,1); + Object_handle o0 = supp_object(se,0), o1 = supp_object(se,1); if(o0.empty()) { if(assign(se1, o1)) - A.handle_support(se, se1); + A.handle_support(se, se1); else if(assign(sl1, o1)) - A.handle_support(se, sl1); + A.handle_support(se, sl1); else - continue; // CGAL_error_msg( "wrong handle"); + continue; // CGAL_error_msg( "wrong handle"); } else if(assign(se0, o0)) { if(o1.empty()) - A.handle_support(se, se0); + A.handle_support(se, se0); else if(assign(se1, o1)) - A.handle_support(se, se0, se1); + A.handle_support(se, se0, se1); else if(assign(sl1, o1)) - A.handle_support(se, se0, sl1); + A.handle_support(se, se0, sl1); else - CGAL_error_msg( "wrong handle"); + CGAL_error_msg( "wrong handle"); } else if(assign(sl0, o0)) { if(o1.empty()) - A.handle_support(se, sl0); + A.handle_support(se, sl0); else if(assign(se1, o1)) - A.handle_support(se, sl0, se1); + A.handle_support(se, sl0, se1); else if(assign(sl1, o1)) - A.handle_support(se, sl0, sl1); + A.handle_support(se, sl0, sl1); else - CGAL_error_msg( "wrong handle"); + CGAL_error_msg( "wrong handle"); } else - CGAL_error_msg( "wrong handle"); + CGAL_error_msg( "wrong handle"); } } @@ -1923,9 +1928,9 @@ set_outer_face_mark(int offset, const std::vector& mohs) { SHalfedge_iterator e; CGAL_forall_shalfedges(e, *this) { if ( e->incident_sface() != SFace_handle() ) continue; - link_as_face_cycle(e,sf); + link_as_face_cycle(e,sf); } - + SVertex_handle v; CGAL_forall_svertices(v, *this) { if(!is_isolated(v) || v->incident_sface() != SFace_handle()) continue; @@ -1936,10 +1941,10 @@ set_outer_face_mark(int offset, const std::vector& mohs) { template template void SM_overlayer:: -partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, - CGAL::Unique_hash_map& M, - Sphere_circle xycircle, Sphere_circle yzcircle, - bool include_equator) const +partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, + CGAL::Unique_hash_map& M, + Sphere_circle xycircle, Sphere_circle yzcircle, + bool include_equator) const { CGAL_NEF_TRACEN("partition_to_halfsphere "); // CGAL_assertion(pos!=0); Sphere_segment s1,s2; @@ -1948,13 +1953,13 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, while ( start != beyond) { int i = start->intersection(xycircle,s1,s2); CGAL_NEF_TRACEN("segment " << start->source() << " " << start->target()); - if (i>1) { - L.push_back(s2); M[--L.end()] = M[start]; - CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); + if (i>1) { + L.push_back(s2); M[--L.end()] = M[start]; + CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); } - if (i>0) { - L.push_back(s1); M[--L.end()] = M[start]; - CGAL_NEF_TRACEN(">0 " << s1.source() << " " << s1.target()); + if (i>0) { + L.push_back(s1); M[--L.end()] = M[start]; + CGAL_NEF_TRACEN(">0 " << s1.source() << " " << s1.target()); } ++start; } @@ -1971,39 +1976,39 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, // we still have to: // - split segments containing our special poles y^-, y^+ // - split halfcircles - // - add four equator segments + // - add four equator segments // Sphere_circle yzcircle(1,0,0); typename Seg_list::iterator it, itl; - + CGAL_forall_iterators(it,L) { CGAL_NEF_TRACEN(" "<<*it); if ( equal_as_sets(it->sphere_circle(),xycircle) ) { CGAL_NEF_TRACEN(" splitting xy seg "<<*it); bool added=false; int n1 = it->intersection(yzcircle,s1,s2); - if (n1 > 1 && !s2.is_degenerate()) { - M[ L.insert(it,s2) ] = M[it]; - added=true; - CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); + if (n1 > 1 && !s2.is_degenerate()) { + M[ L.insert(it,s2) ] = M[it]; + added=true; + CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); } - if (n1 > 0 && !s1.is_degenerate()) { - M[ L.insert(it,s1) ] = M[it]; - added = true; - CGAL_NEF_TRACEN(">1 " << s1.source() << " " << s1.target()); + if (n1 > 0 && !s1.is_degenerate()) { + M[ L.insert(it,s1) ] = M[it]; + added = true; + CGAL_NEF_TRACEN(">1 " << s1.source() << " " << s1.target()); } int n2 = it->intersection(yzcircle.opposite(),s1,s2); - if (n2 > 1 && !s2.is_degenerate()) { - M[ L.insert(it,s2) ] = M[it]; - added=true; - CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); + if (n2 > 1 && !s2.is_degenerate()) { + M[ L.insert(it,s2) ] = M[it]; + added=true; + CGAL_NEF_TRACEN(">1 " << s2.source() << " " << s2.target()); } - if (n2 > 0 && !s1.is_degenerate()) { - M[ L.insert(it,s1) ] = M[it]; - added=true; - CGAL_NEF_TRACEN(">1 " << s1.source() << " " << s1.target()); + if (n2 > 0 && !s1.is_degenerate()) { + M[ L.insert(it,s1) ] = M[it]; + added=true; + CGAL_NEF_TRACEN(">1 " << s1.source() << " " << s1.target()); } if(added) { - itl = it; --it; M[itl] = T(); L.erase(itl); + itl = it; --it; M[itl] = T(); L.erase(itl); } // at least one item was appended } @@ -2016,7 +2021,7 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, it->split_halfcircle(s1,s2); CGAL_NEF_TRACEN(" into " << s1); CGAL_NEF_TRACEN(" into " << s2); - *it = s2; + *it = s2; M[ L.insert(it,s1) ] = M[it]; } } @@ -2038,7 +2043,7 @@ template void SM_overlayer:: create_face_objects(SHalfedge_iterator e_start, SHalfedge_iterator e_end, SVertex_iterator v_start, SVertex_iterator v_end, - const Below_accessor& D, + const Below_accessor& D, const Halfsphere_geometry& SG) { CGAL_NEF_TRACEN("create_face_objects()"); @@ -2049,51 +2054,51 @@ create_face_objects(SHalfedge_iterator e_start, SHalfedge_iterator e_end, CGAL_NEF_TRACEN("equator cycle "<twin()); - int i=1; + int i=1; for (SHalfedge_iterator e = e_start; e != e_end; ++e) { if ( SFaceCycle[e] >= 0 ) continue; // already assigned SHalfedge_around_sface_circulator hfc(e),hend(hfc); SHalfedge_handle e_min = e; - CGAL_NEF_TRACEN(""); + CGAL_NEF_TRACEN(""); CGAL_NEF_TRACEN(" face cycle numbering "<twin()->source() == e_min->twin()->source()) { - Sphere_point p1 = hfc->source()->point(), - p2 = hfc->twin()->source()->point(), - p3 = hfc->snext()->twin()->source()->point(); - if ( SG.orientation(p1,p2,p3) <= 0 ) - e_min = hfc; - } else if ( SG.compare_xy(hfc->twin()->source()->point(), e_min->twin()->source()->point()) < 0 ) - e_min = hfc; - CGAL_NEF_TRACEN(PH(hfc)); + SFaceCycle[hfc]=i; // assign face cycle number + if (hfc->twin()->source() == e_min->twin()->source()) { + Sphere_point p1 = hfc->source()->point(), + p2 = hfc->twin()->source()->point(), + p3 = hfc->snext()->twin()->source()->point(); + if ( SG.orientation(p1,p2,p3) <= 0 ) + e_min = hfc; + } else if ( SG.compare_xy(hfc->twin()->source()->point(), e_min->twin()->source()->point()) < 0 ) + e_min = hfc; + CGAL_NEF_TRACEN(PH(hfc)); } CGAL_NEF_TRACEN(""); MinimalSHalfedge.push_back(e_min); ++i; } - + for (int j=1; jsource()->point(), - p2 = e->twin()->source()->point(), - p3 = e->snext()->twin()->source()->point(); + Sphere_point p1 = e->source()->point(), + p2 = e->twin()->source()->point(), + p3 = e->snext()->twin()->source()->point(); if ( SG.orientation(p1,p2,p3) > 0 ) { // left_turn => outer face cycle - SFace_handle f = this->new_sface(); - link_as_face_cycle(e,f); - CGAL_NEF_TRACEN(" creating new face object "<<&*f<<" bd "<<&*e); + SFace_handle f = this->new_sface(); + link_as_face_cycle(e,f); + CGAL_NEF_TRACEN(" creating new face object "<<&*f<<" bd "<<&*e); } } - + for (SHalfedge_iterator e = e_start; e != e_end; ++e) { if ( e->incident_sface() != SFace_handle() ) continue; if ( SFaceCycle[e] == 0 ) continue; CGAL_NEF_TRACEN("linking hole "<:: complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end, const Below_accessor& , std::vector& mohs, int offset, bool both) const { CGAL_NEF_TRACEN("complete_face_support"); - for (SVertex_iterator v = v_start; v != v_end; ++v) { + for (SVertex_iterator v = v_start; v != v_end; ++v) { CGAL_NEF_TRACEN("VERTEX = "<point().hz() == 0 && - // ( offset == 0 ? (v->point().hx() >= 0) : (v->point().hx()<=0)) ); + // CGAL_assertion( v->point().hz() == 0 && + // ( offset == 0 ? (v->point().hx() >= 0) : (v->point().hx()<=0)) ); if(!is_isolated(v)) { - if(!both) { - for (int i=0; i<2; ++i) - m_buffer[i] = mohs[offset+2*i]; - CGAL_NEF_TRACEN("no edge below "); - } else { - for (int i=0; i<2; ++i) - m_buffer[i] = incident_mark(first_out_edge(v)->sprev(),i); - } + if(!both) { + for (int i=0; i<2; ++i) + m_buffer[i] = mohs[offset+2*i]; + CGAL_NEF_TRACEN("no edge below "); + } else { + for (int i=0; i<2; ++i) + m_buffer[i] = incident_mark(first_out_edge(v)->sprev(),i); + } } } CGAL_NEF_TRACEN(" faces right-below "<mark(); continue; + if ( CGAL::assign(vs,o) ) { + CGAL_NEF_TRACEN("support by svertex"); + mark(v,i) = vs->mark(); continue; } if ( CGAL::assign(es,supp_object(v,i)) ) { - CGAL_NEF_TRACEN("support by sedge"); - if ( es->source()->point() == v->point() ) - { mark(v,i) = es->source()->mark(); continue; } - if ( es->target()->point() == v->point() ) - { mark(v,i) = es->target()->mark(); continue; } + CGAL_NEF_TRACEN("support by sedge"); + if ( es->source()->point() == v->point() ) + { mark(v,i) = es->source()->mark(); continue; } + if ( es->target()->point() == v->point() ) + { mark(v,i) = es->target()->mark(); continue; } mark(v,i) = es->mark(); continue; } - if ( CGAL::assign(ls,o) ) { - mark(v,i) = ls->mark(); - CGAL_NEF_TRACEN("loop " << ls->circle()); continue; } + if ( CGAL::assign(ls,o) ) { + mark(v,i) = ls->mark(); + CGAL_NEF_TRACEN("loop " << ls->circle()); continue; } CGAL_error_msg("wrong handle"); } CGAL_NEF_TRACEN(" vertex marks "<circle(),e->circle())) - ei = ei->twin(); - CGAL_assertion( ei->circle() == e->circle() ); + SHalfedge_const_handle ei; + if ( CGAL::assign(ei,supp_object(e,i)) ) { + if (!equal_not_opposite(ei->circle(),e->circle())) + ei = ei->twin(); + CGAL_assertion( ei->circle() == e->circle() ); CGAL_NEF_TRACEN(" supporting edge "<twin(),i) = ei->twin()->incident_sface()->mark(); mark(e,i) = mark(e->twin(),i) = ei->mark(); incident_mark(e,i) = m_buffer[i] = - ei->incident_sface()->mark(); + ei->incident_sface()->mark(); } SHalfloop_const_handle li; - if ( CGAL::assign(li,supp_object(e,i)) ) { - if (!equal_not_opposite(li->circle(),e->circle())) - li = li->twin(); - CGAL_assertion( li->circle() == e->circle() ); - CGAL_NEF_TRACEN(" supporting loop "<twin(),i) = - li->twin()->incident_sface()->mark(); - mark(e,i) = mark(e->twin(),i) = li->mark(); - incident_mark(e,i) = m_buffer[i] = - li->incident_sface()->mark(); + if ( CGAL::assign(li,supp_object(e,i)) ) { + if (!equal_not_opposite(li->circle(),e->circle())) + li = li->twin(); + CGAL_assertion( li->circle() == e->circle() ); + CGAL_NEF_TRACEN(" supporting loop "<twin(),i) = + li->twin()->incident_sface()->mark(); + mark(e,i) = mark(e->twin(),i) = li->mark(); + incident_mark(e,i) = m_buffer[i] = + li->incident_sface()->mark(); } } else { CGAL_NEF_TRACEN(" support from face below "<twin(),i) = mark(e,i) = mark(e->twin(),i) = + incident_mark(e->twin(),i) = mark(e,i) = mark(e->twin(),i) = incident_mark(e,i) = m_buffer[i]; } } CGAL_NEF_TRACEN(" face marks "<::complete_sface_marks() const { for (f = this->sfaces_begin(); f != this->sfaces_end(); ++f) { assoc_info(f); SFace_cycle_iterator boundary_object(f->sface_cycles_begin()); - if (!boundary_object.is_shalfedge() ) + if (!boundary_object.is_shalfedge() ) CGAL_error_msg("Outer face cycle should be first."); SHalfedge_handle e(boundary_object); for (int i=0; i<2; ++i) mark(f,i) = incident_mark(e,i); @@ -2233,8 +2238,8 @@ merge_nodes(SHalfedge_handle e1, SHalfedge_handle e2, SHalfedge_handle ep1 = e1->sprev(), en2 = e2->snext(); SHalfedge_around_svertex_circulator eav(out_edges(v2)),ee(eav); CGAL_For_all(eav,ee) { set_source(eav,v1); } - link_as_prev_next_pair(e2,e1); - link_as_prev_next_pair(ep1,en2); + link_as_prev_next_pair(e2,e1); + link_as_prev_next_pair(ep1,en2); D.assert_equal_marks(v1,v2); D.discard_info(v2); delete_vertex_only(v2); @@ -2248,15 +2253,15 @@ merge_halfsphere_maps(SVertex_handle v1, SVertex_handle v2, { CGAL_NEF_TRACEN("merging halfspheres "<point()==v2->point()); std::list L_equator; - SHalfedge_around_sface_circulator + SHalfedge_around_sface_circulator ep(last_out_edge(v1)), en(first_out_edge(v2)->twin()); - do { + do { L_equator.push_back(SHalfedge_pair(ep,en)); - merge_nodes(ep,en,D); ++ep; --en; + merge_nodes(ep,en,D); ++ep; --en; } while ( ep->source() != v1 ); - + typename std::list::iterator it; - CGAL_forall_iterators(it,L_equator) { + CGAL_forall_iterators(it,L_equator) { SHalfedge_handle e1 = it->first, e2 = it->second; SHalfedge_handle e1t = e1->twin(), e2t = e2->twin(); CGAL_NEF_TRACEV(PH(e1));CGAL_NEF_TRACEV(PH(e2)); @@ -2279,11 +2284,11 @@ template template void SM_overlayer:: select(const Selection& SP) const -{ +{ SVertex_iterator v; CGAL_forall_svertices(v,*this) { v->mark() = SP(mark(v,0),mark(v,1)); - discard_info(v); + discard_info(v); } SHalfedge_iterator e; CGAL_forall_sedges(e,*this) { @@ -2303,13 +2308,13 @@ select(const Selection& SP) const template void SM_overlayer::simplify() { - CGAL_NEF_TRACEN("simplifying"); + CGAL_NEF_TRACEN("simplifying"); typedef typename CGAL::Union_find::handle Union_find_handle; CGAL::Unique_hash_map< SFace_handle, Union_find_handle> Pitem(nullptr); CGAL::Unique_hash_map< SVertex_handle, Union_find_handle> Vitem(nullptr); CGAL::Union_find< SFace_handle> UF; - + SFace_iterator f; CGAL_forall_sfaces(f,*this) { Pitem[f] = UF.make_set(f); @@ -2325,32 +2330,32 @@ void SM_overlayer::simplify() } SHalfedge_iterator e, en; - for(e = this->shalfedges_begin(); e != this->shalfedges_end(); e = en) { + for(e = this->shalfedges_begin(); e != this->shalfedges_end(); e = en) { en = e; ++en; if ( en==e->twin() ) ++en; CGAL_NEF_TRACEN("can simplify ? " << PH(e)); - CGAL_NEF_TRACEN(e->mark() << " " << - e->incident_sface()->mark() << " " << - e->twin()->incident_sface()->mark()); - if (( e->mark() == e->incident_sface()->mark() && - e->mark() == e->twin()->incident_sface()->mark())){ + CGAL_NEF_TRACEN(e->mark() << " " << + e->incident_sface()->mark() << " " << + e->twin()->incident_sface()->mark()); + if (( e->mark() == e->incident_sface()->mark() && + e->mark() == e->twin()->incident_sface()->mark())){ CGAL_NEF_TRACEN("deleting "<incident_sface()], - Pitem[e->twin()->incident_sface()]) ) { - - UF.unify_sets( Pitem[e->incident_sface()], - Pitem[e->twin()->incident_sface()] ); - CGAL_NEF_TRACEN("unioning disjoint faces"); + Pitem[e->twin()->incident_sface()]) ) { + + UF.unify_sets( Pitem[e->incident_sface()], + Pitem[e->twin()->incident_sface()] ); + CGAL_NEF_TRACEN("unioning disjoint faces"); } - - CGAL_NEF_TRACEN("is_closed_at_source " << is_closed_at_source(e) << - " " << is_closed_at_source(e->twin())); - + + CGAL_NEF_TRACEN("is_closed_at_source " << is_closed_at_source(e) << + " " << is_closed_at_source(e->twin())); + if ( is_closed_at_source(e) ) - Vitem[e->source()] = Pitem[e->incident_sface()]; - + Vitem[e->source()] = Pitem[e->incident_sface()]; + if ( is_closed_at_source(e->twin())) - Vitem[e->target()] = Pitem[e->incident_sface()]; - + Vitem[e->target()] = Pitem[e->incident_sface()]; + delete_edge_pair(e); } } @@ -2368,22 +2373,22 @@ void SM_overlayer::simplify() for(v = this->svertices_begin(); v != this->svertices_end(); v=vn) { vn=v; ++vn; if ( is_isolated(v) ) { - + if(Vitem[v] != nullptr) { - set_face(v,*(UF.find(Vitem[v]))); - CGAL_NEF_TRACEN("incident face of " << PH(v) << " set to " << &*(v->incident_sface())); + set_face(v,*(UF.find(Vitem[v]))); + CGAL_NEF_TRACEN("incident face of " << PH(v) << " set to " << &*(v->incident_sface())); } else { - set_face(v, *(UF.find(Pitem[v->incident_sface()]))); - CGAL_NEF_TRACEN("isolated svertex " << PH(v) << - " already has incident face " << &*(v->incident_sface())); + set_face(v, *(UF.find(Pitem[v->incident_sface()]))); + CGAL_NEF_TRACEN("isolated svertex " << PH(v) << + " already has incident face " << &*(v->incident_sface())); } if ( v->mark() == v->incident_sface()->mark() ) { CGAL_NEF_TRACEN("removing isolated vertex"<incident_sface()); // isolated, but should stay } else { // v not isolated SHalfedge_handle e2 = first_out_edge(v), e1 = e2->sprev(); @@ -2392,13 +2397,13 @@ void SM_overlayer::simplify() e1->circle() == e2->circle() ) { CGAL_NEF_TRACEN("collinear at "<sfaces_begin(); f != this->sfaces_end(); f=fn) { + for (f = fn = this->sfaces_begin(); f != this->sfaces_end(); f=fn) { ++fn; Union_find_handle pit = Pitem[f]; if ( UF.find(pit) != pit ) { @@ -2415,12 +2420,12 @@ subdivide_segments(Iterator start, Iterator end) const { typedef SMO_decorator SM_output; typedef typename Sphere_kernel::Positive_halfsphere_geometry PH_geometry; -typedef CGAL::Segment_overlay_traits< +typedef CGAL::Segment_overlay_traits< Iterator, SM_output, PH_geometry> PHS_traits; typedef CGAL::generic_sweep Positive_halfsphere_sweep; typedef typename Sphere_kernel::Negative_halfsphere_geometry NH_geometry; -typedef CGAL::Segment_overlay_traits< +typedef CGAL::Segment_overlay_traits< Iterator, SM_output, NH_geometry> NHS_traits; typedef CGAL::generic_sweep Negative_halfsphere_sweep; @@ -2428,13 +2433,13 @@ typedef CGAL::generic_sweep Negative_halfsphere_sweep; partition_xy( start, end, Lp , +1); partition_xy( start, end, Lm , -1); // both lists initialized with four quarter segments - // supporting the xy-equator thereby separating the - // two halfspheres + // supporting the xy-equator thereby separating the + // two halfspheres // all other segments in the range are split into their // connected components with respect to the xy-plane. SVertex_handle v1,v2; - SM_output O(*this); + SM_output O(*this); typedef typename PHS_traits::INPUT Input_range; Positive_halfsphere_sweep SP(Input_range(Lp.begin(),Lp.end()),O); SP.sweep(); 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 3293ff87fc8..38ec5380529 100644 --- a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp +++ b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp @@ -31,7 +31,7 @@ void test_lazy_exact_nt() { CGAL::test_algebraic_structure(NT(-4),NT(6), NT(15)); CGAL::test_algebraic_structure(NT(4),NT(-6),NT(-15)); CGAL::test_algebraic_structure(NT(-4),NT(-6),NT(-15)); - + CGAL::test_real_embeddable(); }{ typedef typename AK::Rational ET; @@ -50,13 +50,13 @@ void test_lazy_exact_nt() { CGAL::test_algebraic_structure(NT(-4),NT(6), NT(15)); CGAL::test_algebraic_structure(NT(4),NT(-6),NT(-15)); CGAL::test_algebraic_structure(NT(-4),NT(-6),NT(-15)); - + CGAL::test_real_embeddable(); CGAL::test_fraction_traits(); CGAL::test_rational_traits(); } - { + { typedef typename AK::Integer ET; typedef CGAL::Algebraic_structure_traits< ET > AST; @@ -73,10 +73,10 @@ void test_lazy_exact_nt() { CGAL::test_algebraic_structure(NT(-4),NT(6), NT(15)); CGAL::test_algebraic_structure(NT(4),NT(-6),NT(-15)); CGAL::test_algebraic_structure(NT(-4),NT(-6),NT(-15)); - + CGAL::test_real_embeddable(); } - + { // see also Coercion_traits_test.C typedef CGAL::Lazy_exact_nt< typename AK::Integer > LI; typedef CGAL::Lazy_exact_nt< typename AK::Rational > LR; @@ -84,24 +84,26 @@ void test_lazy_exact_nt() { CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); CGAL_static_assertion((boost::is_same< typename CT::Type,LR>::value)); - + LI i(4); LR r(4); typename CT::Cast cast; assert( cast ( (i*i+i) / i-i ) == LR(1)); assert( cast ( (i*i+r) / i-i ) == LR(1)); assert( cast ( (i*r+r) / i-i ) == LI(1)); - }{ // see also Coercion_traits_test.C + } + + { // see also Coercion_traits_test.C #ifdef CGAL_USE_LEDA #ifdef CGAL_USE_CORE - typedef CGAL::Lazy_exact_nt T1; - typedef CGAL::Lazy_exact_nt T2; - typedef CGAL::Coercion_traits CT; + CGAL_assertion_code(typedef CGAL::Lazy_exact_nt T1;) + CGAL_assertion_code(typedef CGAL::Lazy_exact_nt T2;) + CGAL_assertion_code(typedef CGAL::Coercion_traits CT;) CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); #endif #endif - } + } } int main() { diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 5ff3d0d77fc..4340a05c0df 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -147,10 +147,8 @@ update_new_point( typedef typename rich_grid_internal::Rich_point Rich_point; CGAL_assertion_code( unsigned int size = static_cast(rich_point_set.size()) ); - CGAL_point_set_processing_precondition(father_index >= 0 && - father_index < size); - CGAL_point_set_processing_precondition(mother_index >= 0 && - mother_index < size); + CGAL_point_set_processing_precondition(father_index < size); + CGAL_point_set_processing_precondition(mother_index < size); // 1, get neighbor information from the two "parent points" Rich_point& new_v = rich_point_set[new_point_index]; diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.cpp b/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.cpp index 1ada57d8a85..a263ddc6bbe 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.cpp +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500) #include #endif @@ -22,7 +22,7 @@ bool lAppToLog = false ; void Polyline_simplification_2_external_trace( std::string m ) { std::ofstream out("polysim_log.txt", ( lAppToLog ? std::ios::app | std::ios::ate : std::ios::trunc | std::ios::ate ) ); - out << std::setprecision(19) << m << std::endl << std::flush ; + out << std::setprecision(19) << m << std::endl << std::flush ; lAppToLog = true ; } @@ -34,8 +34,8 @@ void error_handler ( char const* what, char const* expr, char const* file, int l << "Line: " << line << std::endl; if ( msg != 0) std::cerr << "Explanation:" << msg << std::endl; - - throw std::runtime_error("CGAL Error"); + + throw std::runtime_error("CGAL Error"); } @@ -91,15 +91,15 @@ class MainWindow : public Ui::Polyline_simplification_2 { Q_OBJECT + +private: -private: - - PCT m_pct; + PCT m_pct; QGraphicsScene mScene; CGAL::Qt::PolylineSimplificationGraphicsItem * mGI; CGAL::Qt::GraphicsViewPolylineInput * mPI; - -private: + +private: public: @@ -122,9 +122,9 @@ public Q_SLOTS: void processInput(CGAL::Object o); void on_actionShowTriangulation_toggled(bool checked); - + void on_actionInsertPolyline_toggled(bool checked); - + void on_actionClear_triggered(); void on_actionRecenter_triggered(); @@ -136,7 +136,7 @@ public Q_SLOTS: Mode getSimplificationMode() ; double getThreshold() ; - + Q_SIGNALS: void changed(); }; @@ -147,14 +147,14 @@ MainWindow::MainWindow() { CGAL::set_error_handler (error_handler); CGAL::set_warning_handler(error_handler); - + setupUi(this); setAcceptDrops(true); // Add a GraphicItem for the PS triangulation mGI = new CGAL::Qt::PolylineSimplificationGraphicsItem(&m_pct); - + QObject::connect(this, SIGNAL(changed()), mGI, SLOT(modelChanged())); mGI->setVerticesPen(QPen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); @@ -162,18 +162,18 @@ MainWindow::MainWindow() mGI->setZValue(-1); mGI->setVisibleEdges(false); mGI->setVisibleConstraints(true); - + mScene.addItem(mGI); // Setup input handlers. They get events before the mScene gets them - // and the input they generate is passed to the triangulation with - // the signal/slot mechanism + // and the input they generate is passed to the triangulation with + // the signal/slot mechanism mPI = new CGAL::Qt::GraphicsViewPolylineInput(this, &mScene, 0, true); // inputs polylines which are not closed this->on_actionInsertPolyline_toggled(true); QObject::connect(mPI, SIGNAL(generate(CGAL::Object)), this, SLOT(processInput(CGAL::Object))); + - - // + // // Manual handling of actions // QObject::connect(this->actionQuit, SIGNAL(triggered()), this, SLOT(close())); @@ -183,7 +183,7 @@ MainWindow::MainWindow() // ag->addAction(this->actionInsertPolyline); this->actionShowTriangulation->setChecked(false); - + // // Setup the mScene and the view // @@ -194,7 +194,7 @@ MainWindow::MainWindow() // Turn the vertical axis upside down this->graphicsView->scale(1, -1); - + // The navigation adds zooming and translation functionality to the // QGraphicsView this->addNavigation(this->graphicsView); @@ -207,20 +207,17 @@ MainWindow::MainWindow() this->addRecentFiles(this->menuFile, this->actionQuit); connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString))); - -// QObject::connect(thresholdSlider, SIGNAL(valueChanged(int)), this, SLOT(set_Threshold(int))); - } -void +void MainWindow::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasFormat("text/uri-list")) event->acceptProposedAction(); } -void +void MainWindow::dropEvent(QDropEvent *event) { QString filename = event->mimeData()->urls().at(0).path(); @@ -234,7 +231,7 @@ MainWindow::processInput(CGAL::Object o) std::list points; if(CGAL::assign(points, o)) { - if(points.size() >= 2) + if(points.size() >= 2) { m_pct.insert_constraint(points.begin(), points.end()); #if 0 @@ -246,16 +243,16 @@ MainWindow::processInput(CGAL::Object o) } #endif Q_EMIT( changed()); - } + } } Q_EMIT( changed()); } -/* +/* * Qt Automatic Connections * https://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections - * + * * setupUi(this) generates connections to the slots named * "on__" */ @@ -306,12 +303,12 @@ void MainWindow::on_actionSimplify_triggered() // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); - + try { switch( getSimplificationMode() ) { - case ABS_P : simplify(m_pct, PS2::Squared_distance_cost(), PS2::Stop_below_count_ratio_threshold(getThreshold()) ) ; + case ABS_P : simplify(m_pct, PS2::Squared_distance_cost(), PS2::Stop_below_count_ratio_threshold(getThreshold()) ) ; break ; case ABS_E : simplify(m_pct, PS2::Squared_distance_cost(), PS2::Stop_above_cost_threshold(getThreshold()) ) ; break ; case REL_P : simplify(m_pct, PS2::Scaled_squared_distance_cost(), PS2::Stop_below_count_ratio_threshold(getThreshold()) ) ; break ; @@ -321,14 +318,14 @@ void MainWindow::on_actionSimplify_triggered() break ; } - + statusBar()->showMessage(QString("Simplification done")); - } - catch(...) + } + catch(...) { statusBar()->showMessage(QString("Exception ocurred")); } - + // default cursor QApplication::restoreOverrideCursor(); mGI->modelChanged(); @@ -336,7 +333,7 @@ void MainWindow::on_actionSimplify_triggered() } -void +void MainWindow::open(QString fileName) { if(! fileName.isEmpty()){ @@ -374,11 +371,11 @@ std::string trim_right ( std::string str ) if ( pos != std::string::npos ) return str.substr(0,pos+1); } - - return std::string("") ; + + return std::string("") ; } -void MainWindow::loadWKT(QString +void MainWindow::loadWKT(QString #if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500) fileName #endif @@ -386,14 +383,14 @@ void MainWindow::loadWKT(QString { #if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500) typedef std::vector MultiPoint; - + typedef std::vector LineString; typedef std::deque MultiLineString; - + typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef std::deque MultiPolygon; - + std::ifstream ifs(qPrintable(fileName)); MultiPoint points; MultiLineString polylines; @@ -418,9 +415,9 @@ void MainWindow::loadWKT(QString m_pct.insert_constraint(hole); } } - + Q_EMIT( changed()); - + actionRecenter->trigger(); #endif } @@ -434,20 +431,20 @@ void MainWindow::loadOSM(QString fileName) try { std::ifstream ifs(qPrintable(fileName)); - + std::string line ; - + std::vector poly ; - + while ( std::getline(ifs,line) ) { line = trim_right(line); - + if ( line.size() > 0 ) { if ( line.find(':') != std::string::npos ) { - if ( poly.size() > 0 ) + if ( poly.size() > 0 ) { if ( poly.front() == poly.back() && poly.size() >= 4 ) { @@ -465,21 +462,21 @@ void MainWindow::loadOSM(QString fileName) else { double x,y ; - + std::string::size_type pos = line.find(','); if ( pos != std::string::npos ) line[pos]= ' ' ; - + std::istringstream ss(line); - + ss >> x >> y ; - + poly.push_back( Point_2(x,y) ); } } } - - if ( poly.size() > 0 ) + + if ( poly.size() > 0 ) { if ( poly.front() == poly.back() ) { @@ -490,14 +487,14 @@ void MainWindow::loadOSM(QString fileName) m_pct.insert_constraint(poly.begin(), poly.end() ) ; } } - } - catch(...) + } + catch(...) { statusBar()->showMessage(QString("Exception ocurred")); } - + Q_EMIT( changed()); - + actionRecenter->trigger(); } @@ -505,7 +502,7 @@ void MainWindow::on_actionRecenter_triggered() { this->graphicsView->setSceneRect(mGI->boundingRect()); - this->graphicsView->fitInView(mGI->boundingRect(), Qt::KeepAspectRatio); + this->graphicsView->fitInView(mGI->boundingRect(), Qt::KeepAspectRatio); } #include "Polyline_simplification_2.moc" @@ -520,7 +517,7 @@ int main(int argc, char **argv) // Import resources from libCGALQt5. CGAL_QT_INIT_RESOURCES; - + MainWindow mainWindow; mainWindow.show(); return app.exec(); diff --git a/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.ui b/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.ui index 1d0451ab4cc..856207915c6 100644 --- a/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.ui +++ b/Polyline_simplification_2/demo/Polyline_simplification_2/Polyline_simplification_2.ui @@ -279,14 +279,6 @@ - - - thresholdSlider - valueChanged(int) - MainWindow - setThreshold(int) - - setThreshold(int) diff --git a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h index 9ca66d7f0dd..5f3b70c2253 100644 --- a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h +++ b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h @@ -9,11 +9,11 @@ // // Author(s) : Dominik Huelse // Michael Hemmer -// +// // ============================================================================ /*! \file CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h - provides gcd for Polynomials, based on Modular arithmetic. + provides gcd for Polynomials, based on Modular arithmetic. */ @@ -38,14 +38,14 @@ namespace internal{ template Polynomial gcd_utcf_UFD(Polynomial,Polynomial); -template +template Polynomial< Polynomial > modular_gcd_utcf_algorithm_M( const Polynomial< Polynomial >& FF1 , const Polynomial< Polynomial >& FF2 ){ return gcd_utcf_UFD(FF1, FF2); } -template +template Polynomial modular_gcd_utcf_algorithm_M( const Polynomial& FF1 , const Polynomial& FF2 ){ @@ -64,16 +64,16 @@ Polynomial modular_gcd_utcf_algorithm_M( typedef typename CGAL::Modular_traits::Residue_type MPoly; typedef typename CGAL::Modular_traits::Residue_type MScalar; - + typedef Chinese_remainder_traits CRT; - typename CRT::Chinese_remainder chinese_remainder; - - CGAL::Real_timer timer; - - + typename CRT::Chinese_remainder chinese_remainder; + + CGAL::Real_timer timer; + + if(FF1.is_zero()){ if(FF2.is_zero()){ - return Poly(1);// TODO: return 0 for CGAL + return Poly(1);// TODO: return 0 for CGAL } else{ // std::cout<<"\nFF1 is zero"< modular_gcd_utcf_algorithm_M( result = Poly(CGAL::gcd(FF1.content(),FF2.content())); return CGAL::canonicalize(result); } - + Poly F1 = CGAL::canonicalize(FF1); Poly F2 = CGAL::canonicalize(FF2); - - Scalar f1 = scalar_factor(F1.lcoeff()); // ilcoeff(F1) - Scalar f2 = scalar_factor(F2.lcoeff()); // ilcoeff(F2) + + Scalar f1 = scalar_factor(F1.lcoeff()); // ilcoeff(F1) + Scalar f2 = scalar_factor(F2.lcoeff()); // ilcoeff(F2) Scalar g_ = scalar_factor(f1,f2); - + //std::cout <<" g_ : "<< g_ << std::endl; - + bool solved = false; int prime_index = -1; - int n = 0; // number of lucky primes + int n = 0; // number of lucky primes int degree_F1 = F1.degree(); int degree_F2 = F2.degree(); int degree_e = (std::min)(degree_F1,degree_F2); @@ -109,8 +109,8 @@ Polynomial modular_gcd_utcf_algorithm_M( MScalar mg_; MPoly mF1,mF2,mG_; - typename CRT::Scalar_type p,q,pq,s,t; - Poly Gs,H1s,H2s, Gs_old; // s =^ star + typename CRT::Scalar_type p(0),q(0),pq,s,t; + Poly Gs,H1s,H2s, Gs_old; // s =^ star #ifdef CGAL_MODULAR_GCD_TIMER timer_init.stop(); #endif @@ -123,7 +123,7 @@ Polynomial modular_gcd_utcf_algorithm_M( do{ int current_prime = -1; prime_index++; - if(prime_index >= 2000){ + if(prime_index >= 2000){ std::cerr<<"primes in the array exhausted"< modular_gcd_utcf_algorithm_M( #ifdef CGAL_MODULAR_GCD_TIMER timer_gcd.stop(); #endif - + //mH1 = CGAL::integral_div(mF1,mG_); //mH2 = CGAL::integral_div(mF2,mG_); //--------------------------------------- - // return if G is constant + // return if G is constant if (mG_ == MPoly(1)) return Poly(1); // -------------------------------------- }// repeat until mG_ degree is less equal the known bound - // check prime + // check prime while( mG_.degree() > degree_e); - + if( mG_.degree() < degree_e ){ - if( n != 0 ) std::cout << "UNLUCKY PRIME !!"<< std::endl; + if( n != 0 ) std::cout << "UNLUCKY PRIME !!"<< std::endl; - // restart chinese remainder + // restart chinese remainder // ignore previous unlucky primes - n=1; + n=1; degree_e= mG_.degree(); }else{ CGAL_postcondition( mG_.degree() == degree_e); n++; // increase number of lucky primes } - + // -------------------------------------- // try chinese remainder - -// std::cout <<" chinese remainder round :" << n << std::endl; + +// std::cout <<" chinese remainder round :" << n << std::endl; typename CGAL::Modular_traits::Modular_image_representative inv_map; - if(n == 1){ + if(n == 1){ // init chinese remainder - q = CGAL::Residue::get_current_prime(); // implicit ! + q = CGAL::Residue::get_current_prime(); // implicit ! Gs_old = Gs = inv_map(mG_); - + //H1s_old = H1s = inv_map(mH1); //H2s_old = H2s = inv_map(mH2); }else{ // continue chinese remainder - - p = CGAL::Residue::get_current_prime(); // implicit! - + + p = CGAL::Residue::get_current_prime(); // implicit! + Gs_old = Gs ; //H1s_old = H1s ; //H2s_old = H2s ; #ifdef CGAL_MODULAR_GCD_TIMER timer_CR.start(); #endif -// chinese_remainder(q,Gs ,p,inv_map(mG_),pq,Gs); +// chinese_remainder(q,Gs ,p,inv_map(mG_),pq,Gs); // cached_extended_euclidean_algorithm(q,p,s,t); internal::Cached_extended_euclidean_algorithm ceea; @@ -219,10 +219,10 @@ Polynomial modular_gcd_utcf_algorithm_M( try{ if( n != 1 && Gs == Gs_old ){ - Poly r1,r2; + Poly r1,r2; #ifdef CGAL_MODULAR_GCD_TIMER timer_division.start(); -#endif +#endif typedef CGAL::Algebraic_structure_traits< Poly > ASTE_Poly; typename ASTE_Poly::Divides divides; @@ -230,35 +230,35 @@ Polynomial modular_gcd_utcf_algorithm_M( bool div1=divides(Gs,g_*F1,H1s); bool div2=divides(Gs,g_*F2,H2s); if (div1 && div2){ - solved = true; + solved = true; } // this is the old code -// NT dummy; +// NT dummy; // Poly::euclidean_division(g_*F1,Gs,H1s,r1); // Poly::euclidean_division(g_*F2,Gs,H2s,r2); // if (r1.is_zero() && r2.is_zero()) -// solved = true; - +// solved = true; + #ifdef CGAL_MODULAR_GCD_TIMER timer_division.stop(); #endif // std::cout << "number of primes used : "<< n << std::endl; } // end while - + }catch(...){} - + } - - + + //TODO CGAL: change this to multivariat content // Scalar scalar_content_f1 = scalar_factor(FF1); // Scalar scalar_content_f2 = scalar_factor(FF2); // Scalar scalar_content_gcd = CGAL::gcd(scalar_content_f1,scalar_content_f2); // Poly result = CGAL::canonicalize(Gs)*Poly(scalar_content_gcd); -// return result; +// return result; return CGAL::canonicalize(Gs); - + } } // namespace internal diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Octree.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Octree.h index b8cdb83abab..a994d954100 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Octree.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Octree.h @@ -27,14 +27,14 @@ extern int scoreTime; namespace CGAL { namespace Shape_detection { - - template + + template class Efficient_RANSAC; - + namespace internal { const std::size_t size_t_max = (std::numeric_limits::max)(); - + template class DirectPointAccessor { public: @@ -43,7 +43,7 @@ namespace CGAL { DirectPointAccessor() {} DirectPointAccessor(const Input_iterator &begin, - const Input_iterator &beyond, + const Input_iterator &beyond, std::size_t offset) : m_first(begin), m_offset(offset) { m_beyond = (beyond == begin) ? begin : beyond - 1; } @@ -204,7 +204,7 @@ namespace CGAL { FT get_z(const Point_3& p){ return m_traits.compute_z_3_object()(p); } FT get_coord(const Point_3& p, unsigned int d) { - CGAL_assertion(d >= 0 && d < 3); + CGAL_assertion(d < 3); switch (d) { case 0: return get_x(p); @@ -221,9 +221,9 @@ namespace CGAL { Point_3 transl(const Point_3& p, const Vector_3 &v) { return m_traits.construct_translated_point_3_object()(p, v); } - + public: - Octree(Sd_traits const& traits) + Octree(Sd_traits const& traits) : m_traits(traits), m_bucket_size(20), m_set_max_level(10), m_root(nullptr) {} Octree(Sd_traits const& traits, const Input_iterator &first, @@ -231,7 +231,7 @@ namespace CGAL { Point_map& point_pmap, Normal_map& normal_pmap, std::size_t offset = 0, - std::size_t bucketSize = 20, + std::size_t bucketSize = 20, std::size_t maxLevel = 10) : PointAccessor(first, beyond, offset), m_traits(traits), @@ -276,7 +276,7 @@ namespace CGAL { { FT bbox_diagonal = (FT) CGAL::sqrt( (m_bBox.xmax() - m_bBox.xmin()) * (m_bBox.xmax() - m_bBox.xmin()) - + (m_bBox.ymax() - m_bBox.ymin()) * (m_bBox.ymax() - m_bBox.ymin()) + + (m_bBox.ymax() - m_bBox.ymin()) * (m_bBox.ymax() - m_bBox.ymin()) + (m_bBox.zmax() - m_bBox.zmin()) * (m_bBox.zmax() - m_bBox.zmin())); m_set_max_level = std::size_t (std::log (bbox_diagonal @@ -294,7 +294,7 @@ namespace CGAL { m_max_level = std::max(m_max_level, cell->level); if (cell->level == m_set_max_level) continue; - + std::size_t zLowYHighXSplit, zLowYLowXSplit, zLowYSplit; std::size_t zHighYSplit, zHighYHighXSplit, zHighYLowXSplit; @@ -307,14 +307,14 @@ namespace CGAL { zLowYLowXSplit = split(cell->first, zLowYSplit, 0, get_x(cell->center)); zLowYHighXSplit = split(zLowYSplit + 1, - zSplit, 0, get_x(cell->center)); + zSplit, 0, get_x(cell->center)); } else { zLowYLowXSplit = size_t_max; zLowYHighXSplit = split(cell->first, zSplit, 0, get_x(cell->center)); } - zHighYSplit = split(zSplit + 1, cell->last, 1, get_y(cell->center)); + zHighYSplit = split(zSplit + 1, cell->last, 1, get_y(cell->center)); if (zHighYSplit != size_t_max) { zHighYHighXSplit = split(zHighYSplit + 1, @@ -336,23 +336,23 @@ namespace CGAL { zHighYSplit = split(cell->first, cell->last, 1, - get_y(cell->center)); + get_y(cell->center)); if (zHighYSplit != size_t_max) { - zHighYHighXSplit = split(zHighYSplit + 1, - cell->last, - 0, + zHighYHighXSplit = split(zHighYSplit + 1, + cell->last, + 0, get_x(cell->center)); - zHighYLowXSplit = split(cell->first, + zHighYLowXSplit = split(cell->first, zHighYSplit, - 0, - get_x(cell->center)); + 0, + get_x(cell->center)); } else { zHighYLowXSplit = size_t_max; zHighYHighXSplit = split(cell->first, - cell->last, + cell->last, 0, get_x(cell->center)); } @@ -367,7 +367,7 @@ namespace CGAL { if (cell->first <= zLowYLowXSplit) { //--- cell->child[7] = new Cell(cell->first, - zLowYLowXSplit, + zLowYLowXSplit, transl(cell->center, constr_vec( ORIGIN, constr_pt(-width,-width,-width))), cell->level + 1); @@ -381,7 +381,7 @@ namespace CGAL { if (zLowYLowXSplit < zLowYSplit || zLowYLowXSplit == size_t_max) { //+-- cell->child[6] = new Cell(zLowYLowXSplit + 1, - zLowYSplit, + zLowYSplit, transl(cell->center, constr_vec( ORIGIN, constr_pt(width,-width,-width))), cell->level + 1); @@ -396,8 +396,8 @@ namespace CGAL { if (zLowYSplit < zLowYHighXSplit || zLowYSplit == size_t_max) { //-+- - cell->child[5] = new Cell(zLowYSplit + 1, - zLowYHighXSplit, + cell->child[5] = new Cell(zLowYSplit + 1, + zLowYHighXSplit, transl(cell->center, constr_vec( ORIGIN, constr_pt(-width, width,-width))), cell->level + 1); @@ -411,7 +411,7 @@ namespace CGAL { if (zLowYHighXSplit < zSplit || zLowYHighXSplit == size_t_max) { //++- cell->child[4] = new Cell(zLowYHighXSplit + 1, - zSplit, + zSplit, transl(cell->center, constr_vec( ORIGIN, constr_pt(width, width,-width))), cell->level + 1); @@ -442,7 +442,7 @@ namespace CGAL { if (zHighYLowXSplit < zHighYSplit || zHighYLowXSplit == size_t_max) { //+-+ cell->child[2] = new Cell(zHighYLowXSplit + 1, - zHighYSplit, + zHighYSplit, transl(cell->center, constr_vec( ORIGIN, constr_pt(width,-width, width))), cell->level + 1); @@ -458,9 +458,9 @@ namespace CGAL { if (zHighYSplit < zHighYHighXSplit || zHighYSplit == size_t_max) { //-++ cell->child[1] = new Cell(zHighYSplit + 1, - zHighYHighXSplit, + zHighYHighXSplit, transl(cell->center, constr_vec( - ORIGIN, constr_pt(-width, width, width))), + ORIGIN, constr_pt(-width, width, width))), cell->level + 1); if (cell->child[1]->size() > m_bucket_size) @@ -472,7 +472,7 @@ namespace CGAL { if (zHighYHighXSplit <= cell->last || zHighYHighXSplit == size_t_max) { if (zHighYHighXSplit < cell->last || zHighYHighXSplit == size_t_max) { //+++ - cell->child[0] = new Cell(zHighYHighXSplit + 1, + cell->child[0] = new Cell(zHighYHighXSplit + 1, cell->last, transl(cell->center, constr_vec( ORIGIN, constr_pt(width, width, width))), @@ -549,25 +549,25 @@ namespace CGAL { std::size_t fullScore(Shape *candidate, std::vector &shapeIndex, - FT epsilon, + FT epsilon, FT normal_threshold) { std::vector indices(m_root->size()); for (std::size_t i = 0;isize();i++) { indices[i] = index(m_root->first + i); } - - candidate->cost_function(this->begin() + m_root->first, + + candidate->cost_function(this->begin() + m_root->first, this->begin() + m_root->last, shapeIndex, - epsilon, - normal_threshold, + epsilon, + normal_threshold, indices); return candidate->m_indices.size(); } - std::size_t score(Shape *candidate, + std::size_t score(Shape *candidate, std::vector &shapeIndex, FT epsilon, FT normal_threshold) { @@ -599,8 +599,8 @@ namespace CGAL { } } - candidate->cost_function(epsilon, - normal_threshold, + candidate->cost_function(epsilon, + normal_threshold, indices); } else { @@ -621,7 +621,7 @@ namespace CGAL { const Bbox_3 &boundingBox() { return m_bBox; } - + const Bbox_3 &buildBoundingCube() { FT min[] = {std::numeric_limits::infinity(), std::numeric_limits::infinity(), @@ -642,7 +642,7 @@ namespace CGAL { m_bBox = Bbox_3(min[0], min[1], min[2], max[0], max[1], max[2]); - m_width = (std::max)(max[0] - min[0], + m_width = (std::max)(max[0] - min[0], (std::max)(max[1] - min[1], max[2] - min[2])) * (FT) 0.5; m_center = constr_pt((min[0] + max[0]) * (FT) 0.5, (min[1] + max[1]) * (FT) 0.5, @@ -653,7 +653,7 @@ namespace CGAL { // returns index of last point below threshold std::size_t split(std::size_t first, std::size_t last, std::size_t dimension, FT threshold) { - if (last == size_t_max || first == size_t_max) + if (last == size_t_max || first == size_t_max) return size_t_max; if (first > last) @@ -718,7 +718,7 @@ namespace CGAL { }; } } - + } #endif diff --git a/Surface_mesher/demo/Surface_mesher/File_XT.h b/Surface_mesher/demo/Surface_mesher/File_XT.h index 4b4cebdae29..d2653b3de9b 100644 --- a/Surface_mesher/demo/Surface_mesher/File_XT.h +++ b/Surface_mesher/demo/Surface_mesher/File_XT.h @@ -1,6 +1,6 @@ /********************************************************************* -* 25 - 02 - 97 -* gestion des fichiers image ELF +* 25 - 02 - 97 +* gestion des fichiers image ELF * *********************************************************************/ @@ -14,12 +14,26 @@ namespace CGAL { namespace Total { +namespace internal { + +//To avoid "fopen may be unsafe" on Visual. +bool open_file(FILE **fin, const char* filename) +{ +#if defined(BOOST_MSVC) + return (fopen_s(fin, filename, "rw") == 0); +#else + *fin = fopen(filename, "rw"); + return (fin != NULL); +#endif +} + +} // namespace internal void permuteLong(char *a) { char tmp; -#ifdef CGAL_LITTLE_ENDIAN +#ifdef CGAL_LITTLE_ENDIAN tmp=a[0]; a[0]=a[3]; a[3]=tmp; tmp=a[1]; a[1]=a[2]; a[2]=tmp; #endif @@ -29,7 +43,7 @@ void permuteLongTab(long *a,int nb) { int i; -#ifdef CGAL_LITTLE_ENDIAN +#ifdef CGAL_LITTLE_ENDIAN for(i=0;i