Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Binary Polyhedron_3 I/O questions

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Binary Polyhedron_3 I/O questions


Chronological Thread 
  • From: Laurent Rineau <>
  • To:
  • Subject: Re: [cgal-discuss] Binary Polyhedron_3 I/O questions
  • Date: Wed, 19 Nov 2008 10:53:33 +0100

On Monday 17 November 2008 23:26:57 Joe C wrote:
> Hi,
>
> I got some issue with Polyhedron_3 I/O stuff. I have two polyhedron .off
> files in ascii mode (poly_ascii.off) and binary mode (poly_binary.off)
> respectively. They are the same polyhedron, the only difference is that one
> is in ascii mode and the other is in binary mode. I use the following code
> snipet to read in the files
>
> typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
> typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
>
> // Read in ascii file
> Polyhedron poly_ascii;
> std::ifstream OpenFile("poly_ascii.off");
> OpenFile >> poly_ascii;
> OpenFile.close();
>
> std::cout<< "poly is valid ? " << poly_ascii.is_valid() << std::endl; //
> true
> std::cout<< "size of facets ? " << poly_ascii.size_of_facets() <<
> std::endl; // This is O.K, size of polyhedron is correct.
>
> /////////////////////////////////
> // Read in binary file, replacing the above code
> Polyhedron poly_binary;
> std::ifstream OpenFile("poly_binary.off");
> OpenFile >> poly_binary;
> OpenFile.close();
>
> std::cout<< "poly is valid ? " << poly_binary.is_valid() << std::endl;
> //true std::cout<< "size of facets ? " << poly_binary.size_of_facets() <<
> std::endl; // This is NOT O.K, size of polyhedron is zero.
>
>
> It seems that CGAL does not handle the binary case correctly. Is this a bug
> or am I missing something to read the binary file right?

It seems that your binary file is corrupted. It cannot be opened by Geomview.
I have verified with an hex editor, and it is really corrupted. I have seen
several character 0x0A inserter randomly in the file.

Most probably your platform is a Windows one, and you have created that
binary
file without setting "std::ios::binary" as open mode.

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/



Archive powered by MHonArc 2.6.16.

Top of Page