diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/read_polygon.h b/Minkowski_sum_2/test/Minkowski_sum_2/read_polygon.h index 1d7f98b4d2d..52e75d72157 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/read_polygon.h +++ b/Minkowski_sum_2/test/Minkowski_sum_2/read_polygon.h @@ -14,43 +14,17 @@ template bool read_polygon (const char *filename, CGAL::Polygon_2& pgn) { - // Open the input file. - std::ifstream ifile (filename); - - if (! ifile.is_open()) - { - std::cerr << "Failed to open <" << filename << ">." << std::endl; - return (false); - } - - // Read the polygon. - int n_vertices = 0; - typename Kernel::FT x, y; - std::list vertices; - int k; - - // Read the number of polygon vertices. - ifile >> n_vertices; - - // Read the vertices. - for (k = 0; k < n_vertices; k++) - { - ifile >> x >> y; - - vertices.push_back (typename Kernel::Point_2 (x, y)); - } - ifile.close(); - - pgn = CGAL::Polygon_2 (vertices.begin(), vertices.end()); + std::ifstream ifile(filename); + ifile >> pgn; // Make sure the polygon is simple. if (! pgn.is_simple()) { std::cerr << "Error - the polygon is not simple." << std::endl; - return (false); + return false; } - return (true); + return true; } template