From 7c643baa6ff0145d97dab36d53a7183995b75724 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 12 Jul 2009 07:02:38 +0000 Subject: [PATCH] cleanup --- .../test_connect_holes.cpp | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_connect_holes.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_connect_holes.cpp index 4e62dd43ebd..e155fe33d47 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_connect_holes.cpp +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_connect_holes.cpp @@ -1,5 +1,3 @@ - - /*! \file test_connect_holes.cpp * Connecting a polygon with holes. */ @@ -21,7 +19,6 @@ #endif #endif - #include #include #include @@ -38,29 +35,29 @@ typedef Polygon_with_holes_2::Hole_const_iterator Hole_const_iterator; typedef Polygon_with_holes_2::Hole_iterator Hole_iterator; //compute the area of a polygon with holes -FT pwh_area(Polygon_with_holes_2 pwh) { - Polygon_2 outerP = pwh.outer_boundary(); - FT result = outerP.area(); - if (! pwh.has_holes()) - return result; - Hole_const_iterator hit = pwh.holes_begin(); - while (hit != pwh.holes_end()) { - FT curHoleArea= (*hit).area(); - result = result + curHoleArea; - ++hit; - } - //std::cout<< "The input pwh area is: " << result << std::endl; - return result; +FT pwh_area(Polygon_with_holes_2 pwh) +{ + Polygon_2 outerP = pwh.outer_boundary(); + FT result = outerP.area(); + if (! pwh.has_holes()) + return result; + Hole_const_iterator hit = pwh.holes_begin(); + while (hit != pwh.holes_end()) { + FT curHoleArea= (*hit).area(); + result = result + curHoleArea; + ++hit; + } + //std::cout<< "The input pwh area is: " << result << std::endl; + return result; } - -bool testExampleFile(const char* filename) { - +bool testExampleFile(const char* filename) +{ // Read a polygon with holes from a file. std::ifstream input_file (filename); if (! input_file.is_open()) { - std::cerr << "Failed to open the " << filename <> si; std::string filename = testfilePrefix + si + testfileSuffix; - const char *cfilename = filename.c_str(); + const char * cfilename = filename.c_str(); bool res = testExampleFile(cfilename); if (!res) { std::cout << "test " << i << " was a bitter failure" << std::endl; - result=1; + result = 1; } else { std::cout <<"test " << i << " was a great success" << std::endl; } } - if (result==0) + if (result == 0) std::cout << "ALL TESTS SUCCEEDED!" << std::endl; return result; }