This commit is contained in:
Andreas Fabri 2019-04-24 11:28:18 +02:00
parent 146dfce5fe
commit c2fcd257c7
19 changed files with 42 additions and 88 deletions

View File

@ -35,7 +35,7 @@ with the representation type determined by `std::iterator_traits<InputIterator>:
\sa `CGAL::greene_approx_convex_partition_2()` \sa `CGAL::greene_approx_convex_partition_2()`
\sa `CGAL::optimal_convex_partition_2()` \sa `CGAL::optimal_convex_partition_2()`
\sa `CGAL::partition_is_valid_2()` \sa `CGAL::partition_is_valid_2()`
\sa `CGAL::Is_convex_2()` \sa `CGAL::Is_convex_2`
\cgalHeading{Implementation} \cgalHeading{Implementation}
@ -99,7 +99,7 @@ with the representation type determined by `std::iterator_traits<InputIterator>:
\sa `CGAL::optimal_convex_partition_2()` \sa `CGAL::optimal_convex_partition_2()`
\sa `CGAL::Partition_is_valid_traits_2<Traits, PolygonIsValid>` \sa `CGAL::Partition_is_valid_traits_2<Traits, PolygonIsValid>`
\sa `CGAL::y_monotone_partition_2()` \sa `CGAL::y_monotone_partition_2()`
\sa `CGAL::Is_convex_2()` \sa `CGAL::Is_convex_2`
\cgalHeading{Implementation} \cgalHeading{Implementation}

View File

@ -1,8 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_polygon_2.h>
#include <cassert> #include <cassert>
#include <list> #include <list>
@ -11,10 +9,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Partition_traits_2<K> Traits; typedef CGAL::Partition_traits_2<K> Traits;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;
typedef Polygon_2::Vertex_iterator Vertex_iterator;
typedef std::list<Polygon_2> Polygon_list; typedef std::list<Polygon_2> Polygon_list;
typedef CGAL::Creator_uniform_2<int, Point_2> Creator;
typedef CGAL::Random_points_in_square_2<Point_2, Creator> Point_generator;
void make_polygon(Polygon_2& polygon) void make_polygon(Polygon_2& polygon)
{ {
@ -40,19 +35,14 @@ int main()
Polygon_2 polygon; Polygon_2 polygon;
Polygon_list partition_polys; Polygon_list partition_polys;
/*
CGAL::random_polygon_2(50, std::back_inserter(polygon),
Point_generator(100));
*/
make_polygon(polygon); make_polygon(polygon);
Traits traits;
CGAL::approx_convex_partition_2(polygon.vertices_begin(), CGAL::approx_convex_partition_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
std::back_inserter(partition_polys), traits); std::back_inserter(partition_polys));
assert(CGAL::convex_partition_is_valid_2(polygon.vertices_begin(), assert(CGAL::convex_partition_is_valid_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
partition_polys.begin(), partition_polys.begin(),
partition_polys.end(), partition_polys.end()));
traits));
return 0; return 0;
} }

View File

@ -1,8 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_polygon_2.h>
#include <cassert> #include <cassert>
#include <list> #include <list>
@ -10,10 +8,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Partition_traits_2<K> Traits; typedef CGAL::Partition_traits_2<K> Traits;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;
typedef Polygon_2::Vertex_iterator Vertex_iterator;
typedef std::list<Polygon_2> Polygon_list; typedef std::list<Polygon_2> Polygon_list;
typedef CGAL::Creator_uniform_2<int, Point_2> Creator;
typedef CGAL::Random_points_in_square_2< Point_2, Creator > Point_generator;
void make_polygon(Polygon_2& polygon) void make_polygon(Polygon_2& polygon)
{ {
@ -38,21 +33,14 @@ int main()
{ {
Polygon_2 polygon; Polygon_2 polygon;
Polygon_list partition_polys; Polygon_list partition_polys;
Traits partition_traits;
/*
CGAL::random_polygon_2(50, std::back_inserter(polygon),
Point_generator(100));
*/
make_polygon(polygon); make_polygon(polygon);
CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
std::back_inserter(partition_polys), std::back_inserter(partition_polys));
partition_traits);
assert(CGAL::convex_partition_is_valid_2(polygon.vertices_begin(), assert(CGAL::convex_partition_is_valid_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
partition_polys.begin(), partition_polys.begin(),
partition_polys.end(), partition_polys.end()));
partition_traits));
return 0; return 0;
} }

View File

@ -1,25 +1,15 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/Partition_is_valid_traits_2.h>
#include <CGAL/polygon_function_objects.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_polygon_2.h>
#include <cassert> #include <cassert>
#include <list> #include <list>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Partition_traits_2<K> Traits; typedef CGAL::Partition_traits_2<K> Traits;
typedef CGAL::Is_convex_2<Traits> Is_convex_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Polygon_2::Vertex_const_iterator Vertex_iterator;
typedef std::list<Polygon_2> Polygon_list; typedef std::list<Polygon_2> Polygon_list;
typedef CGAL::Partition_is_valid_traits_2<Traits, Is_convex_2>
Validity_traits;
typedef CGAL::Creator_uniform_2<int, Point_2> Creator;
typedef CGAL::Random_points_in_square_2<Point_2, Creator> Point_generator;
void make_polygon(Polygon_2& polygon) void make_polygon(Polygon_2& polygon)
{ {
@ -43,22 +33,16 @@ int main()
{ {
Polygon_2 polygon; Polygon_2 polygon;
Polygon_list partition_polys; Polygon_list partition_polys;
Traits partition_traits;
Validity_traits validity_traits(partition_traits);
/*
CGAL::random_polygon_2(50, std::back_inserter(polygon),
Point_generator(100));
*/
make_polygon(polygon); make_polygon(polygon);
CGAL::optimal_convex_partition_2(polygon.vertices_begin(), CGAL::optimal_convex_partition_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
std::back_inserter(partition_polys), std::back_inserter(partition_polys));
partition_traits);
assert(CGAL::partition_is_valid_2(polygon.vertices_begin(), assert(CGAL::partition_is_valid_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),
partition_polys.begin(), partition_polys.begin(),
partition_polys.end(), partition_polys.end()));
validity_traits));
return 0; return 0;
} }

View File

@ -1,8 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_polygon_2.h>
#include <cassert> #include <cassert>
#include <list> #include <list>
@ -12,8 +10,6 @@ typedef CGAL::Partition_traits_2<K> Traits;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;
typedef std::list<Polygon_2> Polygon_list; typedef std::list<Polygon_2> Polygon_list;
typedef CGAL::Creator_uniform_2<int, Point_2> Creator;
typedef CGAL::Random_points_in_square_2<Point_2, Creator> Point_generator;
void make_polygon(Polygon_2& polygon) void make_polygon(Polygon_2& polygon)
{ {
@ -39,10 +35,6 @@ int main( )
Polygon_2 polygon; Polygon_2 polygon;
Polygon_list partition_polys; Polygon_list partition_polys;
/*
CGAL::random_polygon_2(50, std::back_inserter(polygon),
Point_generator(100));
*/
make_polygon(polygon); make_polygon(polygon);
CGAL::y_monotone_partition_2(polygon.vertices_begin(), CGAL::y_monotone_partition_2(polygon.vertices_begin(),
polygon.vertices_end(), polygon.vertices_end(),

View File

@ -42,8 +42,8 @@ int main( )
Polygon_list partition_polys; Polygon_list partition_polys;
CGAL::y_monotone_partition_2(polygon.begin(), CGAL::y_monotone_partition_2(polygon.vertices_begin(),
polygon.end(), polygon.vertices_end(),
std::back_inserter(partition_polys), std::back_inserter(partition_polys),
traits); traits);

View File

@ -28,14 +28,14 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef double NT; typedef double NT;
typedef CGAL::Cartesian<NT> K; typedef CGAL::Simple_cartesian<NT> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,14 +26,14 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef double NT; typedef double NT;
typedef CGAL::Homogeneous<NT> K; typedef CGAL::Simple_homogeneous<NT> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Cartesian<double> K; typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Homogeneous<double> K; typedef CGAL::Simple_homogeneous<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,20 +26,20 @@
// implementation: testing of is_y_monotone_2 function // implementation: testing of is_y_monotone_2 function
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/is_y_monotone_2.h> #include <CGAL/is_y_monotone_2.h>
#include <list> #include <list>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
typedef CGAL::Cartesian<double> CR; typedef CGAL::Simple_cartesian<double> CR;
typedef CR::Point_2 CPoint_2; typedef CR::Point_2 CPoint_2;
typedef std::list<CPoint_2> CContainer; typedef std::list<CPoint_2> CContainer;
typedef CGAL::Polygon_2<CR, CContainer> CPolygon_2; typedef CGAL::Polygon_2<CR, CContainer> CPolygon_2;
typedef CGAL::Homogeneous<double> HR; typedef CGAL::Simple_homogeneous<double> HR;
typedef HR::Point_2 HPoint_2; typedef HR::Point_2 HPoint_2;
typedef std::vector<HPoint_2> HContainer; typedef std::vector<HPoint_2> HContainer;
typedef CGAL::Polygon_2<HR, HContainer> HPolygon_2; typedef CGAL::Polygon_2<HR, HContainer> HPolygon_2;

View File

@ -3,12 +3,12 @@
#if TESTR==1 #if TESTR==1
typedef double NT; typedef double NT;
typedef CGAL::Cartesian<NT> K; typedef CGAL::Simple_cartesian<NT> K;
#endif #endif
#if TESTR==2 #if TESTR==2
typedef double NT; typedef double NT;
typedef CGAL::Homogeneous<NT> K; typedef CGAL::Simple_homogeneous<NT> K;
#endif #endif

View File

@ -1,7 +1,7 @@
#if TESTR == 1 #if TESTR == 1
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#endif #endif
#if TESTR == 2 #if TESTR == 2
#include <CGAL/Homogeneous.h> #include <CGAL/simple_homogeneous.h>
#endif #endif

View File

@ -26,13 +26,13 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Cartesian<double> K; typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: Testing of convex partitioning functions // implementation: Testing of convex partitioning functions
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Homogeneous<double> K; typedef CGAL::Simple_homogeneous<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: testing of use of default traits classes for partitioning // implementation: testing of use of default traits classes for partitioning
// ============================================================================ // ============================================================================
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Cartesian<double> K; typedef CGAL::Simple_cartesian<double> K;
typedef CGAL::Partition_traits_2<K> Traits; typedef CGAL::Partition_traits_2<K> Traits;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: testing of use of default traits classes for partitioning // implementation: testing of use of default traits classes for partitioning
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Partition_traits_2.h> #include <CGAL/Partition_traits_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Homogeneous<double> K; typedef CGAL::Simple_homogeneous<double> K;
typedef CGAL::Partition_traits_2<K> Traits; typedef CGAL::Partition_traits_2<K> Traits;
typedef Traits::Point_2 Point_2; typedef Traits::Point_2 Point_2;
typedef Traits::Polygon_2 Polygon_2; typedef Traits::Polygon_2 Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: Testing of y-monotone partitioning function // implementation: Testing of y-monotone partitioning function
// ============================================================================ // ============================================================================
#include <CGAL/Cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Cartesian<double> K; typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;

View File

@ -26,13 +26,13 @@
// implementation: Testing of y-monotone partitioning function // implementation: Testing of y-monotone partitioning function
// ============================================================================ // ============================================================================
#include <CGAL/Homogeneous.h> #include <CGAL/Simple_homogeneous.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <CGAL/partition_2.h> #include <CGAL/partition_2.h>
#include <list> #include <list>
#include <cassert> #include <cassert>
typedef CGAL::Homogeneous<double> K; typedef CGAL::Simple_homogeneous<double> K;
typedef K::Point_2 Point_2; typedef K::Point_2 Point_2;
typedef std::list<Point_2> Container; typedef std::list<Point_2> Container;
typedef CGAL::Polygon_2<K, Container> Polygon_2; typedef CGAL::Polygon_2<K, Container> Polygon_2;