use std::cin for input off file in the examples

This commit is contained in:
Le-Jeng Shiue 2006-03-07 05:35:35 +00:00
parent ad640e92f0
commit 00b9eec7bc
4 changed files with 22 additions and 30 deletions

View File

@ -3,7 +3,6 @@
#include <CGAL/Subdivision_method_3.h>
#include <iostream>
#include <fstream>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
@ -16,18 +15,17 @@ using namespace std;
using namespace CGAL;
int main(int argc, char** argv) {
if (argc != 3) {
cout << "Usage: CatmullClark_subdivision filename d" << endl;
cout << " filename: the input mash (.off)" << endl;
if (argc != 2) {
cout << "Usage: CatmullClark_subdivision d < filename" << endl;
cout << " d: the depth of the subdivision (0 < d < 10)" << endl;
cout << " filename: the input mash (.off)" << endl;
exit(1);
}
ifstream in(argv[1]);
int d = argv[2][0] - '0';
int d = argv[1][0] - '0';
Polyhedron P;
in >> P; // read the .off
cin >> P; // read the .off
Subdivision_method_3::CatmullClark_subdivision(P,d);

View File

@ -4,7 +4,6 @@
#include <cstdio>
#include <iostream>
#include <fstream>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
@ -18,7 +17,7 @@ using namespace CGAL;
// ======================================================================
template <class Poly>
class WLoop_stencil_3 {
class WLoop_mask_3 {
typedef Poly Polyhedron;
typedef typename Polyhedron::Vertex_iterator Vertex_iterator;
@ -86,20 +85,19 @@ public:
};
int main(int argc, char **argv) {
if (argc != 3) {
cout << "Usage: Customized_subdivision filename d" << endl;
cout << " filename: the input mash (.off)" << endl;
if (argc != 2) {
cout << "Usage: Customized_subdivision d < filename" << endl;
cout << " d: the depth of the subdivision (0 < d < 10)" << endl;
cout << " filename: the input mash (.off)" << endl;
exit(1);
}
ifstream in(argv[1]);
int d = argv[2][0] - '0';
int d = argv[1][0] - '0';
Polyhedron P;
in >> P; // read the .off
cin >> P; // read the .off
Subdivision_method_3::PTQ(P, WLoop_stencil_3<Polyhedron>(), d);
Subdivision_method_3::PTQ(P, WLoop_mask_3<Polyhedron>(), d);
cout << P; // write the .off

View File

@ -3,7 +3,6 @@
#include <CGAL/Subdivision_method_3.h>
#include <iostream>
#include <fstream>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
@ -16,18 +15,17 @@ using namespace std;
using namespace CGAL;
int main(int argc, char **argv) {
if (argc != 3) {
cout << "Usage: DooSabin_subdivision filename d" << endl;
cout << " filename: the input mash (.off)" << endl;
if (argc != 2) {
cout << "Usage: DooSabin_subdivision d < filename" << endl;
cout << " d: the depth of the subdivision (0 < d < 10)" << endl;
cout << " filename: the input mash (.off)" << endl;
exit(1);
}
ifstream in(argv[1]);
int d = argv[2][0] - '0';
int d = argv[1][0] - '0';
Polyhedron P;
in >> P; // read the .off
cin >> P; // read the .off
Subdivision_method_3::DooSabin_subdivision(P,d);

View File

@ -3,7 +3,6 @@
#include <CGAL/Subdivision_method_3.h>
#include <iostream>
#include <fstream>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
@ -16,18 +15,17 @@ 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;
if (argc != 2) {
cout << "Usage: Loop_subdivision d < filename" << endl;
cout << " d: the depth of the subdivision (0 < d < 10)" << endl;
cout << " filename: the input mash (.off)" << endl;
exit(1);
}
ifstream in(argv[1]);
int d = argv[2][0] - '0';
int d = argv[1][0] - '0';
Polyhedron P;
in >> P; // read the .off
cin >> P; // read the .off
Subdivision_method_3::Loop_subdivision(P,d);