Boost logo

Geometry :

Subject: Re: [geometry] registered rings
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-09-03 17:47:28


Hi Alessandro,

On 3-9-2013 22:28, Alessandro Ranellucci wrote:
> Hello!
> I have two questions about BOOST_GEOMETRY_REGISTER_RING().
>
> The first one is: how can I specify I want my rings to be counter-clockwise and open? I.e. the two bools that are available when defining a model::ring. I can't see how to set them using the above macro.

Cannot be done with the macro, you will have to register your rings
manually (see the examples, e.g. c08_custom_non_std_example.cpp )

>
> The second one is about using convex_hull() with a registered ring as second argument (output). It failed to compile because my class hasn't got const_reference. How should I do?

It can always be made const by passing it as an const argument to a
function. If you are really in the main you can assign it first to a
const reference and then pass it. Or (if you really want this...) cast
it as const ref...

> However, it succeeded (and works too) if I supply a generic std::vector<point_type> as output argument, which is non-documented behavior since it's not a known geometry. Also, such std::vector is populated assuming clockwise and closed loops.

OK... Indeed I forgot that - this is because of the similarity between
this version and the version with the output-iterator. It is not checked
on purpose. Have to be documented indeed.

>
> Thanks for clarifying! :)

Regards, Barend


Geometry list run by mateusz at loskot.net