From b927eb413d57a9159cdf6412154b7d90f88907c1 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 16 Aug 2006 14:24:44 +0000 Subject: [PATCH] fixed min/max problem --- .../include/CGAL/Cartesian/Iso_cuboid_3.h | 48 +++++++++---------- .../include/CGAL/Cartesian/Iso_rectangle_2.h | 4 +- .../include/CGAL/Cartesian/Segment_3.h | 8 ++-- .../include/CGAL/Cartesian/function_objects.h | 14 +++--- .../include/CGAL/Cartesian_converter.h | 4 +- .../include/CGAL/predicates/kernel_ftC2.h | 10 ++-- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h index ac19bea1411..099c1b9f7d6 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h @@ -108,11 +108,11 @@ public: bool operator==(const Iso_cuboidC3& s) const; bool operator!=(const Iso_cuboidC3& s) const; - const Point_3 & min() const + const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return get(base).e0; } - const Point_3 & max() const + const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return get(base).e1; } @@ -121,7 +121,7 @@ public: Iso_cuboid_3 transform(const Aff_transformation_3 &t) const { - return Iso_cuboidC3(t.transform(min()), t.transform(max())); + return Iso_cuboidC3(t.transform((this->min)()), t.transform((this->max)())); } Bounded_side bounded_side(const Point_3& p) const; @@ -150,7 +150,7 @@ Iso_cuboidC3::operator==(const Iso_cuboidC3& r) const { // FIXME : predicate if (CGAL::identical(base, r.base)) return true; - return min() == r.min() && max() == r.max(); + return (this->min)() == (r.min)() && (this->max)() == (r.max)(); } template < class R > @@ -166,7 +166,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::xmin() const { - return min().x(); + return (this->min)().x(); } template < class R > @@ -174,7 +174,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::ymin() const { - return min().y(); + return (this->min)().y(); } template < class R > @@ -182,7 +182,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::zmin() const { - return min().z(); + return (this->min)().z(); } template < class R > @@ -190,7 +190,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::xmax() const { - return max().x(); + return (this->max)().x(); } template < class R > @@ -198,7 +198,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::ymax() const { - return max().y(); + return (this->max)().y(); } template < class R > @@ -206,7 +206,7 @@ inline const typename Iso_cuboidC3::FT & Iso_cuboidC3::zmax() const { - return max().z(); + return (this->max)().z(); } template < class R > @@ -245,15 +245,15 @@ Iso_cuboidC3::vertex(int i) const Construct_point_3 construct_point_3; switch (i%8) { - case 0: return min(); - case 1: return construct_point_3(max().hx(), min().hy(), min().hz()); - case 2: return construct_point_3(max().hx(), max().hy(), min().hz()); - case 3: return construct_point_3(min().hx(), max().hy(), min().hz()); - case 4: return construct_point_3(min().hx(), max().hy(), max().hz()); - case 5: return construct_point_3(min().hx(), min().hy(), max().hz()); - case 6: return construct_point_3(max().hx(), min().hy(), max().hz()); + case 0: return (this->min)(); + case 1: return construct_point_3((this->max)().hx(), (this->min)().hy(), (this->min)().hz()); + case 2: return construct_point_3((this->max)().hx(), (this->max)().hy(), (this->min)().hz()); + case 3: return construct_point_3((this->min)().hx(), (this->max)().hy(), (this->min)().hz()); + case 4: return construct_point_3((this->min)().hx(), (this->max)().hy(), (this->max)().hz()); + case 5: return construct_point_3((this->min)().hx(), (this->min)().hy(), (this->max)().hz()); + case 6: return construct_point_3((this->max)().hx(), (this->min)().hy(), (this->max)().hz()); default: // case 7: - return max(); + return (this->max)(); } } @@ -279,9 +279,9 @@ Bounded_side Iso_cuboidC3:: bounded_side(const typename Iso_cuboidC3::Point_3& p) const { - if (strict_dominance(p, min()) && strict_dominance(max(), p) ) + if (strict_dominance(p, (this->min)()) && strict_dominance((this->max)(), p) ) return ON_BOUNDED_SIDE; - if (dominance(p, min()) && dominance(max(), p)) + if (dominance(p, (this->min)()) && dominance((this->max)(), p)) return ON_BOUNDARY; return ON_UNBOUNDED_SIDE; } @@ -328,9 +328,9 @@ CGAL_KERNEL_INLINE bool Iso_cuboidC3::is_degenerate() const { // FIXME : predicate - return min().hx() == max().hx() - || min().hy() == max().hy() - || min().hz() == max().hz(); + return (this->min)().hx() == (this->max)().hx() + || (this->min)().hy() == (this->max)().hy() + || (this->min)().hz() == (this->max)().hz(); } template < class R > @@ -339,7 +339,7 @@ Bbox_3 Iso_cuboidC3::bbox() const { typename R::Construct_bbox_3 construct_bbox_3; - return construct_bbox_3(min()) + construct_bbox_3(max()); + return construct_bbox_3((this->min)()) + construct_bbox_3((this->max)()); } CGAL_END_NAMESPACE diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h index 8882e379a7e..6f2fbf5d46c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h @@ -56,11 +56,11 @@ public: // CGAL_kernel_assertion(p<=q); } - const Point_2 & min() const + const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return get(base).e0; } - const Point_2 & max() const + const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return get(base).e1; } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h index 0e28bc2402a..72a9385d405 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h @@ -69,8 +69,8 @@ public: const Point_3 & start() const; const Point_3 & end() const; - const Point_3 & min() const; - const Point_3 & max() const; + const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; + const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; const Point_3 & vertex(int i) const; const Point_3 & point(int i) const; const Point_3 & operator[](int i) const; @@ -119,7 +119,7 @@ SegmentC3::end() const template < class R > inline const typename SegmentC3::Point_3 & -SegmentC3::min() const +SegmentC3::min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return lexicographically_xyz_smaller(source(),target()) ? source() : target(); @@ -128,7 +128,7 @@ SegmentC3::min() const template < class R > inline const typename SegmentC3::Point_3 & -SegmentC3::max() const +SegmentC3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return lexicographically_xyz_smaller(source(),target()) ? target() : source(); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 529116fe782..05f964fe704 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -1361,7 +1361,7 @@ namespace CartesianKernelFunctors { const result_type & operator()(const Iso_rectangle_2& r) const { - return r.min().x(); + return (r.min)().x(); } }; @@ -1378,7 +1378,7 @@ namespace CartesianKernelFunctors { const result_type & operator()(const Iso_rectangle_2& r) const { - return r.max().x(); + return (r.max)().x(); } }; @@ -1395,7 +1395,7 @@ namespace CartesianKernelFunctors { const result_type & operator()(const Iso_rectangle_2& r) const { - return r.min().y(); + return (r.min)().y(); } }; @@ -1412,7 +1412,7 @@ namespace CartesianKernelFunctors { const result_type & operator()(const Iso_rectangle_2& r) const { - return r.max().y(); + return (r.max)().y(); } }; @@ -1498,7 +1498,7 @@ namespace CartesianKernelFunctors { operator()( const Iso_rectangle_2& r) const { typename K::Construct_bbox_2 construct_bbox_2; - return construct_bbox_2(r.min()) + construct_bbox_2(r.max()); + return construct_bbox_2((r.min)()) + construct_bbox_2((r.max)()); } result_type @@ -2771,9 +2771,9 @@ namespace CartesianKernelFunctors { operator()( const Iso_rectangle_2& r, int i) const { switch (i%4) { - case 0: return r.min(); + case 0: return (r.min)(); case 1: return Point_2(r.xmax(), r.ymin()); - case 2: return r.max(); + case 2: return (r.max)(); default: return Point_2(r.xmin(), r.ymax()); } } diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index 761560d775e..a45d8f38706 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -214,7 +214,7 @@ public: operator()(const typename K1::Iso_rectangle_2 &a) const { typedef typename K2::Iso_rectangle_2 Iso_rectangle_2; - return Iso_rectangle_2(operator()(a.min()), operator()(a.max()), 0); + return Iso_rectangle_2(operator()((a.min)()), operator()((a.max)()), 0); } @@ -299,7 +299,7 @@ public: operator()(const typename K1::Iso_cuboid_3 &a) const { typedef typename K2::Iso_cuboid_3 Iso_cuboid_3; - return Iso_cuboid_3(operator()(a.min()), operator()(a.max()), 0); + return Iso_cuboid_3(operator()((a.min)()), operator()((a.max)()), 0); } std::pair diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 94ef1dc7287..ac6cf25e33d 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -201,16 +201,16 @@ compare_y_at_xC2(const FT &px, const FT &py, // compares the y-coordinates of p and the vertical projection of p on s. // Precondition : p is in the x-range of s. - CGAL_kernel_precondition(px >= min(ssx, stx) && px <= max(ssx, stx)); + CGAL_kernel_precondition(px >= (CGAL::min)(ssx, stx) && px <= (CGAL::max)(ssx, stx)); if (ssx < stx) return enum_cast(orientationC2(px, py, ssx, ssy, stx, sty)); else if (ssx > stx) return enum_cast(orientationC2(px, py, stx, sty, ssx, ssy)); else { - if (py < min(sty, ssy)) + if (py < (CGAL::min)(sty, ssy)) return SMALLER; - if (py > max(sty, ssy)) + if (py > (CGAL::max)(sty, ssy)) return LARGER; return EQUAL; } @@ -231,8 +231,8 @@ compare_y_at_x_segment_C2(const FT &px, // - if the segments intersect, return EQUAL // - if not, return the obvious SMALLER/LARGER. - CGAL_kernel_precondition(px >= min(s1sx, s1tx) && px <= max(s1sx, s1tx)); - CGAL_kernel_precondition(px >= min(s2sx, s2tx) && px <= max(s2sx, s2tx)); + CGAL_kernel_precondition(px >= (CGAL::min)(s1sx, s1tx) && px <= (CGAL::max)(s1sx, s1tx)); + CGAL_kernel_precondition(px >= (CGAL::min)(s2sx, s2tx) && px <= (CGAL::max)(s2sx, s2tx)); if (s1sx != s1tx && s2sx != s2tx) { FT s1stx = s1sx-s1tx;