Misc minor changes

This commit is contained in:
Mael Rouxel-Labbé 2017-08-23 10:57:48 +02:00
parent 11c3a490d1
commit 0106de5fd0
15 changed files with 81 additions and 73 deletions

View File

@ -5,7 +5,8 @@
#include <CGAL/Triangulation_vertex_base_2.h> #include <CGAL/Triangulation_vertex_base_2.h>
template < class GT, class Vb > template < class GT, class Vb >
class My_vertex_base : public Vb class My_vertex_base
: public Vb
{ {
public: public:
typedef typename Vb::Vertex_handle Vertex_handle; typedef typename Vb::Vertex_handle Vertex_handle;
@ -36,11 +37,11 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT;
typedef CGAL::Periodic_2_triangulation_vertex_base_2<GT> VbDS; typedef CGAL::Periodic_2_triangulation_vertex_base_2<GT> VbDS;
typedef My_vertex_base<GT, VbDS> Vb; typedef My_vertex_base<GT, VbDS> Vb;
typedef CGAL::Periodic_2_triangulation_face_base_2<GT> Fb; typedef CGAL::Periodic_2_triangulation_face_base_2<GT> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds; typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT, Tds> PDT; typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT, Tds> PDT;
typedef PDT::Vertex_handle Vertex_handle; typedef PDT::Vertex_handle Vertex_handle;
typedef PDT::Point Point; typedef PDT::Point Point;

View File

@ -9,10 +9,10 @@
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> PDT; typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> PDT;
typedef PDT::Point Point; typedef PDT::Point Point;
typedef PDT::Covering_sheets Covering_sheets; typedef PDT::Covering_sheets Covering_sheets;
int main() int main()
{ {
@ -20,32 +20,32 @@ int main()
// Input point grid (27 points) // Input point grid (27 points)
for (double x = 0. ; x < .9 ; x += 0.4) for (double x = 0. ; x < .9 ; x += 0.4)
{
for (double y = 0. ; y < .9 ; y += 0.4)
{ {
for (double y = 0. ; y < .9 ; y += 0.4) T.insert(Point(x, y));
{
T.insert(Point(x, y));
}
} }
}
Covering_sheets cs = T.number_of_sheets(); Covering_sheets cs = T.number_of_sheets();
std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl; std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl;
if ( T.is_triangulation_in_1_sheet() ) // = true if ( T.is_triangulation_in_1_sheet() ) // = true
{ {
bool is_extensible = T.is_extensible_triangulation_in_1_sheet_h1() bool is_extensible = T.is_extensible_triangulation_in_1_sheet_h1()
|| T.is_extensible_triangulation_in_1_sheet_h2(); // = false || T.is_extensible_triangulation_in_1_sheet_h2(); // = false
T.convert_to_1_sheeted_covering(); T.convert_to_1_sheeted_covering();
cs = T.number_of_sheets(); cs = T.number_of_sheets();
std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl; std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl;
if ( is_extensible ) // = false if ( is_extensible ) // = false
std::cout << "It is safe to change the triangulation here." << std::endl; std::cout << "It is safe to change the triangulation here." << std::endl;
else else
std::cout << "It is NOT safe to change the triangulation here!" << std::endl; std::cout << "It is NOT safe to change the triangulation here!" << std::endl;
T.convert_to_9_sheeted_covering(); T.convert_to_9_sheeted_covering();
cs = T.number_of_sheets(); cs = T.number_of_sheets();
std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl; std::cout << "Current covering: " << cs[0] << ' ' << cs[1] << std::endl;
} }
std::cout << "It is (again) safe to modify the triangulation." << std::endl; std::cout << "It is (again) safe to modify the triangulation." << std::endl;

View File

@ -4,15 +4,15 @@
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h> #include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
#include <CGAL/point_generators_2.h> #include <CGAL/point_generators_2.h>
#include <vector>
#include <cassert> #include <cassert>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> Delaunay; typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> Delaunay;
typedef Delaunay::Point Point; typedef Delaunay::Point Point;
typedef Delaunay::Face_handle Face_handle; typedef Delaunay::Face_handle Face_handle;
int main() int main()
{ {

View File

@ -11,7 +11,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> Gt; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> Gt;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, Gt> Vb; typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, Gt> Vb;
typedef CGAL::Periodic_2_triangulation_face_base_2<Gt> Fb; typedef CGAL::Periodic_2_triangulation_face_base_2<Gt> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds; typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<Gt, Tds> Delaunay; typedef CGAL::Periodic_2_Delaunay_triangulation_2<Gt, Tds> Delaunay;
typedef Delaunay::Point Point; typedef Delaunay::Point Point;
@ -33,11 +33,13 @@ int main()
// check that the info was correctly set. // check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit; Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
{
if( points[ vit->info() ].first != vit->point() ) if( points[ vit->info() ].first != vit->point() )
{ {
std::cerr << "Error different info" << std::endl; std::cerr << "Error different info" << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
}
std::cout << "OK" << std::endl; std::cout << "OK" << std::endl;
return 0; return 0;

View File

@ -11,14 +11,15 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> Gt; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> Gt;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, Gt> Vb; typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, Gt> Vb;
typedef CGAL::Periodic_2_triangulation_face_base_2<Gt> Fb; typedef CGAL::Periodic_2_triangulation_face_base_2<Gt> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds; typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<Gt, Tds> Delaunay; typedef CGAL::Periodic_2_Delaunay_triangulation_2<Gt, Tds> Delaunay;
typedef Delaunay::Point Point; typedef Delaunay::Point Point;
//a functor that returns a std::pair<Point,unsigned>. //a functor that returns a std::pair<Point,unsigned>.
//the unsigned integer is incremented at each call to //the unsigned integer is incremented at each call to
//operator() //operator()
struct Auto_count : public std::unary_function<const Point&, std::pair<Point, unsigned> > struct Auto_count
: public std::unary_function<const Point&, std::pair<Point, unsigned> >
{ {
mutable unsigned i; mutable unsigned i;
Auto_count() : i(0) {} Auto_count() : i(0) {}
@ -47,11 +48,13 @@ int main()
// check that the info was correctly set. // check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit; Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
{
if( points[ vit->info() ] != vit->point() ) if( points[ vit->info() ] != vit->point() )
{ {
std::cerr << "Error different info" << std::endl; std::cerr << "Error different info" << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
}
std::cout << "OK" << std::endl; std::cout << "OK" << std::endl;
return 0; return 0;

View File

@ -30,18 +30,17 @@ int main()
// Generating n random points // Generating n random points
for (int i = 0 ; i < n ; i++) for (int i = 0 ; i < n ; i++)
{ {
Point p = *in_square; Point p = *in_square;
in_square++; in_square++;
pts.push_back(Point(p.x() + .5, p.y() + .5)); pts.push_back(Point(p.x() + .5, p.y() + .5));
} }
// Standard insertion // Standard insertion
t.start(); t.start();
for (int i = 0 ; i < n ; i++) for (int i = 0 ; i < n ; i++)
{ PT1.insert(pts[i]);
PT1.insert(pts[i]);
}
t.stop(); t.stop();
std::cout << " Time: " << t.time() << " sec. (Standard insertion)" << std::endl; std::cout << " Time: " << t.time() << " sec. (Standard insertion)" << std::endl;
t.reset(); t.reset();

View File

@ -13,11 +13,11 @@ typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<K> GT;
typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> PDT; typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT> PDT;
typedef PDT::Face_handle Face_handle; typedef PDT::Face_handle Face_handle;
typedef PDT::Vertex_handle Vertex_handle; typedef PDT::Vertex_handle Vertex_handle;
typedef PDT::Locate_type Locate_type; typedef PDT::Locate_type Locate_type;
typedef PDT::Point Point; typedef PDT::Point Point;
typedef PDT::Iso_rectangle Iso_rectangle; typedef PDT::Iso_rectangle Iso_rectangle;
int main() int main()
{ {

View File

@ -22,7 +22,6 @@
#include <CGAL/license/Periodic_2_triangulation_2.h> #include <CGAL/license/Periodic_2_triangulation_2.h>
#include <CGAL/Periodic_2_triangulation_2.h> #include <CGAL/Periodic_2_triangulation_2.h>
#include <CGAL/iterator.h> #include <CGAL/iterator.h>
@ -35,16 +34,16 @@
#include <boost/mpl/and.hpp> #include <boost/mpl/and.hpp>
#endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #endif //CGAL_TRIANGULATION_2_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
namespace CGAL namespace CGAL
{ {
template < template <
class Gt, class Gt,
class Tds = Triangulation_data_structure_2 < class Tds = Triangulation_data_structure_2 <
Periodic_2_triangulation_vertex_base_2<Gt>, Periodic_2_triangulation_vertex_base_2<Gt>,
Periodic_2_triangulation_face_base_2<Gt> > > Periodic_2_triangulation_face_base_2<Gt> > >
class Periodic_2_Delaunay_triangulation_2 : public Periodic_2_triangulation_2<Gt, Tds> class Periodic_2_Delaunay_triangulation_2
: public Periodic_2_triangulation_2<Gt, Tds>
{ {
typedef Periodic_2_Delaunay_triangulation_2<Gt, Tds> Self; typedef Periodic_2_Delaunay_triangulation_2<Gt, Tds> Self;
public: public:

View File

@ -60,10 +60,11 @@ namespace CGAL
/// - Deletion of points /// - Deletion of points
/// - Point location /// - Point location
template < class Gt, template < class Gt,
class Tds = Triangulation_data_structure_2 < class Tds = Triangulation_data_structure_2 <
Periodic_2_triangulation_vertex_base_2<Gt>, Periodic_2_triangulation_vertex_base_2<Gt>,
Periodic_2_triangulation_face_base_2<Gt> > > Periodic_2_triangulation_face_base_2<Gt> > >
class Periodic_2_triangulation_2: public Triangulation_cw_ccw_2 class Periodic_2_triangulation_2
: public Triangulation_cw_ccw_2
{ {
typedef Periodic_2_triangulation_2<Gt, Tds> Self; typedef Periodic_2_triangulation_2<Gt, Tds> Self;

View File

@ -38,6 +38,7 @@ class Periodic_2_triangulation_face_base_2
{ {
typedef Fb Base; typedef Fb Base;
typedef typename Base::Triangulation_data_structure Tds; typedef typename Base::Triangulation_data_structure Tds;
public: public:
typedef Gt Geom_traits; typedef Gt Geom_traits;
typedef Tds Triangulation_data_structure; typedef Tds Triangulation_data_structure;

View File

@ -38,21 +38,22 @@ template < class Gt, class Vb = CGAL::Triangulation_vertex_base_2<Gt> >
class Periodic_2_triangulation_vertex_base_2 class Periodic_2_triangulation_vertex_base_2
: public Vb : public Vb
{ {
typedef Vb Base; typedef Vb Base;
typedef typename Vb::Triangulation_data_structure Tds; typedef typename Vb::Triangulation_data_structure Tds;
public:
typedef Gt Geom_traits;
typedef typename Gt::Point_2 Point;
typedef Tds Triangulation_data_structure;
typedef typename Tds::Face_handle Face_handle;
typedef typename Tds::Vertex_handle Vertex_handle;
typedef Periodic_2_offset_2 Offset; public:
typedef Gt Geom_traits;
typedef Tds Triangulation_data_structure;
typedef typename Tds::Vertex_handle Vertex_handle;
typedef typename Tds::Face_handle Face_handle;
typedef typename Gt::Point_2 Point;
typedef Periodic_2_offset_2 Offset;
template < typename Tds2 > template < typename Tds2 >
struct Rebind_TDS struct Rebind_TDS
{ {
typedef typename Vb::template Rebind_TDS<Tds2>::Other Vb2; typedef typename Vb::template Rebind_TDS<Tds2>::Other Vb2;
typedef Periodic_2_triangulation_vertex_base_2<Gt, Vb2> Other; typedef Periodic_2_triangulation_vertex_base_2<Gt, Vb2> Other;
}; };

View File

@ -64,7 +64,7 @@ public:
// Hence, if the kernel has members and we use filtered traits, then // Hence, if the kernel has members and we use filtered traits, then
// the members will be default constructed here... // the members will be default constructed here...
// Problem 2: we have built filtered traits in P3Tfiltered_traits_3 and now // Problem 2: we have built filtered traits in P3Tfiltered_traits_2 and now
// we also need those two... // we also need those two...
} }

View File

@ -36,7 +36,7 @@ namespace CGAL {
template< typename K, template< typename K,
typename Off = typename CGAL::Periodic_2_offset_2> typename Off = typename CGAL::Periodic_2_offset_2>
class Periodic_2_triangulation_statically_filtered_traits_2 class Periodic_2_triangulation_statically_filtered_traits_2
: public Periodic_2_triangulation_filtered_traits_base_2<K, Off> : public Periodic_2_triangulation_filtered_traits_base_2<K, Off>
{ {
typedef Periodic_2_triangulation_statically_filtered_traits_2<K, Off> Self; typedef Periodic_2_triangulation_statically_filtered_traits_2<K, Off> Self;
typedef Periodic_2_triangulation_filtered_traits_base_2<K, Off> Base; typedef Periodic_2_triangulation_filtered_traits_base_2<K, Off> Base;

View File

@ -21,6 +21,7 @@
#include <CGAL/license/Periodic_2_triangulation_2.h> #include <CGAL/license/Periodic_2_triangulation_2.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <CGAL/Profile_counter.h> #include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h> #include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h> #include <CGAL/internal/Static_filters/tools.h>

View File

@ -27,7 +27,7 @@ Face_handle test_point_location(const Triangulation &t,
CGAL_assertion(lt2 == lt_in); CGAL_assertion(lt2 == lt_in);
switch (lt_in) switch (lt_in)
{ {
case Triangulation::VERTEX: case Triangulation::VERTEX:
case Triangulation::EDGE: case Triangulation::EDGE:
{ {
@ -51,7 +51,7 @@ Face_handle test_point_location(const Triangulation &t,
CGAL_assertion(false); CGAL_assertion(false);
break; break;
} }
} }
return fh; return fh;
} }