diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index a445365fc91..f6651a9ca64 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -13,7 +13,15 @@ Release date: September 2019 and `CGAL::Constrained_triangulation_plus_2::remove_constraint((Vertex_handle va, Vertex_handle vb)`, that is a pair of vertex handles is no longer a key for a polyline constraint. Users must use a version prior to 5.0 if they need this functionality. -- **Breaking change**: Removed the deprecated classes `CGAL::Regular_triangulation_euclidean_traits_2`, `CGAL::Regular_triangulation_filtered_traits_2`. Users must use a version prior to 5.0 if they need these classes. +- **Breaking change**: Removed the deprecated classes `CGAL::Regular_triangulation_euclidean_traits_2`, `CGAL::Regular_triangulation_filtered_traits_2`. Users must use a version prior to 5.0 if they need these classes. +- **Breaking change**: The constructor and the `insert()` function of `CGAL::Triangulation_2` which takes + a range of points as argument no longer performs a `spatial_sort()` of the points. +- Add constructor and `insert()` function to `CGAL::Triangulation_2` that takes a range of points with info. + +### 3D Triangulations +- **Breaking change**: The constructor and the `insert()` function of `CGAL::Triangulation_3` which takes + a range of points as argument no longer performs a `spatial_sort()` of the points. +- Add constructor and `insert()` function to `CGAL::Triangulation_3` that takes a range of points with info. ### Surface Mesh - New functions to read and write using the PLY format, diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h index 981c61fe9aa..0f52009026e 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h @@ -99,7 +99,7 @@ const Delaunay_triangulation_2 &tr); Equivalent to constructing an empty triangulation with the optional traits class argument and calling insert(first,last). */ template < class InputIterator > -Delaunay_triangulation_2 dt ( InputIterator first, InputIterator last, Traits gt = Traits()); +Delaunay_triangulation_2( InputIterator first, InputIterator last, Traits gt = Traits()); /// @} @@ -156,7 +156,6 @@ std::ptrdiff_t insert(PointInputIterator first, PointInputIterator last); /*! - inserts the points in the iterator range `[first,last)`. Returns the number of inserted points. Note that this function is not guaranteed to insert the points following the order of `PointWithInfoInputIterator`, as `spatial_sort()` diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index 769ad789783..4892b65eea3 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -353,6 +353,12 @@ if `tr` is modified, `*this` is not. Triangulation_2( const Triangulation_2& tr); + /*! +Equivalent to constructing an empty triangulation with the optional traits class argument and calling insert(first,last). +*/ +template < class InputIterator > +Triangulation_2( InputIterator first, InputIterator last, const Traits& gt = Traits()); + /*! Assignment. All the vertices and faces are duplicated. After the assignment, `*this` and `tr` @@ -685,14 +691,32 @@ Equivalent to `insert(p)`. Vertex_handle push_back(const Point& p); /*! -Inserts the points in the range `[first,last)`. -Returns the number of inserted points. -\pre The `value_type` of `InputIterator` is `Point`. -*/ -template < class InputIterator > -std::ptrdiff_t -insert(InputIterator first, InputIterator last); +Inserts the points in the range `[first,last)` in the given order, +and returns the number of inserted points. +\tparam PointInputIterator must be an input iterator with value type `Point`. +*/ +template < class PointInputIterator > +std::ptrdiff_t +insert(PointInputIterator first, PointInputIterator last); + + +/*! +inserts the points in the iterator range `[first,last)` in the given order, +and returns the number of inserted points. + +Given a pair `(p,i)`, the vertex `v` storing `p` also stores `i`, that is +`v.point() == p` and `v.info() == i`. If several pairs have the same point, +only one vertex is created, and one of the objects of type `Vertex::Info` will be stored in the vertex. +\pre `Vertex` must be model of the concept `TriangulationVertexBaseWithInfo_2`. + +\tparam PointWithInfoInputIterator must be an input iterator with the value type `std::pair`. + +*/ +template < class PointWithInfoInputIterator > +std::ptrdiff_t +insert(PointWithInfoInputIterator first, PointWithInfoInputIterator last); + /*! Removes the vertex from the triangulation. The created hole is re-triangulated. diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 9b24d20506e..2bbc6255474 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -31,9 +31,9 @@ #ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #include -#include + #include -#include + #include #endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO @@ -329,17 +329,12 @@ public: } #ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO -private: - //top stands for tuple-or-pair - template - const Point& top_get_first(const std::pair& pair) const { return pair.first; } - template - const Info& top_get_second(const std::pair& pair) const { return pair.second; } - template - const Point& top_get_first(const boost::tuple& tuple) const { return boost::get<0>(tuple); } - template - const Info& top_get_second(const boost::tuple& tuple) const { return boost::get<1>(tuple); } +private: + + using Triangulation::top_get_first; + using Triangulation::top_get_second; + template std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) { diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 4004b700c60..99b8c66486f 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -53,6 +53,11 @@ #include #include #include +#include + +#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO +#include +#endif #ifndef CGAL_NO_STRUCTURAL_FILTERING #include @@ -233,6 +238,15 @@ public: Triangulation_2(const Geom_traits& geom_traits=Geom_traits()); Triangulation_2(const Triangulation_2 &tr); + template + Triangulation_2(InputIterator first, InputIterator last, + const Geom_traits& geom_traits=Geom_traits()) + : _gt(geom_traits) + { + _infinite_vertex = _tds.insert_first(); + insert(first,last); + } + //Assignement Triangulation_2 &operator=(const Triangulation_2 &tr); @@ -587,32 +601,100 @@ public: } return os; } - + +#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO template < class InputIterator > -std::ptrdiff_t insert(InputIterator first, InputIterator last) +std::ptrdiff_t insert(InputIterator first, InputIterator last, + typename boost::enable_if< + boost::is_convertible< + typename std::iterator_traits::value_type, + Point + > + >::type* = NULL) +#else + template < class InputIterator > + std::ptrdiff_t + insert(InputIterator first, InputIterator last) +#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO { size_type n = number_of_vertices(); - std::vector points (first, last); - - typedef typename Geom_traits::Construct_point_2 Construct_point_2; - typedef typename boost::result_of::type Ret; - typedef CGAL::internal::boost_::function_property_map fpmap; - typedef CGAL::Spatial_sort_traits_adapter_2 Search_traits_2; - - spatial_sort(points.begin(), points.end(), - Search_traits_2( - CGAL::internal::boost_::make_function_property_map( - geom_traits().construct_point_2_object()), geom_traits())); - Face_handle f; - for (typename std::vector::const_iterator p = points.begin(), end = points.end(); - p != end; ++p) - f = insert (*p, f)->face(); + for (; first != last; ++first) + f = insert (*first, f)->face(); return number_of_vertices() - n; } + +#ifndef CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO + //top stands for tuple-or-pair + template + const Point& top_get_first(const std::pair& pair) const { return pair.first; } + template + const Info& top_get_second(const std::pair& pair) const { return pair.second; } + template + const Point& top_get_first(const boost::tuple& tuple) const { return boost::get<0>(tuple); } + template + const Info& top_get_second(const boost::tuple& tuple) const { return boost::get<1>(tuple); } + + template + std::ptrdiff_t insert_with_info(InputIterator first,InputIterator last) + { + size_type n = this->number_of_vertices(); + + std::vector points; + std::vector infos; + for (InputIterator it=first;it!=last;++it) { + Tuple_or_pair value=*it; + points.push_back(top_get_first(value)); + infos.push_back (top_get_second(value)); + } + + Vertex_handle v_hint; + Face_handle hint; + for (std::size_t i = 0; i < points.size(); ++i ) { + v_hint = insert(points[i], hint); + if(v_hint!=Vertex_handle()) { + v_hint->info()=infos[i]; + hint=v_hint->face(); + } + } + + return this->number_of_vertices() - n; + } + +public: + + template < class InputIterator > + std::ptrdiff_t + insert(InputIterator first, + InputIterator last, + typename boost::enable_if< + boost::is_convertible< + typename std::iterator_traits::value_type, + std::pair::type> + > >::type* = NULL) + { + return insert_with_info< std::pair::type> >(first,last); + } + + template + std::ptrdiff_t + insert(boost::zip_iterator< boost::tuple > first, + boost::zip_iterator< boost::tuple > last, + typename boost::enable_if< + boost::mpl::and_< + boost::is_convertible< typename std::iterator_traits::value_type, Point >, + boost::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > + > + >::type* = NULL) + { + return insert_with_info< boost::tuple::type> >(first,last); + } +#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO + + bool well_oriented(Vertex_handle v) const { Face_circulator fc = incident_faces(v), done(fc); diff --git a/Triangulation_2/test/Triangulation_2/test_triangulation_with_zip_iterator_2.cpp b/Triangulation_2/test/Triangulation_2/test_triangulation_with_zip_iterator_2.cpp new file mode 100644 index 00000000000..f96a9b388c8 --- /dev/null +++ b/Triangulation_2/test/Triangulation_2/test_triangulation_with_zip_iterator_2.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; +typedef CGAL::Triangulation_data_structure_2 Tds; +typedef CGAL::Triangulation_2 Triangulation; +typedef Triangulation::Point Point; + +int main() +{ + + std::vector indices; + indices.push_back(0); + indices.push_back(1); + indices.push_back(2); + indices.push_back(3); + indices.push_back(4); + indices.push_back(5); + + std::vector points; + points.push_back(Point(0,0)); + points.push_back(Point(1,0)); + points.push_back(Point(0,1)); + points.push_back(Point(1,47)); + points.push_back(Point(2,2)); + points.push_back(Point(-1,0)); + + + + Triangulation T( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )), + boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) ); + + CGAL_assertion( T.number_of_vertices() == 6 ); + + + // check that the info was correctly set. + Triangulation::Finite_vertices_iterator vit; + for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) + if( points[ vit->info() ] != vit->point() ){ + std::cerr << "Error different info" << std::endl; + exit(EXIT_FAILURE); + } + + return 0; +} diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Delaunay_triangulation_3.h index 670c2054ae1..ac4b39c6085 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Delaunay_triangulation_3.h @@ -209,7 +209,6 @@ std::ptrdiff_t insert(PointInputIterator first, PointInputIterator last); /*! - Inserts the points in the iterator range `[first,last)`. Returns the number of inserted points. Note that this function is not guaranteed to insert the points diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h index 3bd0dfbe653..3629e39b9ce 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h @@ -905,15 +905,30 @@ Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle loc, int li, int lj); /*! -Inserts the points in the range `[first,last)`. Returns the number of inserted points. -Note that this function is not guaranteed to insert the points -following the order of `InputIterator`. -\tparam InputIterator must be an input iterator with value type `Point`. -*/ -template < class InputIterator > -std::ptrdiff_t -insert(InputIterator first, InputIterator last); +Inserts the points in the range `[first,last)` in the given order, +and returns the number of inserted points. +*/ +template < class PointInputIterator > +std::ptrdiff_t +insert(PointInputIterator first, PointInputIterator last); + + +/*! +Inserts the points in the iterator range `[first,last)` in the given order, +and returns the number of inserted points. + +Given a pair `(p,i)`, the vertex `v` storing `p` also stores `i`, that is +`v.point() == p` and `v.info() == i`. If several pairs have the same point, +only one vertex is created, and one of the objects of type `Vertex::Info` will be stored in the vertex. +\pre `Vertex` must be model of the concept `TriangulationVertexBaseWithInfo_3`. + +\tparam PointWithInfoInputIterator must be an input iterator with the value type `std::pair`. + +*/ +template < class PointWithInfoInputIterator > +std::ptrdiff_t +insert(PointWithInfoInputIterator first, PointWithInfoInputIterator last); /// @} diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index f88764b8197..4376d3ff548 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -46,10 +46,8 @@ #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #include -#include #include -#include #include #endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO @@ -414,19 +412,9 @@ public: #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO private: - //top stands for tuple-or-pair - template - const Point& top_get_first(const std::pair& pair) const { return pair.first; } - - template - const Info& top_get_second(const std::pair& pair) const { return pair.second; } - - template - const Point& top_get_first(const boost::tuple& tuple) const { return boost::get<0>(tuple); } - - template - const Info& top_get_second(const boost::tuple& tuple) const { return boost::get<1>(tuple); } - + using Tr_Base::top_get_first; + using Tr_Base::top_get_second; + template std::ptrdiff_t insert_with_info(InputIterator first, InputIterator last) { diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index bb88f2fe3dc..231e5d6dc52 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -421,6 +421,7 @@ public: #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO private: + //top stands for tuple-or-pair template const Weighted_point& top_get_first(const std::pair& pair) const { return pair.first; } @@ -433,7 +434,7 @@ private: template const Info& top_get_second(const boost::tuple& tuple) const { return boost::get<1>(tuple); } - + // Functor to go from an index of a container of Weighted_point to // the corresponding Bare_point template diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 71c1b37b443..891becdcabf 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -68,6 +68,11 @@ #include #include +#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO +#include +#include +#endif + #ifndef CGAL_NO_STRUCTURAL_FILTERING #include #include @@ -1115,37 +1120,101 @@ public: Hidden_points_visitor& hider, bool *could_lock_zone = NULL); + +#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO + template < class InputIterator > + std::ptrdiff_t insert(InputIterator first, InputIterator last, + typename boost::enable_if< + boost::is_convertible< + typename std::iterator_traits::value_type, + Point + > + >::type* = NULL) +#else template < class InputIterator > std::ptrdiff_t insert(InputIterator first, InputIterator last) +#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO { size_type n = number_of_vertices(); - std::vector points (first, last); - - // The function insert(first, last) is overwritten in Regular_triangulation_3.h, - // so we know that, here, `Point` is not a type of Weighted point. - // Nevertheless, to make it more generic (that is, allowing the user to pass - // a `Point` type that is not GT::Point_3), we still use the spatial sort - // adapter traits and Construct_point_3 here. - typedef typename Geom_traits::Construct_point_3 Construct_point_3; - typedef typename boost::result_of::type Ret; - typedef CGAL::internal::boost_::function_property_map fpmap; - typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; - - spatial_sort(points.begin(), points.end(), - Search_traits_3( - CGAL::internal::boost_::make_function_property_map( - geom_traits().construct_point_3_object()), geom_traits())); - Vertex_handle hint; - for(typename std::vector::const_iterator p = points.begin(), - end = points.end(); - p != end; ++p) - hint = insert(*p, hint); + for(; first != last; ++first) + hint = insert(*first, hint); return number_of_vertices() - n; } +#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO +protected: + //top stands for tuple-or-pair + template + const Point& top_get_first(const std::pair& pair) const { return pair.first; } + + template + const Info& top_get_second(const std::pair& pair) const { return pair.second; } + + template + const Point& top_get_first(const boost::tuple& tuple) const { return boost::get<0>(tuple); } + + template + const Info& top_get_second(const boost::tuple& tuple) const { return boost::get<1>(tuple); } + + template + std::ptrdiff_t insert_with_info(InputIterator first, InputIterator last) + { + size_type n = number_of_vertices(); + std::vector indices; + std::vector points; + std::vector infos; + for(InputIterator it=first;it!=last;++it) + { + Tuple_or_pair value=*it; + points.push_back(top_get_first(value)); + infos.push_back(top_get_second(value)); + } + + Vertex_handle hint; + for(std::size_t i=0; i < points.size(); ++i) + { + hint = insert(points[i], hint); + if(hint != Vertex_handle()) + hint->info() = infos[i]; + } + + return number_of_vertices() - n; + } + +public: + template < class InputIterator > + std::ptrdiff_t insert(InputIterator first, InputIterator last, + typename boost::enable_if< + boost::is_convertible< + typename std::iterator_traits::value_type, + std::pair::type> + > >::type* =NULL) + { + return insert_with_info< std::pair::type> >(first,last); + } + + template + std::ptrdiff_t + insert(boost::zip_iterator< boost::tuple > first, + boost::zip_iterator< boost::tuple > last, + typename boost::enable_if< + boost::mpl::and_< + boost::is_convertible< typename std::iterator_traits::value_type, Point >, + boost::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > + > + >::type* =NULL) + { + return insert_with_info< boost::tuple::type> >(first,last); + } +#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO + + + Vertex_handle insert_in_cell(const Point& p, Cell_handle c); Vertex_handle insert_in_facet(const Point& p, Cell_handle c, int i); Vertex_handle insert_in_facet(const Point& p, const Facet& f) { diff --git a/Triangulation_3/test/Triangulation_3/test_Triangulation_with_transform_iterator.cpp b/Triangulation_3/test/Triangulation_3/test_Triangulation_with_transform_iterator.cpp new file mode 100644 index 00000000000..62ea5f34fd4 --- /dev/null +++ b/Triangulation_3/test/Triangulation_3/test_Triangulation_with_transform_iterator.cpp @@ -0,0 +1,52 @@ +#include + +#include +#include +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_vertex_base_with_info_3 Vb; +typedef CGAL::Triangulation_cell_base_3 Cb; +typedef CGAL::Triangulation_data_structure_3 Tds; +typedef CGAL::Triangulation_3 Triangulation; +typedef Triangulation::Point Point; + +//a functor that returns a std::pair. +//the unsigned integer is incremented at each call to +//operator() +struct Auto_count : public CGAL::cpp98::unary_function >{ + mutable unsigned i; + Auto_count() : i(0){} + std::pair operator()(const Point& p) const { + return std::make_pair(p,i++); + } +}; + +int main() +{ + std::vector points; + points.push_back(Point(0,0,0)); + points.push_back(Point(1,0,0)); + points.push_back(Point(0,1,0)); + points.push_back(Point(0,0,1)); + points.push_back(Point(2,2,2)); + points.push_back(Point(-1,0,1)); + + Triangulation T( boost::make_transform_iterator(points.begin(),Auto_count()), + boost::make_transform_iterator(points.end(), Auto_count() ) ); + + CGAL_assertion( T.number_of_vertices() == 6 ); + + // check that the info was correctly set. + Triangulation::Finite_vertices_iterator vit; + for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) + if( points[ vit->info() ] != vit->point() ){ + std::cerr << "Error different info" << std::endl; + exit(EXIT_FAILURE); + } + std::cout << "OK" << std::endl; + + return 0; +} diff --git a/Triangulation_3/test/Triangulation_3/test_Triangulation_with_zip_iterator.cpp b/Triangulation_3/test/Triangulation_3/test_Triangulation_with_zip_iterator.cpp new file mode 100644 index 00000000000..06479948507 --- /dev/null +++ b/Triangulation_3/test/Triangulation_3/test_Triangulation_with_zip_iterator.cpp @@ -0,0 +1,50 @@ +#include + +#include +#include + +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_vertex_base_with_info_3 Vb; +typedef CGAL::Triangulation_cell_base_3 Cb; +typedef CGAL::Triangulation_data_structure_3 Tds; +typedef CGAL::Triangulation_3 Triangulation; +typedef Triangulation::Point Point; + +int main() +{ + std::vector indices; + indices.push_back(0); + indices.push_back(1); + indices.push_back(2); + indices.push_back(3); + indices.push_back(4); + indices.push_back(5); + + std::vector points; + points.push_back(Point(0,0,0)); + points.push_back(Point(1,0,0)); + points.push_back(Point(0,1,0)); + points.push_back(Point(0,0,1)); + points.push_back(Point(2,2,2)); + points.push_back(Point(-1,0,1)); + + Triangulation T(boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )), + boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) ); + + CGAL_assertion( T.number_of_vertices() == 6 ); + + // check that the info was correctly set. + Triangulation::Finite_vertices_iterator vit; + for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) + if( points[ vit->info() ] != vit->point() ){ + std::cerr << "Error different info" << std::endl; + exit(EXIT_FAILURE); + } + + return 0; +}