Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL: half-edge-diagram or doubly-connected-edge-list
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-02-19 10:18:18


On Sat, 19 Feb 2011, Anders Wallin wrote:

> Hi group,
> I want to work with meshes that contain vertices, edges, and faces(1)(2).
> I've subclassed adjacency_list and added a std::vector to contain the face-data:
> http://pastebin.com/h4jxpDkt
>
> Is there a better solution? (somewhere in the BGL docs it says
> sublcassing BGL-graphs can be dangerous?)
> How do I provide a graph_traits::face_descriptor for my sublcass? (now
> I am using "unsigned int" for face descriptors)
> How do I allow choice between a vector and a list for storing the vertices?
>
> I have also made my first ever attempt (3) to write some
> template-based code which manipulates this graph class.
> That file has lots and lots of "typedef" "typename" and "graph_traits"
> in it. Are there some macros or tools to simplify this style of
> programming I should be aware of?

Have you looked at CGAL (www.cgal.org)? They do many of the same things
with BGL that you want to do in terms of half-edges and such. In terms of
messy templated code, there is some stuff in
<boost/graph/iteration_macros.hpp>, but your code will still have a lot of
uses of typename and graph_traits. You can typedef graph_traits<G> to
some other name, then typedef the members of it separately.

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net