Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Polyhedron_3 I/O problem

Subject: CGAL users discussion list

List archive

[cgal-discuss] Polyhedron_3 I/O problem


Chronological Thread 
  • From: BRYang <>
  • To:
  • Subject: [cgal-discuss] Polyhedron_3 I/O problem
  • Date: Sun, 7 May 2017 22:03:17 -0700 (PDT)
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Fail ; spf=None
  • Ironport-phdr: 9a23:YRS0iRajkNhR/vaZkvyxbEn/LSx+4OfEezUN459isYplN5qZoMmzbnLW6fgltlLVR4KTs6sC0LuK9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6ybL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjul86pmRh7lhSMeOzIk7G3cl8h8gaxHrB69ohByxZPfboOIO/pkZq7Tc9MUS3RCUMhMWCNOHoyyYpATD+cDJ+tUs5Xxq0cQoRa4GAKiBPnvyjhNhnLuwKA0z+YuHhvA3AwvAtkDt3TVo87vNKoJXuG1ybTIwS/dYPxLxDfx8pTHchY4rPyKQLl+f83RyUw1GAPEiFWdsYrlMCmO2esWt2iU8fBsWv6oi24isw1xpzmvxts2hobXm40V11bJ/jh6zoYtPdC0VU92bcC+HJdOtyyXOZF6Tt4sTmxmoio3xbMLtYamcCUL1pgr3QDTZvyJfoSS/x7uWuicLS14iX9nfr+0mgy8/lK6yuLmU8m5yFZKoTRBktnLrn0N0hLS6s+dSvt+5Euh3yyA2BvI5eFAP084j7bUK5kkwrIol5oTt1rMHjPulUnrjaKaaF8o9vao5unpeLnqu5GROoFuhgzxPKkigsm/Dv45MggKUWib4+O81Lj78Ez5W7pKlOY7k6bcsJDHP8gUuLO2AxJP3ok/7RazFy2m38gAnXkbMFJFfwqKgJTmO17UJPD0FOqwg1W3kDh32vDGJabhD47WLnnDlbfhZaxy51RdyAo119Bf5ohbBqsPIPLpCQfNs4nTARY9dgC12O36E85V14UEWGvJDLXKHrnVtAqi3NMmJebEMJ4foh7tLuVj6vLzy3Q/zwxONZK11IcaPSnrVs9tJF+UNCG02to=

Hi,

I got some issue with Polyhedron_3 I/O stuff. I have two polyhedron .off
files which I downloaded from MIT's
website(https://people.csail.mit.edu/sumner/research/deftransfer/data.html#download)
and I used Meshlab to export them as .off files. I use the following code
to read in the files

----------------------------------
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;

/// read the horse.off file
Polyhedron horse;
std::ifstream OpenFile("horse.off");
OpenFile >> horse;
OpenFile.close();
std::cout<< "horse is valid ? " << horse.is_valid() << std::endl; // true
std::cout<< "size of facets ? " << horse.size_of_facets() << std::endl; //
This is O.K, size of polyhedron is correct.
----------------------------------

/////////////////////////////////
However, when I use the following code for the camel.off file, the mesh
could not be read correctly.
----------------------------------
Polyhedron camel;
std::ifstream OpenFile("camel.off");
OpenFile >> camel;
OpenFile.close();
std::cout<< "camel is valid ? " << camel.is_valid() << std::endl; // true
std::cout<< "size of facets ? " << camel.size_of_facets() << std::endl; //
size of polyhedron is incorrect.
----------------------------------

It seems that CGAL does not handle the camel case correctly.
And I checked the following link
http://cgal-discuss.949826.n4.nabble.com/Binary-Polyhedron-3-I-O-questions-td951182.html#a951191,
and updated the code for camel case to be like this:

-------------------------------
Polyhedron camel;
std::ifstream OpenFile("camel.off",std::ios::binary);
CGAL::set_binary_mode(OpenFile);
OpenFile >> camel;
OpenFile.close();
std::cout<< "camel is valid ? " << camel.is_valid() << std::endl; // true
std::cout<< "size of facets ? " << camel.size_of_facets() << std::endl; //
size of polyhedron is incorrect.
-------------------------------

However, the result is still wrong. Is this a bug or am I missing something
to read the file correctly?

Thanks.

Monica



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Polyhedron-3-I-O-problem-tp4662716.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page