[Boost-bugs] [Boost C++ Libraries] #10713: Boost Geometry dissolve

Subject: [Boost-bugs] [Boost C++ Libraries] #10713: Boost Geometry dissolve
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-29 14:07:01

#10713: Boost Geometry dissolve
 Reporter: jdh@… | Owner: barendgehrels
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
 Dear Boost Geometry Contributors

 I was testing out the new 1.57 beta therefore also downloaded the latest
 \geometry\extensions\algorithms\dissolve.hpp file.

 Testing that I stumbled upon a strange thing which I thought would be
 interesting for you.

 Using the below example:

 using namespace boost::geometry;
 using namespace boost::geometry::model;
 using namespace boost::geometry::model::d2;

 int _tmain(int argc, _TCHAR* argv[])
   polygon<point_xy<float>> Poly;
   read_wkt("POLYGON((-0.7189743518829346 4.1308121681213379,
 0.0831791982054710 4.1034231185913086, 0.1004156470298767
 4.1107301712036133, 0.1044322624802589 4.1026973724365234,
 0.0831791982054710 4.1034231185913086, -0.7711903452873230
 3.7412264347076416, -0.7189743518829346 4.1308121681213379))", Poly);

   multi_polygon<polygon<point_xy<float>>> Dissolved;
   boost::geometry::dissolve(Poly, Dissolved);
   return 0;

 I find that dissolve gives me 2 polygons back with 5 outline points in
 each. However the input polygon is like two triangles touching each other
 so I was expecting an output of two polygons with each 4 points.

 I then looked at the dissolve.hpp and wondered if it could be because of
 the no_rescale_policy() specified in the dissolve function. Modified the
 function to use the rescale policy found in other of your geometry

 inline void dissolve(Geometry const& geometry, Collection&
   concept::check<Geometry const>();

   typedef typename boost::range_value<Collection>::type geometry_out;


   typedef typename geometry::point_type<Geometry>::type point_type;
   typedef typename geometry::rescale_policy_type<point_type>::type

   rescale_policy_type robust_policy =

     typename tag<Geometry>::type,
     typename tag<geometry_out>::type,
>::apply(geometry, robust_policy,

 Doing so made the dissolve function return two polygons with each 4

 I then ran a lot of different other tests and none of those failed for me.

 I therefore wonder if there is a reason for the no_rescale_policy() or if
 it is better to use the “robust_policy”

 Best regards and thanks a lot for this great library

 Johan Doré

Ticket URL: <https://svn.boost.org/trac/boost/ticket/10713>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC