Boost logo

Geometry :

Subject: [ggl] combine
From: Barend Gehrels (barend)
Date: 2011-02-28 17:43:39

Hi Adam,

> Yes, the intersection isn't mutable. It's a new object. According to
> my logic it should be returned by the function.
> output = intersection(red, blue);

Right, but not convenient now, to avoid unnecessary copies. As soon as
C++0x is commonplace we can use make_intersection for this one.

> Output iterator should be the last parameter because that is how it is
> implemented and it shouldn't be changed.
> intersection_inserter(red, blue, std::back_inserter(output));


> So, in the case of boxes there could be:
> new_box = make_envelope(box, geometry)
> new_box = expansion(box, geometry)
> boxes_insert(
> geometries_first, geometries_last, boxes_output_iter)
> expand(mut_box, geometry)
> extend(mut_box, geometry)
> Btw, to be completly honest, intersection_inserter should be the name
> of an object, not function. Function's name should be the verb:
> intersection_insert(red, blue, std::back_inserter(output));
> // or some similar name e.g. intersection_copy

Right. I've noticed this earlier but didn't want to change it at that
time. But it is probably better to change it now, now that it is
announced (in December IIRC) that some functions could change. Agree
that insert is better and that inserter is the object.

Note that intersection is the OGC name and we have already "intersects"
returning bool, so I think the name intersection is OK.

So I think that the conclusion is:

1) the order of parameters combine is convenient and logical
2) renaming it to expand makes it more clear

Thanks, Barend

Geometry list run by mateusz at