From 110d91c0776303eafaa3cef12aa5b377751dc28c Mon Sep 17 00:00:00 2001 From: Mariette Yvinec Date: Wed, 1 Sep 1999 14:37:41 +0000 Subject: [PATCH] changes made in Dagstuhl to comply to MSVC++ includes : include codes of operators * and -> in class definition of Tds iterators Change the power_test Change names for representation in traits --- ...Regular_triangulation_euclidean_traits_2.h | 153 ++++++++++++++---- .../Triangulation_default_data_structure_2.h | 8 +- .../include/CGAL/Triangulation_ds_face_2.h | 2 +- .../CGAL/Triangulation_ds_iterators_2.h | 141 +++++++++------- .../include/CGAL/Triangulation_ds_vertex_2.h | 2 +- .../Triangulation_euclidean_traits_xy_3.h | 6 +- .../Triangulation_euclidean_traits_xz_3.h | 6 +- .../Triangulation_euclidean_traits_yz_3.h | 6 +- .../include/CGAL/_test_types.C | 2 +- 9 files changed, 219 insertions(+), 107 deletions(-) diff --git a/Packages/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h b/Packages/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h index 024ae64d7ab..5f63adb1dc7 100644 --- a/Packages/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h +++ b/Packages/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h @@ -75,62 +75,145 @@ public: } }; -#ifdef CGAL_CARTESIAN_H -template < class FT, class Weight > +// #ifdef CGAL_CARTESIAN_H +// template < class FT, class Weight > +// inline +// Oriented_side +// power_test(const Weighted_point >, Weight> &p, +// const Weighted_point >, Weight> &q, +// const Weighted_point >, Weight> &r, +// const Weighted_point >, Weight> &t) +// { +// return power_testC2(p.x(), p.y(), FT(p.weight()), +// q.x(), q.y(), FT(q.weight()), +// r.x(), r.y(), FT(r.weight()), +// t.x(), t.y(), FT(t.weight())); +// } + +// template < class FT, class Weight > +// inline +// Oriented_side +// power_test(const Weighted_point >, Weight> &p, +// const Weighted_point >, Weight> &q, +// const Weighted_point >, Weight> &t) +// { +// return power_testC2(p.x(), p.y(), FT(p.weight()), +// q.x(), q.y(), FT(q.weight()), +// t.x(), t.y(), FT(t.weight())); +// } +// #endif // CGAL_CARTESIAN_H + +// #ifdef CGAL_HOMOGENEOUS_H +// template < class RT, class Weight > +// inline +// Oriented_side +// power_test(const Weighted_point >, Weight> &p, +// const Weighted_point >, Weight> &q, +// const Weighted_point >, Weight> &r, +// const Weighted_point >, Weight> &t) +// { +// return power_testH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), +// q.hx(), q.hy(), q.hw(), RT(q.weight()), +// r.hx(), r.hy(), r.hw(), RT(r.weight()), +// t.hx(), t.hy(), t.hw(), RT(t.weight())); +// } + +// template < class RT, class Weight > +// inline +// Oriented_side +// power_test(const Weighted_point >, Weight> &p, +// const Weighted_point >, Weight> &q, +// const Weighted_point >, Weight> &t) +// { +// return power_testH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), +// q.hx(), q.hy(), q.hw(), RT(q.weight()), +// t.hx(), t.hy(), t.hw(), RT(t.weight())); +// } +// #endif // CGAL_HOMOGENEOUS_H + +template < class Point, class Weight > inline Oriented_side -power_test(const Weighted_point >, Weight> &p, - const Weighted_point >, Weight> &q, - const Weighted_point >, Weight> &r, - const Weighted_point >, Weight> &t) +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &r, + const Weighted_point &t, + Cartesian_tag ) { - return power_testC2(p.x(), p.y(), FT(p.weight()), - q.x(), q.y(), FT(q.weight()), - r.x(), r.y(), FT(r.weight()), - t.x(), t.y(), FT(t.weight())); + typedef typename Point::FT FT; + return power_testC2(p.x(), p.y(), FT(p.weight()), + q.x(), q.y(), FT(q.weight()), + r.x(), r.y(), FT(r.weight()), + t.x(), t.y(), FT(t.weight())); } -template < class FT, class Weight > +template < class Point, class Weight > inline Oriented_side -power_test(const Weighted_point >, Weight> &p, - const Weighted_point >, Weight> &q, - const Weighted_point >, Weight> &t) +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &r, + const Weighted_point &t, + Homogeneous_tag ) { + typedef typename Point::RT RT; + return power_testH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), + q.hx(), q.hy(), q.hw(), RT(q.weight()), + r.hx(), r.hy(), r.hw(), RT(r.weight()), + t.hx(), t.hy(), t.hw(), RT(t.weight())); +} + +template < class Point, class Weight > +inline +Oriented_side +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &r, + const Weighted_point &t) +{ + typedef typename Point::R::Rep_tag Tag; + return power_test(p, q, r, t, Tag()); +} + +template < class Point, class Weight > +inline +Oriented_side +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &t, + Cartesian_tag ) +{ + typedef typename Point::FT FT; return power_testC2(p.x(), p.y(), FT(p.weight()), q.x(), q.y(), FT(q.weight()), t.x(), t.y(), FT(t.weight())); } -#endif // CGAL_CARTESIAN_H -#ifdef CGAL_HOMOGENEOUS_H -template < class RT, class Weight > + +template < class Point, class Weight > inline Oriented_side -power_test(const Weighted_point >, Weight> &p, - const Weighted_point >, Weight> &q, - const Weighted_point >, Weight> &r, - const Weighted_point >, Weight> &t) -{ - return power_testH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), - q.hx(), q.hy(), q.hw(), RT(q.weight()), - r.hx(), r.hy(), r.hw(), RT(r.weight()), - t.hx(), t.hy(), t.hw(), RT(t.weight())); -} - -template < class RT, class Weight > -inline -Oriented_side -power_test(const Weighted_point >, Weight> &p, - const Weighted_point >, Weight> &q, - const Weighted_point >, Weight> &t) +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &t, + Homogeneous_tag ) { + typedef typename Point::RT RT; return power_testH2(p.hx(), p.hy(), p.hw(), RT(p.weight()), q.hx(), q.hy(), q.hw(), RT(q.weight()), t.hx(), t.hy(), t.hw(), RT(t.weight())); } -#endif // CGAL_HOMOGENEOUS_H +template < class Point, class Weight > +inline +Oriented_side +power_test(const Weighted_point &p, + const Weighted_point &q, + const Weighted_point &t) +{ + typedef typename Point::R::Rep_tag Tag; + return power_test(p, q, t, Tag()); +} CGAL_END_NAMESPACE #endif // CGAL_REGULAR_TRIANGULATION_EUCLIDEAN_TRAITS_2_H diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h index 990290ecc52..c19352194af 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h @@ -874,8 +874,8 @@ copy_tds(const Tds &tds, const Vertex* v) if(tds.number_of_vertices() == 0){return static_cast(NULL);} - std::map< const void*, void*, less > V; - std::map< const void*, void*, less > F; + std::map< const void*, void*, std::less > V; + std::map< const void*, void*, std::less > F; Vertex* v2,* v_inf; Face* f2; @@ -1003,8 +1003,8 @@ file_output( std::ostream& os, Vertex* v, bool skip_first) const else os << n << m << dimension(); if (n==0) return; - std::map< void*, int, less > V; - std::map< void*, int, less > F; + std::map< void*, int, std::less > V; + std::map< void*, int, std::less > F; // first vertex int inum = 0; diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h index a456eb38542..9f6e2d5682a 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h @@ -210,7 +210,7 @@ index(const Face* n) const template < class Vb, class Fb > bool Triangulation_ds_face_2:: -is_valid(bool verbose = false, int level = 0) const +is_valid(bool verbose, int level) const { bool result = Fb::is_valid(verbose, level); for(int i = 0; i <= dimension(); i++) { diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_iterators_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_iterators_2.h index a10f04f33f1..20978feab8a 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_iterators_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_iterators_2.h @@ -97,8 +97,19 @@ public: Iterator_base& operator--(); Iterator_base operator++(int); Iterator_base operator--(int); - Face& operator*() const; - Face* operator->() const; + + Face& operator*() const + { + CGAL_triangulation_precondition(pos != NULL); + return const_cast(*pos); + } + + Face* operator->() const + { + CGAL_triangulation_precondition(pos != NULL); + return const_cast(pos); + } + }; @@ -171,9 +182,25 @@ public: Vertex_iterator operator--(int); bool operator==(const Vertex_iterator& fi) const; bool operator!=(const Vertex_iterator& fi) const; - Vertex& operator*() const ; - Vertex* operator->() const ; - + + Vertex& operator*() const + { + CGAL_triangulation_assertion( pos != NULL); + if (pos == (Face*)1) {// only one vertex; + return *(_tds->infinite_vertex()); + } + return *(pos->vertex(index)); + } + + Vertex* operator->() const + { + CGAL_triangulation_assertion( pos != NULL); + if (pos == (Face*)1) {// only one vertex; + return _tds->infinite_vertex(); + } + return pos->vertex(index); + } + private: void increment(); void decrement() ; @@ -220,7 +247,9 @@ public: Edge_iterator& operator--(); Edge_iterator operator++(int); Edge_iterator operator--(int); - Edge operator*() const; + + Edge operator*() const + {return make_pair(const_cast(pos), index);} private: void increment(); @@ -431,25 +460,25 @@ operator--(int) return tmp; } -template -inline -typename Tds::Face& -Triangulation_ds_iterator_base_2 :: -operator*() const -{ - CGAL_triangulation_precondition(pos != NULL); - return const_cast(*pos); -} +// template +// inline +// typename Tds::Face& +// Triangulation_ds_iterator_base_2 :: +// operator*() const +// { +// CGAL_triangulation_precondition(pos != NULL); +// return const_cast(*pos); +// } -template -inline -typename Tds::Face* -Triangulation_ds_iterator_base_2 :: -operator->() const -{ - CGAL_triangulation_precondition(pos != NULL); - return const_cast(pos); -} +// template +// inline +// typename Tds::Face* +// Triangulation_ds_iterator_base_2 :: +// operator->() const +// { +// CGAL_triangulation_precondition(pos != NULL); +// return const_cast(pos); +// } // Face iterator implementation template @@ -626,31 +655,31 @@ operator!=(const Vertex_iterator& fi) const return !(*this == fi); } -template -inline -typename Tds::Vertex& -Triangulation_ds_vertex_iterator_2 :: -operator*() const -{ - CGAL_triangulation_assertion( pos != NULL); - if (pos == (Face*)1) {// only one vertex; - return *(_tds->infinite_vertex()); - } - return *(pos->vertex(index)); -} +// template +// inline +// typename Tds::Vertex& +// Triangulation_ds_vertex_iterator_2 :: +// operator*() const +// { +// CGAL_triangulation_assertion( pos != NULL); +// if (pos == (Face*)1) {// only one vertex; +// return *(_tds->infinite_vertex()); +// } +// return *(pos->vertex(index)); +// } -template -inline -typename Tds::Vertex* -Triangulation_ds_vertex_iterator_2 :: -operator->() const -{ - CGAL_triangulation_assertion( pos != NULL); - if (pos == (Face*)1) {// only one vertex; - return _tds->infinite_vertex(); - } - return pos->vertex(index); -} +// template +// inline +// typename Tds::Vertex* +// Triangulation_ds_vertex_iterator_2 :: +// operator->() const +// { +// CGAL_triangulation_assertion( pos != NULL); +// if (pos == (Face*)1) {// only one vertex; +// return _tds->infinite_vertex(); +// } +// return pos->vertex(index); +// } // Edge iterator implementation @@ -720,7 +749,7 @@ Triangulation_ds_edge_iterator_2 :: associated_edge() { if (_tds->dimension() == 1) {return true;} - return less()(pos, pos->neighbor(index)); + return std::less()(pos, pos->neighbor(index)); } template @@ -773,13 +802,13 @@ operator--(int) return tmp; } -template -typename Tds::Edge -Triangulation_ds_edge_iterator_2 :: -operator*() const -{ - return make_pair(const_cast(pos), index); -} +// template +// typename Tds::Edge +// Triangulation_ds_edge_iterator_2 :: +// operator*() const +// { +// return make_pair(const_cast(pos), index); +// } CGAL_END_NAMESPACE diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_vertex_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_vertex_2.h index 80aed6081c4..92e2cdbb6f6 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_vertex_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_vertex_2.h @@ -145,7 +145,7 @@ incident_edges(const Face* f) const template bool Triangulation_ds_vertex_2 :: -is_valid(bool verbose = false, int level = 0) const +is_valid(bool verbose, int level) const { bool result = Vb::is_valid(verbose, level); CGAL_triangulation_assertion(result); diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h index 6ecc56dbe52..eedd42f529d 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h @@ -43,7 +43,7 @@ template < class R > class Triangulation_euclidean_traits_xy_3 { public: typedef Triangulation_euclidean_traits_xy_3 Traits; - typedef R Rep; + typedef R Rp; typedef Point_3 Point; typedef Segment_3 Segment; typedef Triangle_3 Triangle; @@ -59,8 +59,8 @@ public: - typename Rep::FT x(const Point &p) const { return p.x(); } - typename Rep::FT y(const Point &p) const { return p.y(); } + typename Rp::FT x(const Point &p) const { return p.x(); } + typename Rp::FT y(const Point &p) const { return p.y(); } Comparison_result compare_x(const Point &p, const Point &q) const { diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xz_3.h b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xz_3.h index fdfa0e2ac05..6c968a04ffc 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xz_3.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xz_3.h @@ -41,7 +41,7 @@ template < class R > class Triangulation_euclidean_traits_xz_3 { public: typedef Triangulation_euclidean_traits_xz_3 Traits; - typedef R Rep; + typedef R Rp; typedef Point_3 Point; typedef Segment_3 Segment; typedef Triangle_3 Triangle; @@ -56,8 +56,8 @@ public: Triangulation_euclidean_traits_xz_3 &operator=( const Triangulation_euclidean_traits_xz_3& et){return *this;} - typename Rep::FT x(const Point &p) const { return p.x(); } - typename Rep::FT y(const Point &p) const { return p.z(); } + typename Rp::FT x(const Point &p) const { return p.x(); } + typename Rp::FT y(const Point &p) const { return p.z(); } Comparison_result compare_x(const Point &p, const Point &q) const { diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_yz_3.h b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_yz_3.h index 1ecb090ff5b..5db2acb7e1c 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_yz_3.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_yz_3.h @@ -39,7 +39,7 @@ template < class R > class Triangulation_euclidean_traits_yz_3 { public: typedef Triangulation_euclidean_traits_yz_3 Traits; - typedef R Rep; + typedef R Rp; typedef Point_3 Point; typedef Segment_3 Segment; typedef Triangle_3 Triangle; @@ -53,8 +53,8 @@ public: Triangulation_euclidean_traits_yz_3 &operator=( const Triangulation_euclidean_traits_yz_3& et){return *this;} - typename Rep::FT x(const Point &p) const { return p.y(); } - typename Rep::FT y(const Point &p) const { return p.z(); } + typename Rp::FT x(const Point &p) const { return p.y(); } + typename Rp::FT y(const Point &p) const { return p.z(); } Comparison_result compare_x(const Point &p, const Point &q) const { diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C index 7f35e43e2d5..cfad3960f3e 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_types.C @@ -293,7 +293,7 @@ public: } }; -istream &operator>>(istream &is, Triangulation_test_point &p) +std::istream &operator>>(std::istream &is, Triangulation_test_point &p) { Triangulation_test_point::TESTFT x,y; is >> x >> y;