diff --git a/Packages/Partition_2/test/Partition_2/convex_partition_2_test.C b/Packages/Partition_2/test/Partition_2/convex_partition_2_test.C deleted file mode 100644 index 9d391dbadca..00000000000 --- a/Packages/Partition_2/test/Partition_2/convex_partition_2_test.C +++ /dev/null @@ -1,292 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// release : $CGAL_Revision $ -// release_date : $CGAL_Date $ -// -// file : include/CGAL/convex_partiton_2_test.C -// package : $CGAL_Package: Partition_2 1.0 (27 Jul 2000) $ -// chapter : Planar Polygon Partitioning -// -// revision : $Revision$ -// revision_date : $Date$ -// -// author(s) : Susan Hert -// maintainer : Susan Hert -// -// coordinator : MPI (Susan Hert ) -// -// implementation: Testing of convex partitioning functions -// ============================================================================ - -#include -#include -#include -#include -#include -#include -#include -#include - -typedef CGAL::Cartesian CR; -typedef CR::Point_2 CPoint_2; -typedef CGAL::Polygon_traits_2 CTraits; -typedef std::list CContainer; -typedef CGAL::Polygon_2 CPolygon_2; - -typedef CGAL::Homogeneous HR; -typedef HR::Point_2 HPoint_2; -typedef CGAL::Polygon_traits_2
HTraits; -typedef std::list HContainer; -typedef CGAL::Polygon_2 HPolygon_2; - -template -void make_convex_w_collinear_points(Polygon_2& polygon) -{ - typedef typename Polygon_2::Point_2 Point_2; - - polygon.push_back(Point_2(140, 226)); - polygon.push_back(Point_2(293, 226)); - polygon.push_back(Point_2(335, 226)); - polygon.push_back(Point_2(358, 226)); - polygon.push_back(Point_2(358, 264)); - polygon.push_back(Point_2(358, 286)); - polygon.push_back(Point_2(358, 315)); - polygon.push_back(Point_2(358, 334)); - polygon.push_back(Point_2(297, 334)); - polygon.push_back(Point_2(246, 334)); - polygon.push_back(Point_2(211, 334)); - polygon.push_back(Point_2(163, 334)); - polygon.push_back(Point_2(146, 307)); - polygon.push_back(Point_2(132, 278)); - polygon.push_back(Point_2(132, 259)); - polygon.push_back(Point_2(132, 249)); - polygon.push_back(Point_2(132, 236)); - -} - -template -void make_monotone_convex(Polygon_2& polygon) -{ - typedef typename Polygon_2::Point_2 Point_2; - - polygon.push_back(Point_2(239, 108)); - polygon.push_back(Point_2(358, 170)); - polygon.push_back(Point_2(387, 305)); - polygon.push_back(Point_2(340, 416)); - polygon.push_back(Point_2(215, 432)); - polygon.push_back(Point_2(106, 358)); - polygon.push_back(Point_2(106, 236)); - polygon.push_back(Point_2(138, 162)); -} - -template -void make_nonconvex_w_collinear_points(Polygon_2& polygon) -{ - typedef typename Polygon_2::Point_2 Point_2; - - polygon.push_back(Point_2(129, 147)); - polygon.push_back(Point_2(232, 147)); - polygon.push_back(Point_2(344, 147)); - polygon.push_back(Point_2(365, 234)); - polygon.push_back(Point_2(239, 251)); - polygon.push_back(Point_2(249, 210)); - polygon.push_back(Point_2(190, 212)); - polygon.push_back(Point_2(205, 323)); - polygon.push_back(Point_2(104, 323)); - polygon.push_back(Point_2(104, 279)); - polygon.push_back(Point_2(104, 243)); -} - -template -void make_nonconvex(Polygon_2& polygon) -{ - typedef typename Polygon_2::Point_2 Point_2; - - polygon.push_back(Point_2(391, 374)); - polygon.push_back(Point_2(240, 431)); - polygon.push_back(Point_2(252, 340)); - polygon.push_back(Point_2(374, 320)); - polygon.push_back(Point_2(289, 214)); - polygon.push_back(Point_2(134, 390)); - polygon.push_back(Point_2( 68, 186)); - polygon.push_back(Point_2(154, 259)); - polygon.push_back(Point_2(161, 107)); - polygon.push_back(Point_2(435, 108)); - polygon.push_back(Point_2(208, 148)); - polygon.push_back(Point_2(295, 160)); - polygon.push_back(Point_2(421, 212)); - polygon.push_back(Point_2(441, 303)); -} - -template -void test_optimal_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_monotone_convex(polygon); - CGAL::optimal_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - assert (partition_polys.size() == 1 && - partition_polys.front().size() == polygon.size()); - assert(CGAL::is_convex_2(partition_polys.front().vertices_begin(), - partition_polys.front().vertices_end())); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_convex_w_collinear_points(polygon); - CGAL::optimal_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex_w_collinear_points(polygon); - CGAL::optimal_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::optimal_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - -template -void test_one_optimal_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::optimal_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - -template -void test_approx_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_monotone_convex(polygon); - CGAL::approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - assert (partition_polys.size() == 1 && - partition_polys.front().size() == polygon.size()); - assert(CGAL::is_convex_2(partition_polys.front().vertices_begin(), - partition_polys.front().vertices_end())); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_convex_w_collinear_points(polygon); - CGAL::approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex_w_collinear_points(polygon); - CGAL::approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - - -template -void test_one_approx_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - -template -void test_greene_approx_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_monotone_convex(polygon); - CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - assert (partition_polys.size() == 1 && - partition_polys.front().size() == polygon.size()); - assert(CGAL::is_convex_2(partition_polys.front().vertices_begin(), - partition_polys.front().vertices_end())); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_convex_w_collinear_points(polygon); - CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex_w_collinear_points(polygon); - CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); - - partition_polys.clear(); - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - -template -void test_one_greene_approx_convex(Polygon_2& polygon) -{ - std::list partition_polys; - - polygon.erase(polygon.vertices_begin(), polygon.vertices_end()); - make_nonconvex(polygon); - CGAL::greene_approx_convex_partition_2(polygon.vertices_begin(), - polygon.vertices_end(), - std::back_inserter(partition_polys)); -} - -int main(void) -{ - CPolygon_2 c_polygon; - HPolygon_2 h_polygon; - test_optimal_convex(c_polygon); - test_one_optimal_convex(h_polygon); - test_approx_convex(c_polygon); - test_one_approx_convex(h_polygon); - test_greene_approx_convex(c_polygon); - test_one_greene_approx_convex(h_polygon); - - return 0; -}