From b02bc7921b01a9fceff22a2862ae95210834b3c1 Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Fri, 25 Jul 2008 11:19:03 +0000 Subject: [PATCH] Use boost::array instead of Twotuple --- .../include/CGAL/Cartesian/Iso_cuboid_3.h | 30 +++++++-------- .../include/CGAL/Cartesian/Iso_rectangle_2.h | 10 ++--- .../include/CGAL/Cartesian/Ray_2.h | 10 ++--- .../include/CGAL/Cartesian/Ray_3.h | 16 ++++---- .../include/CGAL/Cartesian/Segment_2.h | 10 ++--- .../include/CGAL/Cartesian/Segment_3.h | 10 ++--- .../include/CGAL/Homogeneous/Iso_cuboidH3.h | 38 +++++++++---------- .../CGAL/Homogeneous/Iso_rectangleH2.h | 10 ++--- .../include/CGAL/Homogeneous/RayH2.h | 19 +++++----- 9 files changed, 76 insertions(+), 77 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h index dfeb86965c9..a804ffe1205 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_ISO_CUBOID_3_H #define CGAL_CARTESIAN_ISO_CUBOID_3_H -#include +#include #include #include @@ -39,7 +39,7 @@ class Iso_cuboidC3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef typename R_::Construct_point_3 Construct_point_3; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -50,7 +50,7 @@ public: Iso_cuboidC3() {} Iso_cuboidC3(const Point_3 &p, const Point_3 &q, int) - : base(p, q) + : base(CGALi::make_array(p, q)) { // I have to remove the assertions, because of Cartesian_converter. // CGAL_kernel_assertion(p.x()<=q.x()); @@ -68,15 +68,15 @@ public: else { miny = q.y(); maxy = p.y(); } if (p.z() < q.z()) { minz = p.z(); maxz = q.z(); } else { minz = q.z(); maxz = p.z(); } - base = Rep(construct_point_3(minx, miny, minz), - construct_point_3(maxx, maxy, maxz)); + base = Rep(CGALi::make_array(construct_point_3(minx, miny, minz), + construct_point_3(maxx, maxy, maxz))); } Iso_cuboidC3(const Point_3 &left, const Point_3 &right, const Point_3 &bottom, const Point_3 &top, const Point_3 &far_, const Point_3 &close) - : base(Construct_point_3()(left.x(), bottom.y(), far_.z()), - Construct_point_3()(right.x(), top.y(), close.z())) + : base(CGALi::make_array(Construct_point_3()(left.x(), bottom.y(), far_.z()), + Construct_point_3()(right.x(), top.y(), close.z()))) { CGAL_kernel_precondition(!less_x(right, left)); CGAL_kernel_precondition(!less_y(top, bottom)); @@ -85,8 +85,8 @@ public: Iso_cuboidC3(const FT& min_x, const FT& min_y, const FT& min_z, const FT& max_x, const FT& max_y, const FT& max_z) - : base(Construct_point_3()(min_x, min_y, min_z), - Construct_point_3()(max_x, max_y, max_z)) + : base(CGALi::make_array(Construct_point_3()(min_x, min_y, min_z), + Construct_point_3()(max_x, max_y, max_z))) { CGAL_kernel_precondition(min_x <= max_x); CGAL_kernel_precondition(min_y <= max_y); @@ -98,11 +98,11 @@ public: const FT& hw) { if (hw == FT(1)) - base = Rep(Construct_point_3()(min_hx, min_hy, min_hz), - Construct_point_3()(max_hx, max_hy, max_hz)); + base = Rep(CGALi::make_array(Construct_point_3()(min_hx, min_hy, min_hz), + Construct_point_3()(max_hx, max_hy, max_hz))); else - base = Rep(Construct_point_3()(min_hx/hw, min_hy/hw, min_hz/hw), - Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw)); + base = Rep(CGALi::make_array(Construct_point_3()(min_hx/hw, min_hy/hw, min_hz/hw), + Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw))); } typename R::Bool_type operator==(const Iso_cuboidC3& s) const; @@ -110,11 +110,11 @@ public: const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { - return get(base).e0; + return get(base)[0]; } const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const { - return get(base).e1; + return get(base)[1]; } Point_3 vertex(int i) const; Point_3 operator[](int i) const; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h index 6f2fbf5d46c..bab5f547e87 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_ISO_RECTANGLE_2_H #define CGAL_CARTESIAN_ISO_RECTANGLE_2_H -#include +#include CGAL_BEGIN_NAMESPACE @@ -36,7 +36,7 @@ class Iso_rectangleC2 typedef typename R_::Iso_rectangle_2 Iso_rectangle_2; typedef typename R_::Construct_point_2 Construct_point_2; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -50,7 +50,7 @@ public: // : base(p, q) {} Iso_rectangleC2(const Point_2 &p, const Point_2 &q, int) - : base(p, q) + : base(CGALi::make_array(p, q)) { // I have to remove the assertions, because of Cartesian_converter. // CGAL_kernel_assertion(p<=q); @@ -58,11 +58,11 @@ public: const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { - return get(base).e0; + return get(base)[0]; } const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const { - return get(base).e1; + return get(base)[1]; } }; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h index 9b3626ba301..9cc5071500c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_RAY_2_H #define CGAL_CARTESIAN_RAY_2_H -#include +#include CGAL_BEGIN_NAMESPACE @@ -35,7 +35,7 @@ class RayC2 typedef typename R_::Point_2 Point_2; typedef typename R_::Ray_2 Ray_2; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -47,20 +47,20 @@ public: {} RayC2(const Point_2 &sp, const Point_2 &secondp) - : base(sp, secondp) + : base(CGALi::make_array(sp, secondp)) {} const Point_2& source() const { - return get(base).e0; + return get(base)[0]; } const Point_2 & second_point() const { - return get(base).e1; + return get(base)[1]; } typename R_::Bool_type is_degenerate() const diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h index 9d41000278b..25d592c608b 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_RAY_3_H #define CGAL_CARTESIAN_RAY_3_H -#include +#include #include CGAL_BEGIN_NAMESPACE @@ -39,7 +39,7 @@ class RayC3 typedef typename R_::Line_3 Line_3; typedef typename R_::Ray_3 Ray_3; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -50,27 +50,27 @@ public: RayC3() {} RayC3(const Point_3 &sp, const Point_3 &secondp) - : base(sp, secondp) {} + : base(CGALi::make_array(sp, secondp)) {} RayC3(const Point_3 &sp, const Vector_3 &v) - : base(sp, sp + v) {} + : base(CGALi::make_array(sp, sp + v)) {} RayC3(const Point_3 &sp, const Direction_3 &d) - : base(sp, sp + d.to_vector()) {} + : base(CGALi::make_array(sp, sp + d.to_vector())) {} RayC3(const Point_3 &sp, const Line_3 &l) - : base(sp, sp + l.to_vector()) {} + : base(CGALi::make_array(sp, sp + l.to_vector())) {} typename R::Bool_type operator==(const RayC3 &r) const; typename R::Bool_type operator!=(const RayC3 &r) const; const Point_3 & source() const { - return get(base).e0; + return get(base)[0]; } const Point_3 & second_point() const { - return get(base).e1; + return get(base)[1]; } Point_3 point(int i) const; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h index 50fdac8f98e..d8d39100bfe 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_SEGMENT_2_H #define CGAL_CARTESIAN_SEGMENT_2_H -#include +#include #include CGAL_BEGIN_NAMESPACE @@ -34,7 +34,7 @@ class SegmentC2 typedef typename R_::Point_2 Point_2; typedef typename R_::Segment_2 Segment_2; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -46,19 +46,19 @@ public: {} SegmentC2(const Point_2 &sp, const Point_2 &ep) - : base(sp, ep) + : base(CGALi::make_array(sp, ep)) {} const Point_2 & source() const { - return get(base).e0; + return get(base)[0]; } const Point_2 & target() const { - return get(base).e1; + return get(base)[1]; } }; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h index c136e08c598..3f12644e5a6 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_CARTESIAN_SEGMENT_3_H #define CGAL_CARTESIAN_SEGMENT_3_H -#include +#include #include CGAL_BEGIN_NAMESPACE @@ -38,7 +38,7 @@ class SegmentC3 typedef typename R_::Line_3 Line_3; typedef typename R_::Segment_3 Segment_3; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -49,7 +49,7 @@ public: SegmentC3() {} SegmentC3(const Point_3 &sp, const Point_3 &ep) - : base(sp, ep) {} + : base(CGALi::make_array(sp, ep)) {} bool has_on(const Point_3 &p) const; bool collinear_has_on(const Point_3 &p) const; @@ -59,11 +59,11 @@ public: const Point_3 & source() const { - return get(base).e0; + return get(base)[0]; } const Point_3 & target() const { - return get(base).e1; + return get(base)[1]; } const Point_3 & start() const; diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h index 971b7f58347..70946dcdd98 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_CUBOIDH3_H #define CGAL_ISO_CUBOIDH3_H -#include +#include CGAL_BEGIN_NAMESPACE @@ -36,7 +36,7 @@ class Iso_cuboidH3 typedef typename R_::Point_3 Point_3; typedef typename R_::Aff_transformation_3 Aff_transformation_3; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -47,7 +47,7 @@ public: Iso_cuboidH3() {} Iso_cuboidH3(const Point_3& p, const Point_3& q, int) - : base(p, q) + : base(CGALi::make_array(p, q)) { CGAL_kernel_assertion(p.x()<=q.x()); CGAL_kernel_assertion(p.y()<=q.y()); @@ -145,8 +145,8 @@ Iso_cuboidH3(const typename Iso_cuboidH3::Point_3& p, minz = q.hz()*p.hw(); maxz = p.hz()*q.hw(); } - base = Rep(Point_3(minx, miny, minz, minw), - Point_3(maxx, maxy, maxz, maxw)); + base = Rep(CGALi::make_array(Point_3(minx, miny, minz, minw), + Point_3(maxx, maxy, maxz, maxw))); } template < class R > @@ -158,14 +158,14 @@ Iso_cuboidH3(const typename Iso_cuboidH3::Point_3& left, const typename Iso_cuboidH3::Point_3& top, const typename Iso_cuboidH3::Point_3& far_, const typename Iso_cuboidH3::Point_3& close) - : base(Point_3(left.hx() * bottom.hw() * far_.hw(), - bottom.hy() * left.hw() * far_.hw(), - far_.hz() * left.hw() * bottom.hw(), - left.hw() * bottom.hw() * far_.hw()), - Point_3(right.hx() * top.hw() * close.hw(), - top.hy() * right.hw() * close.hw(), - close.hz() * right.hw() * top.hw(), - right.hw() * top.hw() * close.hw())) + : base(CGALi::make_array(Point_3(left.hx() * bottom.hw() * far_.hw(), + bottom.hy() * left.hw() * far_.hw(), + far_.hz() * left.hw() * bottom.hw(), + left.hw() * bottom.hw() * far_.hw()), + Point_3(right.hx() * top.hw() * close.hw(), + top.hy() * right.hw() * close.hw(), + close.hz() * right.hw() * top.hw(), + right.hw() * top.hw() * close.hw()))) { CGAL_kernel_precondition(!less_x(right, left)); CGAL_kernel_precondition(!less_y(top, bottom)); @@ -177,8 +177,8 @@ CGAL_KERNEL_LARGE_INLINE Iso_cuboidH3:: Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, const RT& max_hx, const RT& max_hy, const RT& max_hz) - : base(Point_3(min_hx, min_hy, min_hz, RT(1)), - Point_3(max_hx, max_hy, max_hz, RT(1))) + : base(CGALi::make_array(Point_3(min_hx, min_hy, min_hz, RT(1)), + Point_3(max_hx, max_hy, max_hz, RT(1)))) {} template < class R > @@ -187,8 +187,8 @@ Iso_cuboidH3:: Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, const RT& max_hx, const RT& max_hy, const RT& max_hz, const RT& hw) - : base(Point_3(min_hx, min_hy, min_hz, hw), - Point_3(max_hx, max_hy, max_hz, hw)) + : base(CGALi::make_array(Point_3(min_hx, min_hy, min_hz, hw), + Point_3(max_hx, max_hy, max_hz, hw))) {} template < class R > @@ -209,13 +209,13 @@ template < class R > inline const typename Iso_cuboidH3::Point_3 & Iso_cuboidH3::min BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ return get(base).e0; } +{ return get(base)[0]; } template < class R > inline const typename Iso_cuboidH3::Point_3 & Iso_cuboidH3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ return get(base).e1; } +{ return get(base)[1]; } template < class R > inline diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h index 3db61ff7e0b..a56b6784503 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_RECTANGLEH2_H #define CGAL_ISO_RECTANGLEH2_H -#include +#include CGAL_BEGIN_NAMESPACE @@ -36,7 +36,7 @@ class Iso_rectangleH2 typedef typename R_::Point_2 Point_2; typedef typename R_::Iso_rectangle_2 Iso_rectangle_2; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -49,7 +49,7 @@ public: Iso_rectangleH2() {} Iso_rectangleH2(const Point_2& p, const Point_2& q, int) - : base(p, q) + : base(CGALi::make_array(p, q)) { // I have to remove the assertions, because of Homogeneous_converter. // CGAL_kernel_assertion(p.x()<=q.x()); @@ -68,13 +68,13 @@ template < class R > inline const typename Iso_rectangleH2::Point_2 & Iso_rectangleH2::min BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ return get(base).e0; } +{ return get(base)[0]; } template < class R > inline const typename Iso_rectangleH2::Point_2 & Iso_rectangleH2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ return get(base).e1; } +{ return get(base)[1]; } template < class R > CGAL_KERNEL_INLINE diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH2.h index fc903d00c04..302ab00982a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH2.h @@ -21,11 +21,10 @@ // // Author(s) : Stefan Schirra - #ifndef CGAL_RAYH2_H #define CGAL_RAYH2_H -#include +#include CGAL_BEGIN_NAMESPACE @@ -39,7 +38,7 @@ class RayH2 typedef typename R_::Line_2 Line_2; typedef typename R_::Vector_2 Vector_2; - typedef Twotuple Rep; + typedef boost::array Rep; typedef typename R_::template Handle::type Base; Base base; @@ -50,16 +49,16 @@ public: RayH2() {} RayH2( const Point_2& sp, const Point_2& secondp) - : base(sp, secondp) {} + : base(CGALi::make_array(sp, secondp)) {} RayH2( const Point_2& sp, const Direction_2& d) - : base(sp, sp + d.to_vector()) {} + : base(CGALi::make_array(sp, sp + d.to_vector())) {} RayH2( const Point_2& sp, const Vector_2& v) - : base(sp, sp + v) {} + : base(CGALi::make_array(sp, sp + v)) {} RayH2( const Point_2& sp, const Line_2& l) - : base(sp, sp + l.to_vector()) {} + : base(CGALi::make_array(sp, sp + l.to_vector())) {} bool operator==(const RayH2& r) const; bool operator!=(const RayH2& r) const; @@ -86,7 +85,7 @@ template < class R > inline const typename RayH2::Point_2 & RayH2::source() const -{ return get(base).e0; } +{ return get(base)[0]; } template < class R > inline @@ -118,7 +117,7 @@ const typename RayH2::Point_2 & RayH2::second_point() const { CGAL_kernel_precondition( !is_degenerate() ); - return get(base).e1; + return get(base)[1]; } template < class R > @@ -175,7 +174,7 @@ template < class R > CGAL_KERNEL_INLINE bool RayH2::is_degenerate() const -{ return start() == get(base).e1; } +{ return start() == get(base)[1]; } template < class R > inline