
Geometry : 
Subject: Re: [geometry] Dissolve rescale_policy
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 20160315 22:36:14
Hi Johan,
Johan Doré wrote:
>
> Dear Boost Geometry
>
> In version 1.60 wonder if there is an reason for the
> *no_rescale_policy* in the dissolve function:
>
Do you mean extensions from develop branch? dissolve() is not a part of
the official release, or am I missing something?
<snip>
>
> Changing it to the robust policy:
>
> inlinevoiddissolve(Geometry const& geometry, Collection&
> output_collection)
>
> {
>
> concept::check<Geometry const>();
>
> typedeftypenameboost::range_value<Collection>::type geometry_out;
>
> concept::check<geometry_out>();
>
> typedeftypenamegeometry::rescale_policy_type
>
> <
>
> typenamegeometry::point_type<Geometry>::type
>
> >::type rescale_policy_type;
>
> rescale_policy_type robust_policy =
> geometry::get_rescale_policy<rescale_policy_type>(geometry);
>
> dispatch::dissolve
>
> <
>
> typenametag<Geometry>::type,
>
> typenametag<geometry_out>::type,
>
> Geometry,
>
> geometry_out
>
> >::apply(geometry, robust_policy, std::back_inserter(output_collection));
>
> }
>
> Seems to correctly dissolve a larger range of invalid polygons.
>
> I therefore wonder if this change I recommendable and should be included?
>
There are some problems with rescaling we discovered recently. Functions
taking two input geometries rescale both geometries in the same time,
functions taking one input geometry rescale only one geometry. In both
cases the geometries are rescaled WRT the size of a bounding box of all
input geometries (so 2 or 1). So the same geometry may be rescaled
differently in both cases depending on a function to which it's passed
and e.g. the size of the other geometry if a function takes two
geometries. And an interesting things may happen during the rescaling.
E.g. the vertices of a geometry may be moved relativelly to each other.
So in rare cases some edges detected e.g. as collinear after being
rescaled differently may be seen as intersecting which means that, e.g.
the output of a set operation may be detected as invalid.
We plan to experiment with a different solution. In a long run I think
this change is not a prefered. However the rest of the library use the
rescaling for Areal geometries so after applying your change dissolve
would be consistent with other algorithms.
Barend what do you think about it?
Regards,
Adam
Geometry list run by mateusz at loskot.net