Boost logo

Geometry :

Subject: [ggl] Clipping (i.e. intersection) issues, still.
From: Bruno Lalande (bruno.lalande)
Date: 2009-07-07 09:27:22

Hi Barend,

> OK, agree. Do you think the boost::tribool might be convenient for this or
> will we make an enumeration or so? I'll then put some comments in the code
> to remember after preview 5.

Hmm actually I'm not sure we can use tribool at all since I guess we
need something usable at compile time. In my idea, orientation traits
should be accessed with something like "orientation_traits<P>::value".
So it should look like this, for example:

template <>
struct orientation_traits<my_polygon>
    static const boost::tribool value;

const boost::tribool orientation<my_polygon>::value = true;

The problem here is that orientation_traits<P>::value is not an
integral constant, so not usable at compile-time. So you'll have to
treat it with a switch statement which will imply overhead. It's not
the case with this:

enum orientation_type

template <>
struct orientation<my_polygon>
    static const orientation_type value = clockwise;

Here, orientation_traits<P>::value is a real compile-time value, I can
pass it to a class declared as "template <orientation_type> struct
foo" for instance.

So I guess enums are better there... or did you have another idea
about how to implement those traits?


Geometry list run by mateusz at