Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Polyhedron vertex_descriptor

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Polyhedron vertex_descriptor


Chronological Thread 
  • From: Zohar <>
  • To:
  • Subject: Re: [cgal-discuss] Polyhedron vertex_descriptor
  • Date: Tue, 25 Feb 2014 20:26:50 -0800 (PST)


Okay, Julian got it:


"God damn it, right!
This nonsense can be done with template specialization for Polyhedron_3, but
when I subclassed it, then it defaulted to BGL template which didn't know
about vertex_descripor. Feels like solving a riddle. I guess I'm relying too
much on visual assist x to lead me to the definitions.

Nice one Julian."

On 25-Feb-14 23:09, Julian Panetta wrote:
> I'm rusty on CGAL, but things are more complicated than you think. The
> polyhedron doesn't have a vertex_descriptor; vertex_descriptor is a type
> from the boost graph library, not CGAL. However, I can see why you thought
> it did:
>
> Instantiating boost::graph_traits<CGAL::Polyhedron_3&lt;Kernel> const>
> works fine, and the definition of boost::graph_traits<G> references
> G::vertex_descriptor. So CGAL::Polyhedron_3 must have a vertex_descriptor,
> right? Nope! The file CGAL/boost/graph/graph_traits_Polyhedron_3.h is
> indirectly included, which contains the overload:
>
> template<class Gt, class I, CGAL_HDS_PARAM_, class A>
> struct graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const >
> : CGAL::HDS_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> > // See NOTE
> above!
> {};
>
> So when you instantiate boost::graph_traits with template parameter
> Polyhedron_3, you're not getting boost's graph_traits at all, but rather
> CGAL's version which knows vertex_descriptor for the halfedge graph is
> really Polyhedron's Vertex_handle. But when you instantiate graph_traits
> with your subclass, the overridden definition isn't used and things break.
> You can probably use a similar overload, or just use HDS_graph_traits
> instead of boost::graph_traits in your code. This all seems a bit hacky on
> CGAL's part, but it's probably explained in the documentation somewhere.
>
> -Julian



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Polyhedron-vertex-descriptor-tp4658859p4658860.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page