Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Accessing Facet_handle of a Polyhedron_3 by ID (was: Half-edge representation, CGAL vs OpenMesh)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Accessing Facet_handle of a Polyhedron_3 by ID (was: Half-edge representation, CGAL vs OpenMesh)


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Accessing Facet_handle of a Polyhedron_3 by ID (was: Half-edge representation, CGAL vs OpenMesh)
  • Date: Mon, 17 Jan 2011 08:08:08 +0100

Nicholas Mario Wardhana wrote:
On 13 January 2011 16:21, Sebastien Loriot (GeometryFactory)
<>
wrote:
The Polyhedron_3 class of CGAL documented here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3.html
provides iterator over vertices,facets and halfedges.

Given a facet, you can use Halfedge_around_facet_const_circulator to get the
vertices of a face (using the incident vertex to each halfedge).

See:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3-Traits---Facet.html

I don't want to prevent you from implementing your own data structure if
you think it will be more efficient but you may save time by using an
existing one (in particular because many additional functionalities are
available in CGAL).


S.



Hi Sebastien,

Sorry for my late reply. I have been studying CGAL's polyhedron
deeper, based on the link that you provided. Thank you for your
suggestion two days ago. It turned out that using CGAL we can quickly
have the polyhedron integrated to our code (reading documentation,
wrapper implementation and basic testings only take two days).

I have one question. Currently I use
Polyhedron_incremental_builder_3<Halfedge> to build a polyhedron, and
it is possible to access the vertices of a polyhedron by ID via
Polyhedron_incremental_builder_3<Halfedge>::vertex(). I am just
wondering whether there is a similar method to get a facet of a
polyhedron by inputting the ID, as so far I haven't found such
function. In the current implementation, I have to save every
Facet_handle object returned by
Polyhedron_incremental_builder_3<Halfedge>::begin_facet() in an
external hash_map, with the IDs serving as the keys.

There is nothing to do it directly.
However, note that the Polyhedron has a template parameter to tune
the underlying HDS used.
The HDS can be either base on a lists (the default for Polyhedron) or on vectors. In the case of vectors, you have random access to facets container (using std::advance and facets_begin() for example).

The price you have to pay to use HDS based on vector is that you need to
have an upper bound on the number of vertices, facets and halfedges.

See:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS_ref/Class_HalfedgeDS_list.html#Cross_link_anchor_1121
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS_ref/Class_HalfedgeDS_vector.html#Cross_link_anchor_1122


S.


Thank you.

Best regards,
Nicholas Mario Wardhana





Archive powered by MHonArc 2.6.16.

Top of Page