From ea50fb811d5e5f01856847d353668136a0db5176 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 6 Apr 2016 12:30:35 +0200 Subject: [PATCH] Cleanup. The 2D and 3D triangulation testsuite pass --- .../include/CGAL/Cartesian/Weighted_point_2.h | 55 +++++------ .../include/CGAL/Cartesian/Weighted_point_3.h | 65 ++++++------- .../include/CGAL/Cartesian/function_objects.h | 29 +++++- .../include/CGAL/predicates/kernel_ftC2.h | 1 + .../include/CGAL/squared_distance_3_0.h | 29 ++++++ .../CGAL/Homogeneous/Weighted_point_3.h | 56 ++++++------ .../CGAL/Homogeneous/function_objects.h | 23 ++++- .../include/CGAL/Kernel/function_objects.h | 6 +- Kernel_23/include/CGAL/Weighted_point_2.h | 61 ++++++++----- Kernel_23/include/CGAL/Weighted_point_3.h | 91 +++++++++++-------- .../CGAL/_test_cls_regular_triangulation_2.h | 4 + .../test_regular_triangulation_2.cpp | 19 +++- .../examples/Triangulation_3/regular_3.cpp | 2 +- .../include/CGAL/Triangulation_3.h | 2 +- .../include/CGAL/_test_cls_delaunay_3.h | 17 ++-- 15 files changed, 282 insertions(+), 178 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h index 0d037a3caae..a9d58313a10 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h @@ -23,36 +23,34 @@ #define CGAL_CARTESIAN_WEIGHTED_POINT_2_H #include -#include -#include -#include -#include -#include -#include -#include +#include namespace CGAL { template < class R_ > -class Weighted_pointC2 : public R_::Point_2 +class Weighted_pointC2 { + typedef typename R_::Point_2 Point_2; typedef typename R_::FT FT; + typedef typename R_::FT Weight; + typedef boost::tuple Rep; + typedef typename R_::template Handle::type Base; + + Base base; + public: - typedef FT Weight; - typedef typename R_::Point_2 Point; Weighted_pointC2 () - : Point(), _weight(0) {} + {} //explicit - Weighted_pointC2 (const Point &p) - : Point(p), _weight(0) - { - // CGAL_error_msg( "Warning : truncated weight !!!"); - } + Weighted_pointC2 (const Point_2 &p) + : base(p,0) + {} - Weighted_pointC2 (const Point &p, const Weight &w) - : Point(p), _weight(w) {} + Weighted_pointC2 (const Point_2 &p, const Weight &w) + : base(p,w) + {} // Constructors from coordinates are also provided for convenience, except @@ -60,29 +58,22 @@ public: // to avoid any potential ambiguity between the homogeneous weight and the // power weight (it should be easy enough to pass a Point explicitly in those // cases). - // The enable_if complexity comes from the fact that we separate dimension 2 and 3. + Weighted_pointC2(const FT& x, const FT& y) + : base(Point_2(x,y),0) + {} - template < typename Tx, typename Ty> - Weighted_pointC2 (const Tx &x, const Ty &y, - typename boost::enable_if< boost::mpl::and_, - boost::is_convertible, - boost::mpl::bool_::value == 2> > >::type* = 0) - : Point(x, y), _weight(0) {} - - const Point & point() const + const Point_2 & point() const { - return *this; + return get_pointee_or_identity(base).template get<0>(); } const Weight & weight() const { - return _weight; + return get_pointee_or_identity(base).template get<1>(); } - -private: - Weight _weight; + }; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_3.h index 6c98681faac..349626ea3cb 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_3.h @@ -23,68 +23,61 @@ #define CGAL_CARTESIAN_WEIGHTED_POINT_3_H #include -#include -#include -#include -#include -#include -#include -#include +#include namespace CGAL { template < class R_ > -class Weighted_pointC3 : public R_::Point_3 +class Weighted_pointC3 { + typedef typename R_::Point_3 Point_3; + typedef typename R_::FT FT; - typedef typename R_::RT RT; + typedef FT Weight; + typedef boost::tuple Rep; + typedef typename R_::template Handle::type Base; + + Base base; + public: - typedef RT Weight; - typedef typename R_::Point_3 Point; + + Weighted_pointC3 () - : Point(), _weight(0) {} + {} //explicit - Weighted_pointC3 (const Point &p) - : Point(p), _weight(0) - { - // CGAL_error_msg( "Warning : truncated weight !!!"); - } + Weighted_pointC3 (const Point_3 &p) + : base(p,0) + {} - Weighted_pointC3 (const Point &p, const Weight &w) - : Point(p), _weight(w) {} + Weighted_pointC3 (const Point_3 &p, const Weight &w) + : base(p,w) + {} // Constructors from coordinates are also provided for convenience, except // that they are only from Cartesian coordinates, and with no weight, so as // to avoid any potential ambiguity between the homogeneous weight and the - // power weight (it should be easy enough to pass a Point explicitly in those + // power weight (it should be easy enough to pass a Point_3 explicitly in those // cases). - // The enable_if complexity comes from the fact that we separate dimension 2 and 3. - template < typename Tx, typename Ty, typename Tz > - Weighted_pointC3 (const Tx &x, const Ty &y, const Tz &z, - typename boost::enable_if< boost::mpl::and_, - boost::is_convertible, - boost::is_convertible, - boost::mpl::bool_::value == 3> > >::type* = 0) - : Point(x, y, z), _weight(0) {} - const Point & point() const + Weighted_pointC3 (const FT &x, const FT &y, const FT &z) + : base(Point_3(x, y, z), 0) + {} + + const Point_3 & point() const { - return *this; + return get_pointee_or_identity(base).template get<0>(); } const Weight & weight() const { - return _weight; + return get_pointee_or_identity(base).template get<1>(); } - -private: - Weight _weight; }; @@ -101,7 +94,7 @@ operator<<(std::ostream &os, const Weighted_pointC3 &p) write(os, p.weight()); return os; default: - return os << "Weighted_point(" << p.point() << ", " << p.weight() << ")"; + return os << "Weighted_point_3(" << p.point() << ", " << p.weight() << ")"; } } @@ -110,7 +103,7 @@ std::istream & operator>>(std::istream &is, Weighted_pointC3 &wp) { typename Weighted_pointC3::Weight w; - typename Weighted_pointC3::Point p; + typename Weighted_pointC3::Point_3 p; is >> p; if(!is) return is; if(is_ascii(is)) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 469dcdf0d9a..b01a5395474 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -2921,7 +2921,16 @@ namespace CartesianKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; public: - typedef Point_2 result_type; + + template + struct result { + typedef Point_2 type; + }; + + template + struct result { + typedef const Point_2& type; + }; Rep // Point_2 operator()(Return_base_tag, Origin o) const @@ -2977,8 +2986,19 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Point_3::Rep Rep; + public: - typedef Point_3 result_type; + + template + struct result { + typedef Point_3 type; + }; + + template + struct result { + typedef const Point_3& type; + }; + Rep // Point_3 operator()(Return_base_tag, Origin o) const @@ -3033,6 +3053,7 @@ namespace CartesianKernelFunctors { class Construct_weighted_point_3 { typedef typename K::RT RT; + typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Weighted_point_3::Rep Rep; @@ -3044,7 +3065,7 @@ namespace CartesianKernelFunctors { { return Rep(p,w); } Rep - operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const + operator()(Return_base_tag, const FT& x, const FT& y, const FT& z) const { return Rep(x,y,z); } }; @@ -4115,7 +4136,7 @@ public: { //CGAL_kernel_precondition( collinear(p, q, r) ); //CGAL_kernel_precondition( p.point() != q.point() ); - return power_testC2(p.x(), p.y(), p.weight(), + return power_testC2(p.point().x(), p.y(), p.weight(), q.x(), q.y(), q.weight(), t.x(), t.y(), t.weight()); } diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 572516375a7..9c559839410 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -681,6 +681,7 @@ power_testC2( const FT &px, const FT &py, const FT &pwt, const FT &qx, const FT &qy, const FT &qwt, const FT &tx, const FT &ty, const FT &twt) { + std::cerr << px << " " << py << " " << pwt << std::endl; // Same translation as above. FT dpx = px - tx; FT dpy = py - ty; diff --git a/Distance_3/include/CGAL/squared_distance_3_0.h b/Distance_3/include/CGAL/squared_distance_3_0.h index 5227036000e..6bdbda97f68 100644 --- a/Distance_3/include/CGAL/squared_distance_3_0.h +++ b/Distance_3/include/CGAL/squared_distance_3_0.h @@ -307,6 +307,35 @@ squared_distance(const Point_3 & pt1, } +template +inline +typename K::FT +squared_distance(const Weighted_point_3 & pt1, + const Weighted_point_3 & pt2) +{ + return internal::squared_distance(pt1.point(),pt2.point(), K()); +} + +template +inline +typename K::FT +squared_distance(const Weighted_point_3 & pt1, + const Point_3 & pt2) +{ + return internal::squared_distance(pt1.point(),pt2, K()); +} + +template +inline +typename K::FT +squared_distance(const Point_3 & pt1, + const Weighted_point_3 & pt2) +{ + return internal::squared_distance(pt1,pt2.point(), K()); +} + + + template inline typename K::FT diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_3.h index 25718c369b4..bb4f6466dd5 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_3.h @@ -34,60 +34,58 @@ namespace CGAL { template < class R_ > -class Weighted_pointH3 : public R_::Point_3 +class Weighted_pointH3 { - typedef typename R_::RT RT; + typedef typename R_::Point_3 Point_3; + typedef typename R_::FT FT; + typedef FT Weight; + typedef boost::tuple Rep; + typedef typename R_::template Handle::type Base; + + Base base; + public: - typedef RT Weight; - typedef typename R_::Point_3 Point; + + Weighted_pointH3 () - : Point(), _weight(0) {} + {} //explicit - Weighted_pointH3 (const Point &p) - : Point(p), _weight(0) - { - // CGAL_error_msg( "Warning : truncated weight !!!"); - } + Weighted_pointH3 (const Point_3 &p) + : base(p,0) + {} - Weighted_pointH3 (const Point &p, const Weight &w) - : Point(p), _weight(w) {} + Weighted_pointH3 (const Point_3 &p, const Weight &w) + : base(p,w) + {} // Constructors from coordinates are also provided for convenience, except - // that they are only from Homogeneous coordinates, and with no weight, so as + // that they are only from Cartesian coordinates, and with no weight, so as // to avoid any potential ambiguity between the homogeneous weight and the - // power weight (it should be easy enough to pass a Point explicitly in those + // power weight (it should be easy enough to pass a Point_3 explicitly in those // cases). - // The enable_if complexity comes from the fact that we separate dimension 2 and 3. - template < typename Tx, typename Ty, typename Tz > - Weighted_pointH3 (const Tx &x, const Ty &y, const Tz &z, - typename boost::enable_if< boost::mpl::and_, - boost::is_convertible, - boost::is_convertible, - boost::mpl::bool_::value == 3> > >::type* = 0) - : Point(x, y, z), _weight(0) {} - const Point & point() const + Weighted_pointH3 (const FT &x, const FT &y, const FT &z) + : base(Point_3(x, y, z), 0) + {} + + const Point_3 & point() const { - return *this; + return get_pointee_or_identity(base).template get<0>(); } const Weight & weight() const { - return _weight; + return get_pointee_or_identity(base).template get<1>(); } - -private: - Weight _weight; }; - template < class R_ > std::ostream & operator<<(std::ostream &os, const Weighted_pointH3 &p) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index 56dcb7dbf12..e0e71b78b23 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -3054,7 +3054,16 @@ namespace HomogeneousKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; public: - typedef Point_2 result_type; + + template + struct result { + typedef Point_2 type; + }; + + template + struct result { + typedef const Point_2& type; + }; Rep // Point_2 operator()(Return_base_tag, Origin o) const @@ -3117,8 +3126,18 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Point_3::Rep Rep; + public: - typedef Point_3 result_type; + + template + struct result { + typedef Point_3 type; + }; + + template + struct result { + typedef const Point_3& type; + }; Rep // Point_3 operator()(Return_base_tag, Origin o) const diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 9a682895a78..7d3cc29a974 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -479,7 +479,7 @@ class Compute_weight_2 { public: typedef typename K::Weighted_point_2 Weighted_point_2; - typedef typename Weighted_point_2::Weight Weight; + typedef typename K::FT Weight; typedef const Weight& result_type; @@ -496,7 +496,7 @@ class Compute_weight_3 { public: typedef typename K::Weighted_point_3 Weighted_point_3; - typedef typename Weighted_point_3::Weight Weight; + typedef typename K::FT Weight; typedef const Weight& result_type; @@ -3464,7 +3464,7 @@ public: const Weighted_point_2 & q, const Weighted_point_2 & r) const { - CGAL_kernel_precondition( ! collinear(p, q, r) ); + CGAL_kernel_precondition( ! collinear(p.point(), q.point(), r.point()) ); FT x,y; weighted_circumcenterC2(p.x(),p.y(),p.weight(), q.x(),q.y(),q.weight(), diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index 82169fdc90c..ff5f5bd3388 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -91,14 +91,8 @@ public: Weighted_point_2(const FT& x, const FT& y) : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y)) {} - - /* - template < typename T1, typename T2> - Weighted_point_2(const T1& x, const T2& y) - : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y)) - {} - */ - typename cpp11::result_of::type + + typename cpp11::result_of::type point() const { return typename R::Construct_point_2()(*this); @@ -111,37 +105,37 @@ public: } - typename cpp11::result_of::type + typename cpp11::result_of::type x() const { - return typename R::Compute_x_2()(*this); + return typename R::Compute_x_2()(point()); } - typename cpp11::result_of::type + typename cpp11::result_of::type y() const { - return typename R::Compute_y_2()(*this); + return typename R::Compute_y_2()(point()); } - typename cpp11::result_of::type + typename cpp11::result_of::type hx() const { - return R().compute_hx_2_object()(*this); + return R().compute_hx_2_object()(point()); } - typename cpp11::result_of::type + typename cpp11::result_of::type hy() const { - return R().compute_hy_2_object()(*this); + return R().compute_hy_2_object()(point()); } - typename cpp11::result_of::type + typename cpp11::result_of::type hw() const { - return R().compute_hw_2_object()(*this); + return R().compute_hw_2_object()(point()); } - typename cpp11::result_of::type + typename cpp11::result_of::type cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); @@ -158,7 +152,7 @@ public: return hz(); } - typename cpp11::result_of::type + typename cpp11::result_of::type operator[](int i) const { return cartesian(i); @@ -166,12 +160,12 @@ public: Cartesian_const_iterator cartesian_begin() const { - return typename R::Construct_cartesian_const_iterator_2()(*this); + return typename R::Construct_cartesian_const_iterator_2()(point()); } Cartesian_const_iterator cartesian_end() const { - return typename R::Construct_cartesian_const_iterator_2()(*this,3); + return typename R::Construct_cartesian_const_iterator_2()(point(),3); } int dimension() const @@ -181,12 +175,12 @@ public: Bbox_2 bbox() const { - return R().construct_bbox_2_object()(*this); + return R().construct_bbox_2_object()(point()); } Weighted_point_2 transform(const Aff_transformation_2 &t) const { - return t.transform(*this); + return Weighted_point_2(t.transform(point(),weight())); } }; @@ -204,6 +198,25 @@ operator!=(const Origin& o, const Weighted_point_2& p) { return p != o; } +template +inline +bool +operator==(const Point_2& bp, const Weighted_point_2& p) +{ return bp == p.point(); } + +template +inline +bool +operator==(const Weighted_point_2& p, const Point_2& bp) +{ return bp == p.point(); } + +template +inline +bool +operator==(const Weighted_point_2& p, const Weighted_point_2& p2) +{ return p.point() == p2.point(); } + + template inline bool diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index f4edaa4ea3b..43a26dae68c 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -39,6 +39,7 @@ template class Weighted_point_3 : public R_::Kernel_base::Weighted_point_3 { typedef typename R_::RT RT; + typedef typename R_::FT FT; typedef Weighted_point_3 Self; CGAL_static_assertion((boost::is_same::value)); @@ -55,7 +56,7 @@ public: typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Point_3 Point; - typedef RT Weight; + typedef FT Weight; const Rep& rep() const { @@ -82,23 +83,13 @@ public: : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, 0)) {} - template - Weighted_point_3(const Point_3& p, const T2& w) + + Weighted_point_3(const Point_3& p, const Weight& w) : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, w)) {} - /* - template < typename T1, typename T2> - Weighted_point_3(const T1& x, const T2& y) - : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y)) - {} - */ - template < typename T1, typename T2, typename T3 > - Weighted_point_3(const T1& x, const T2& y, const T3& z) - : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z)) - {} - Weighted_point_3(const RT& hx, const RT& hy, const RT& hz, const RT& hw) - : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), hx, hy, hz, hw)) + Weighted_point_3(const FT& x, const FT& y, const FT& z) + : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z)) {} typename cpp11::result_of::type @@ -117,43 +108,43 @@ public: typename cpp11::result_of::type x() const { - return typename R::Compute_x_3()(*this); + return typename R::Compute_x_3()(point()); } typename cpp11::result_of::type y() const { - return typename R::Compute_y_3()(*this); + return typename R::Compute_y_3()(point()); } typename cpp11::result_of::type z() const { - return typename R::Compute_z_3()(*this); + return typename R::Compute_z_3()(point()); } typename cpp11::result_of::type hx() const { - return R().compute_hx_3_object()(*this); + return R().compute_hx_3_object()(point()); } typename cpp11::result_of::type hy() const { - return R().compute_hy_3_object()(*this); + return R().compute_hy_3_object()(point()); } typename cpp11::result_of::type hz() const { - return R().compute_hz_3_object()(*this); + return R().compute_hz_3_object()(point()); } typename cpp11::result_of::type hw() const { - return R().compute_hw_3_object()(*this); + return R().compute_hw_3_object()(point()); } typename cpp11::result_of::type @@ -183,12 +174,12 @@ public: Cartesian_const_iterator cartesian_begin() const { - return typename R::Construct_cartesian_const_iterator_3()(*this); + return typename R::Construct_cartesian_const_iterator_3()(point()); } Cartesian_const_iterator cartesian_end() const { - return typename R::Construct_cartesian_const_iterator_3()(*this,3); + return typename R::Construct_cartesian_const_iterator_3()(point(),3); } int dimension() const @@ -198,12 +189,12 @@ public: Bbox_3 bbox() const { - return R().construct_bbox_3_object()(*this); + return R().construct_bbox_3_object()(point()); } Weighted_point_3 transform(const Aff_transformation_3 &t) const { - return t.transform(*this); + return Weighted_point_3(t.transform(point(),weight())); } }; @@ -220,6 +211,24 @@ bool operator!=(const Origin& o, const Weighted_point_3& p) { return p != o; } +template +inline +bool +operator==(const Point_3& bp, const Weighted_point_3& p) +{ return bp == p.point(); } + +template +inline +bool +operator==(const Weighted_point_3& p, const Point_3& bp) +{ return bp == p.point(); } + +template +inline +bool +operator==(const Weighted_point_3& p, const Weighted_point_3& p2) +{ return p.point() == p2.point(); } + template inline @@ -234,15 +243,16 @@ insert(std::ostream& os, const Weighted_point_3& p,const Cartesian_tag&) { switch(get_mode(os)) { case IO::ASCII : - return os << p.x() << ' ' << p.y() << ' ' << p.z(); + return os << p.point() << ' ' << p.weight(); case IO::BINARY : write(os, p.x()); write(os, p.y()); write(os, p.z()); + write(os, p.weight()); return os; default: - return os << "PointC3(" << p.x() << ", " << p.y() - << ", " << p.z() << ')'; + return os << "Weighted_pointC3(" << p.x() << ", " << p.y() + << ", " << p.z() << p.weight() << ')'; } } @@ -253,18 +263,20 @@ insert(std::ostream& os, const Weighted_point_3& p,const Homogeneous_tag&) switch(get_mode(os)) { case IO::ASCII : - return os << p.hx() << ' ' << p.hy() << ' ' << p.hz() << ' ' << p.hw(); + return os << p.hx() << ' ' << p.hy() << ' ' << p.hz() << ' ' << p.hw() << ' ' << p.weight(); case IO::BINARY : write(os, p.hx()); write(os, p.hy()); write(os, p.hz()); - write(os, p.hw()); + write(os, p.hw()) +; write(os, p.weight()); return os; default: - return os << "PointH3(" << p.hx() << ", " + return os << "Weighted_pointH3(" << p.hx() << ", " << p.hy() << ", " << p.hz() << ", " - << p.hw() << ')'; + << p.hw() << ", " + << p.weight() << ')'; } } @@ -280,15 +292,16 @@ template std::istream& extract(std::istream& is, Weighted_point_3& p, const Cartesian_tag&) { - typename R::FT x, y, z; + typename R::FT x, y, z, weight; switch(get_mode(is)) { case IO::ASCII : - is >> iformat(x) >> iformat(y) >> iformat(z); + is >> iformat(x) >> iformat(y) >> iformat(z) >> iformat(weight); break; case IO::BINARY : read(is, x); read(is, y); read(is, z); + read(is, weight); break; default: std::cerr << "" << std::endl; @@ -296,7 +309,7 @@ extract(std::istream& is, Weighted_point_3& p, const Cartesian_tag&) break; } if (is) - p = Weighted_point_3(x, y, z); + p = Weighted_point_3(Point_3(x, y,z), z); return is; } @@ -306,16 +319,18 @@ std::istream& extract(std::istream& is, Weighted_point_3& p, const Homogeneous_tag&) { typename R::RT hx, hy, hz, hw; + typename R::FT weight; switch(get_mode(is)) { case IO::ASCII : - is >> hx >> hy >> hz >> hw; + is >> hx >> hy >> hz >> hw >> weight; break; case IO::BINARY : read(is, hx); read(is, hy); read(is, hz); read(is, hw); + read(is, weight); break; default: std::cerr << "" << std::endl; @@ -323,7 +338,7 @@ extract(std::istream& is, Weighted_point_3& p, const Homogeneous_tag&) break; } if (is) - p = Weighted_point_3(hx, hy, hz, hw); + p = Weighted_point_3(Point_3(hx, hy, hz), hw); return is; } diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_regular_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_regular_triangulation_2.h index 8710cb36eff..b831b1e145b 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_regular_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_regular_triangulation_2.h @@ -157,6 +157,10 @@ _test_cls_regular_triangulation_2( const Triangulation & ) } Cls T; + + std::cerr << wp1 << " " << wp1.x() << std::endl; + std::cerr << wp2 << std::endl; + std::cerr << wp3 << std::endl; assert(T.power_test(wp1,wp2,wp3) == CGAL::ON_NEGATIVE_SIDE); assert(T.power_test(wp1,wp8,wp2) == CGAL::ON_POSITIVE_SIDE); assert(T.power_test(wp2,wp8,wp9) == CGAL::ON_NEGATIVE_SIDE); diff --git a/Triangulation_2/test/Triangulation_2/test_regular_triangulation_2.cpp b/Triangulation_2/test/Triangulation_2/test_regular_triangulation_2.cpp index 27cc76a3bb2..24ae4ccdca7 100644 --- a/Triangulation_2/test/Triangulation_2/test_regular_triangulation_2.cpp +++ b/Triangulation_2/test/Triangulation_2/test_regular_triangulation_2.cpp @@ -27,10 +27,24 @@ #include #include -#include +#include + +#if 0 +typedef CGAL::Simple_cartesian > K; + +int main() +{ + K::Weighted_point_2 wp(K::Point_2(7.8, 1),2); + std::cout << wp << std::endl; + std::cout << wp.x() << std::endl; + std::cout << K::Compute_x_2()(wp.point()) << std::endl; + return 0; +} + +#else typedef CGAL::Regular_triangulation_euclidean_traits_2 - RGt; + RGt; // Explicit instantiation of the whole class : template class CGAL::Regular_triangulation_2; @@ -57,3 +71,4 @@ int main() std::cout << "done" << std::endl; return 0; } +#endif diff --git a/Triangulation_3/examples/Triangulation_3/regular_3.cpp b/Triangulation_3/examples/Triangulation_3/regular_3.cpp index e75adb2a380..2b069739a58 100644 --- a/Triangulation_3/examples/Triangulation_3/regular_3.cpp +++ b/Triangulation_3/examples/Triangulation_3/regular_3.cpp @@ -8,7 +8,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; -typedef Traits::RT Weight; +typedef Traits::FT Weight; typedef Traits::Bare_point Point; typedef Traits::Weighted_point Weighted_point; diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index b56c13eeb47..64d3c848803 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -6135,7 +6135,7 @@ _remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &rem mp_vps[vv->point()] = vv; } else inf = true; } - spatial_sort(vps.begin(), vps.end()); + spatial_sort(vps.begin(), vps.end(),geom_traits()); std::size_t svps = vps.size(); diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h index 52d94fd8ec0..04ed10cce69 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h @@ -35,6 +35,7 @@ #include #include + // Accessory set of functions to differentiate between // Delaunay::nearest_vertex[_in_cell] and // Regular::nearest_power_vertex[_in_cell]. @@ -671,22 +672,26 @@ _test_cls_delaunay_3(const Triangulation &) Vertex_handle v = nearest_vertex(T3_13, p); for (typename Cls::Finite_vertices_iterator fvit = T3_13.finite_vertices_begin(); - fvit != T3_13.finite_vertices_end(); ++fvit) - assert(CGAL::squared_distance(p, v->point()) <= - CGAL::squared_distance(p, fvit->point())); - Vertex_handle v1 = nearest_vertex_in_cell(T3_13, p, c1); + fvit != T3_13.finite_vertices_end(); ++fvit){ + + assert(CGAL::squared_distance(p, + v->point()) <= + CGAL::squared_distance(p, fvit->point())); + } + Vertex_handle v1 = nearest_vertex_in_cell(T3_13, p, c1) +; int i1 = c1->index(v1); for(int i=0; i<4; ++i) { if (i != i1) assert(CGAL::squared_distance(p, v1->point()) <= - CGAL::squared_distance(p, c1->vertex(i)->point())); + CGAL::squared_distance(p, c1->vertex(i)->point())); } Vertex_handle v2 = nearest_vertex_in_cell(T3_13, p, c2); int i2 = c2->index(v2); for(int i=0; i<4; ++i) { if (i != i2 && c2->vertex(i) != T3_13.infinite_vertex()) assert(CGAL::squared_distance(p, v2->point()) <= - CGAL::squared_distance(p, c2->vertex(i)->point())); + CGAL::squared_distance(p, c2->vertex(i)->point())); } } }