Subject: CGAL users discussion list
List archive
- From: Yang Qu <>
- To:
- Subject: Re: [cgal-discuss] Cannot read Polyhedron from OFF .
- Date: Fri, 05 Dec 2008 03:25:35 +1000
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=O08YTpRbKttO1Z2cE9m8hLwNjEFIK5+KTWyMVbXEm41+F+2RwBYfNx7Yb6ZhTQ9pET uIUs9LsptSJcVZhpk1m9COh9y3JJp2EjWl4O9L3dxUIa4tQkUija9bIE515R/o+jmYWj HRIb5/08/L4ZDzI2vf4rYcuAt8qBUURTpTpBk=
写道:
Hi,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;
I tested your first piece of code, and it's ok to me. The size of vertices is printed out.
Cheers,
Yang
- [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.