the check for the correct file format was not properly.

Now the demo program only accepts OFF files, but
in exchange all OFF files
This commit is contained in:
Peter Hachenberger 2009-07-27 11:27:57 +00:00
parent 799f6c902e
commit 0c1ccdb423
1 changed files with 9 additions and 19 deletions

View File

@ -1,7 +1,4 @@
#include <CGAL/basic.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Lazy_kernel.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Nef_3/SNC_indexed_items.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Nef_polyhedron_3.h>
@ -13,23 +10,16 @@
#include <fstream>
#include <iostream>
typedef CGAL::Lazy_kernel<CGAL::Simple_cartesian<CGAL::Gmpq> > Kernel;
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel,CGAL::SNC_indexed_items> Nef_polyhedron;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
bool loadFile(char* filename, Nef_polyhedron& N) {
bool loadFile(char* filename, Nef_polyhedron& N)
{
std::ifstream in(filename);
std::ifstream test(filename);
char c;
test >> c;
if(c!='S' && c!='O') return false;
if(c == 'S')
in >> N;
else {
Polyhedron P;
in >> P;
N = Nef_polyhedron(P);
}
Polyhedron P;
in >> P;
N = Nef_polyhedron(P);
return true;
}
@ -39,11 +29,11 @@ int main(int argc, char* argv[]) {
Nef_polyhedron N0, N1;
if(!loadFile(argv[1], N0)) {
std::cerr << "parameter 1 is not a valid input file" << std::endl;
std::cerr << "parameter 1 is not a valid OFF file" << std::endl;
return 0;
}
if(!loadFile(argv[2], N1)) {
std::cerr << "parameter 2 is not a valid input file" << std::endl;
std::cerr << "parameter 2 is not a valid OFF file" << std::endl;
return 0;
}