Subject: CGAL users discussion list
List archive
- From: <>
- To:
- Subject: [cgal-discuss] Cannot read Polyhedron from OFF .
- Date: Thu, 4 Dec 2008 17:42:07 +0100 (CET)
Hi,
I am a newbie to CGAL. I was writing a code to access OFF files. I am not able
to access the properties of mesh. Could some one please point out where I am
making the mistake.
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <iostream>
#include <istream>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
int main() {
std::ifstream stream("test.off");
Polyhedron P;
stream >> P;
std::cout << "\n "<<P.size_of_vertices();
return 0;
}
I even used the following code snippet but still not able to fetch the mesh in
<Polyhedron>P (no ERRORS were thrown).
istream* p_in = &cin;
ifstream in;
in.open("test.off");
p_in = ∈
if ( !in)
{
cerr << "ERROR: cannot open file for reading.";
exit( 1);
}
if ( !(*p_in)) {
cerr << "ERROR: file not in OFF format or error while
reading";
exit( 1);
}
Polyhedron P;
(*p_in) >> P;
- [cgal-discuss] Cannot read Polyhedron from OFF ., nikhilnavkar, 12/04/2008
- Re: [cgal-discuss] Cannot read Polyhedron from OFF ., Yang Qu, 12/04/2008
- Re: [cgal-discuss] Cannot read Polyhedron from OFF ., Laurent Rineau, 12/04/2008
Archive powered by MHonArc 2.6.16.