diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h index 8ddaaf9bf5b..d95ddec8f2a 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h @@ -36,10 +36,10 @@ namespace internal { template class Line_2_Line_2_pair { public: - enum Intersection_results {NO_INTERSECTION, POINT, LINE}; + enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, LINE}; Line_2_Line_2_pair(typename K::Line_2 const *line1, typename K::Line_2 const *line2) - : _line1(line1), _line2(line2), _known(false) {} + : _line1(line1), _line2(line2), _result(NOT_COMPUTED_YET) {} Intersection_results intersection_type() const; @@ -48,7 +48,6 @@ public: protected: typename K::Line_2 const* _line1; typename K::Line_2 const * _line2; - mutable bool _known; mutable Intersection_results _result; mutable typename K::Point_2 _intersection_point; }; @@ -141,11 +140,10 @@ typename Line_2_Line_2_pair::Intersection_results Line_2_Line_2_pair::intersection_type() const { typedef typename K::RT RT; - if (_known) + if (_result != NOT_COMPUTED_YET) return _result; RT nom1, nom2, denom; // The non const this pointer is used to cast away const. - _known = true; denom = _line1->a()*_line2->b() - _line2->a()*_line1->b(); if (denom == RT(0)) { if (RT(0) == (_line1->a()*_line2->c() - _line2->a()*_line1->c()) && @@ -180,7 +178,7 @@ template typename K::Point_2 Line_2_Line_2_pair::intersection_point() const { - if (!_known) + if (_result == NOT_COMPUTED_YET) intersection_type(); CGAL_kernel_assertion(_result == POINT); return _intersection_point; @@ -190,7 +188,7 @@ template typename K::Line_2 Line_2_Line_2_pair::intersection_line() const { - if (!_known) + if (_result == NOT_COMPUTED_YET) intersection_type(); CGAL_kernel_assertion(_result == LINE); return *_line1; diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h index bfd102da8de..eada9a07ec2 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h @@ -35,10 +35,13 @@ namespace internal { template class Ray_2_Line_2_pair { public: - enum Intersection_results {NO_INTERSECTION, POINT, RAY}; + enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, RAY}; + typedef typename K::FT FT; Ray_2_Line_2_pair(typename K::Ray_2 const *ray, typename K::Line_2 const *line) - : _ray(ray), _line(line), _known(false) {} + : _ray(ray), _line(line), _result(NOT_COMPUTED_YET), + _intersection_point(K().construct_point_2_object()(ORIGIN)) + {} Intersection_results intersection_type() const; @@ -47,7 +50,6 @@ public: protected: typename K::Ray_2 const * _ray; typename K::Line_2 const * _line; - mutable bool _known; mutable Intersection_results _result; mutable typename K::Point_2 _intersection_point; }; @@ -94,7 +96,7 @@ intersection(const typename K::Line_2 &line, const typename K::Ray_2 &ray, const K& k) { - return internal::intersection(ray, line, k); + return internal::intersection(ray, line, k); } @@ -115,14 +117,14 @@ template typename Ray_2_Line_2_pair::Intersection_results Ray_2_Line_2_pair::intersection_type() const { - if (_known) + if (_result != NOT_COMPUTED_YET) return _result; // The non const this pointer is used to cast away const. - _known = true; const typename K::Line_2 &l1 = _ray->supporting_line(); Line_2_Line_2_pair linepair(&l1, _line); switch ( linepair.intersection_type()) { case Line_2_Line_2_pair::NO_INTERSECTION: + default: _result = NO_INTERSECTION; break; case Line_2_Line_2_pair::POINT: @@ -142,7 +144,7 @@ template typename K::Point_2 Ray_2_Line_2_pair::intersection_point() const { - if (!_known) + if (_result == NOT_COMPUTED_YET) intersection_type(); CGAL_kernel_assertion(_result == POINT); return _intersection_point; @@ -152,7 +154,7 @@ template typename K::Ray_2 Ray_2_Line_2_pair::intersection_ray() const { - if (!_known) + if (_result == NOT_COMPUTED_YET) intersection_type(); CGAL_kernel_assertion(_result == RAY); return *_ray; diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 663361e4eb9..ba3d8b9567c 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -308,6 +308,7 @@ Segment_2_Segment_2_pair::intersection_type() const Line_2_Line_2_pair linepair(&l1, &l2); switch ( linepair.intersection_type()) { case Line_2_Line_2_pair::NO_INTERSECTION: + default: _result = NO_INTERSECTION; break; case Line_2_Line_2_pair::POINT: diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h index 47424bb3122..fa63e699475 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h @@ -275,6 +275,7 @@ cut_right_off(typename K::Line_2 const & cutter) Line_2_Line_2_pair pair(&support_, &cutter); switch (pair.intersection_type()) { case Line_2_Line_2_pair::NO_INTERSECTION: + default: if (cutter.has_on_negative_side(support_.point())) bound_state_ = LINE_EMPTY; break; diff --git a/Kernel_23/examples/Kernel_23/MyPointC2.h b/Kernel_23/examples/Kernel_23/MyPointC2.h index de1c7ee6cd6..e4b2f3ff0ce 100644 --- a/Kernel_23/examples/Kernel_23/MyPointC2.h +++ b/Kernel_23/examples/Kernel_23/MyPointC2.h @@ -21,7 +21,6 @@ public: *(vec+1) = 0; } - MyPointC2(const double x, const double y, int c = 0) : col(c) { diff --git a/Nef_2/include/CGAL/Nef_2/debug.h b/Nef_2/include/CGAL/Nef_2/debug.h index ff850cdf052..ce77dc610c6 100644 --- a/Nef_2/include/CGAL/Nef_2/debug.h +++ b/Nef_2/include/CGAL/Nef_2/debug.h @@ -59,8 +59,7 @@ #ifndef NDEBUG #define CGAL_NEF_TRACEN(t) if((debugthread%CGAL_NEF_DEBUG)==0) \ - std::cerr<< " "< #endif @@ -90,7 +90,7 @@ extern "C" { #if !defined CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT && \ (((defined __i386__ || defined __x86_64__) && !defined CGAL_SAFE_SSE2) \ || defined __ia64__ \ - || defined _M_IX86 || defined _M_X64 || defined _M_IA64 \ + || defined _M_IX86 || defined _M_IA64 \ || (defined FLT_EVAL_METHOD && FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)) # define CGAL_FPU_HAS_EXCESS_PRECISION #endif diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 3f73f238eae..88e246f0f85 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -2976,9 +2976,9 @@ exact_locate(const Point& p, Face_handle start) const #endif // no CGAL_NO_STRUCTURAL_FILTERING { + li = 4; //general init to avoid warnings. + lt = OUTSIDE_AFFINE_HULL; //same if (dimension() < 0) { - lt = OUTSIDE_AFFINE_HULL; - li = 4; // li should not be used in this case return Face_handle(); } if( dimension() == 0) { @@ -2987,10 +2987,6 @@ exact_locate(const Point& p, if (xy_equal(p,finite_vertex()->face()->vertex(0)->point())){ lt = VERTEX ; } - else{ - lt = OUTSIDE_AFFINE_HULL; - } - li = 4; // li should not be used in this case return Face_handle(); } if(dimension() == 1){