cgal/Subdivision_method_3/examples/Subdivision_method_3/Loop_subdivision.C

38 lines
855 B
C

// file: examples/Subdivision_method_3/Loop_subdivision.C
#include <CGAL/Subdivision_method_3.h>
#include <iostream>
#include <fstream>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
typedef CGAL::Cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
using namespace std;
using namespace CGAL;
int main(int argc, char **argv) {
if (argc != 3) {
cout << "Usage: Loop_subdivision filename d" << endl;
cout << " filename: the input mash (.off)" << endl;
cout << " d: the depth of the subdivision (0 < d < 10)" << endl;
exit(1);
}
ifstream in(argv[1]);
int d = argv[2][0] - '0';
Polyhedron P;
in >> P; // read the .off
Subdivision_method_3::Loop_subdivision(P,d);
cout << P; // write the .off
return 0;
}