Subject: CGAL users discussion list
List archive
- From: Andreas Fabri <>
- To:
- Subject: Re: [cgal-discuss] Polyhedron_3 I/O problem
- Date: Tue, 9 May 2017 08:57:10 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:yTDg1RVJQBvjvSi2S/zRXhZrGmvV8LGtZVwlr6E/grcLSJyIuqrYbBOAt8tkgFKBZ4jH8fUM07OQ6PG8HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjSwbLd9IRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W/KlMJwgqJVoBWiqRJxzYHbb4OaO+Zlc6PYYd8XX3BMUtpfWiFBBI63cosBD/AGPeZdt4Twu10OogakBQayHuzv0SJDiH/s0qIhyeQhEBzN0Qs6ENIIrXvUtsv6O70JUeyvwqnH1y7Mb+lX2Trm54jHbBchofSSUrJsa8rQyUcvGBnZgVWMrozlJTOU2v4RvGic6uptTOSigHMppQF2pzig3MYsio/Ri4IT0F/L7j52wIIrKtGiVEF7ZtukHINMuCGVLYR2RtkuQ2ZyuCY10rEGvJ+7fDQQxJs52hHfdvqKeJWL7BL7TOucLjZ1iGh4dL6jhxu+60etx+PmWsWpzFpHrjJJn9bNu3wXyhDe6caKRuFy80qlwzqDyg7e5+5CLEspj6TUMYQhzaQ1lpcLsUTMACv2mELugaKWbEkk/++o5uXjb7n8o5+TLY50igXnPqQph8y/Hf40Mg8QX2ib4+i80qPs/VHhTLVLiP05jLXZvYjVKMkavKK1HhNZ34Y55xuwATqqyskUkWUHIV5dfRKIlYnpO1XAIPDiCve/hkyhny1tx//bJL3uHI/CLmPZnLfvZ7ly8FRcyAsowNBQ+Z1UDbQBL+zvWk/rtN3YAAU2PBCow+bgEtV81pkSVn6IAq+cKK/Sq0OH5vozI+mQY48YoCryK/c/6P7qlHM2hF4dfbK10psKc3C4Be9rI16ZYHrpmtcOC30Gvgs4TOzwiV2NSyRfZ3ioX/F02jZuA42vCcLPR5umnaea9Ca9BJxfIG5cWX6WFnK9XoOIQfoFc2q8K8V7k3RQXL6tUYIozlegvQXgypJoI+3R9zECpJzq38Ry/fyVnhY3o28nR/+B2n2AGjkn1lgDQCU7ifhy
- Organization: GeometryFactory
Hello,
The problem is that the mesh is not a 2-manifold,
that is there are edges with > 2 incident faces.
I marked those zones red in the screenshot.
What you can do: Look at the polygon soup example:
http://doc.cgal.org/latest/Polygon_mesh_processing/index.html#title27
This allows you to read a polygon soup, and to orient it.
However this will duplicate vertices and produce
a mesh with self intersections. Some of them are
relatively easy to remove, and we work on it.
Best,
Andreas
On 08/05/2017 07:03, BRYang wrote:
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.
--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project
phone: +33.492.954.912 skype: andreas.fabri
Attachment:
mouth.PNG
Description: PNG image
- [cgal-discuss] Polyhedron_3 I/O problem, BRYang, 05/08/2017
- Re: [cgal-discuss] Polyhedron_3 I/O problem, BRYang, 05/08/2017
- Re: [cgal-discuss] Polyhedron_3 I/O problem, Andreas Fabri, 05/09/2017
- Re: [cgal-discuss] Polyhedron_3 I/O problem, BRYang, 05/10/2017
Archive powered by MHonArc 2.6.18.