views:

28

answers:

0

Hello,

I am trying to learn how to use half-edge data structures in CGAL, and I am confused by the following sample of code provided on their website

#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>

struct Traits { typedef int Point_2; };
typedef CGAL_HALFEDGEDS_DEFAULT<Traits> HDS;
typedef CGAL::HalfedgeDS_decorator<HDS> Decorator;

int main() {
    HDS hds;
    Decorator decorator(hds);
    decorator.create_loop();
    CGAL_assertion( decorator.is_valid());
    return 0;
}

What kind of a construct is struct Traits { typedef int Point_2; }? What purpose does it serve? Also, what does the decorator do?

Maybe, these questions stem from my inexperience with C++ generic programming, but I would be very grateful if somebody could explain them to me.