void arrangement::offset_of_polygon(Polygon_2 P, int diametre, std::vector<Offset_polygon_with_holes_2> &off) { Conic_traits_2 traits; const Rational radius = Rational(diametre,2); Offset_polygon_with_holes_2 offset; offset = offset_polygon_2 (P, radius, traits); off.push_back(offset); }
int main () { // Open the input file. std::ifstream in_file ("spiked.dat"); if (! in_file.is_open()) { std::cerr << "Failed to open the input file." << std::endl; return (1); } // Read the input polygon. Polygon_2 P; in_file >> P; in_file.close(); std::cout << "Read an input polygon with " << P.size() << " vertices." << std::endl; // Compute the offset polygon. Conic_traits_2 traits; const Rational radius = 5; Offset_polygon_with_holes_2 offset; CGAL::Timer timer; timer.start(); offset = offset_polygon_2 (P, radius, traits); timer.stop(); std::cout << "The offset polygon has " << offset.outer_boundary().size() << " vertices, " << offset.number_of_holes() << " holes." << std::endl; std::cout << "Offset computation took " << timer.time() << " seconds." << std::endl; return (0); }