#include <list>
#include <fstream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Set_movable_separability_2/Single_mold_translational_casting/top_edges.h>
typedef std::pair<Direction_2, Direction_2> Direction_range;
typedef Polygon_2::Edge_const_iterator Edge_iter;
typedef std::pair<Edge_iter, Direction_range> Top_edge;
namespace casting = SMS::Single_mold_translational_casting;
int main(int argc, char* argv[])
{
Polygon_2 polygon;
const char* filename = (argc > 1) ? argv[1] : "polygon.dat";
std::ifstream input_file(filename);
if (! input_file.is_open()) {
std::cerr << "Failed to open the " << filename << std::endl;
return -1;
}
input_file >> polygon;
input_file.close();
if (top_edges.empty())
std::cout << "The polygon is not castable!" << std::endl;
else {
std::cout << "There are " << top_edges.size() << " top edges:" << std::endl;
for (const auto& top_edge : top_edges) {
std::cout
<< "\tEdge: " << *top_edge.first<< std::endl
<< "\tPullout directions from: " << top_edge.second.first
<< " to " << top_edge.second.second
<< std::endl << std::endl;
}
}
return 0;
}