Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Extract face data from polyhedron
- Date: Thu, 21 Apr 2016 12:00:04 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:i7bZyxW08k2fnek8S4Be9nerQU7V8LGtZVwlr6E/grcLSJyIuqrYZhKDt8tkgFKBZ4jH8fUM07OQ6PCwHzJQqs/Q+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq82VPVUD3Wv1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdXBTBjP2Eu79DwrjHCSxGO7z0SSDY4iB1NVkL+4RvzRYvwvy2yku1n2S6GdY3ZQLcxVCi4/oliQwPvkjZGfXZt62XQkM13kORepDquohV+x8jfZ4TDZ6k2Rb/UYd5PHTkJZc1WTSEUWo4=
- Organization: GeometryFactory
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <fstream>
#include <iostream>
#include <boost/foreach.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef boost::graph_traits<Polyhedron> GT;
typedef GT::vertex_descriptor vertex_descriptor;
typedef GT::face_descriptor face_descriptor;
typedef GT::halfedge_descriptor halfedge_descriptor;
int main(int, char** argv)
{
Polyhedron P;
std::ifstream input(argv[1]);
input >> P;
std::map<vertex_descriptor,int> v2i;
int i=0;
BOOST_FOREACH(vertex_descriptor v, vertices(P)){
std::cout << v->point() << "\n";
v2i.insert(std::make_pair(v,i++));
}
BOOST_FOREACH(face_descriptor f, faces(P))
{
BOOST_FOREACH(vertex_descriptor v,
vertices_around_face(halfedge(f,P),P))
std::cout << v2i[v] << " ";
std::cout << "\n";
}
}
On 04/21/2016 11:17 AM, Zhe Cao wrote:
Hi,
Thank you for your reply. Basically I am using >> operator to initialise the
polyhedron instance from a .off file. Here is the code:
std::ifstream stream(path);
stream >> mySolver.m_poly;
I am not familiar with polyhedron type. So in this way, can I get the type
you mentioned with indices in each vertex, or I need to create my polyhedron
class and override some functions.
Zhe.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Extract-face-data-from-polyhedron-tp4661854p4661856.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Extract face data from polyhedron, Zhe Cao, 04/20/2016
- Re: [cgal-discuss] Extract face data from polyhedron, Sebastien Loriot (GeometryFactory), 04/21/2016
- Re: [cgal-discuss] Extract face data from polyhedron, Zhe Cao, 04/21/2016
- Re: [cgal-discuss] Extract face data from polyhedron, Sebastien Loriot (GeometryFactory), 04/21/2016
- Re: [cgal-discuss] Extract face data from polyhedron, Zhe Cao, 04/21/2016
- Re: [cgal-discuss] Extract face data from polyhedron, Sebastien Loriot (GeometryFactory), 04/21/2016
Archive powered by MHonArc 2.6.18.