Hi,
Boost Geometry 1.78, linux
Â
I was getting bad results with my calculations so I decided to narrow
down the implementation up to the point I got the following problematic
code:
Â
typedef boost::geometry::model::point Vector2d;
Â
int main (){
Â
       multi_polygon mp;
Â
       /*{
               polygon <Vector2d> poly;
Â
               poly.outer().push_back( {0, 0} );
               poly.outer().push_back( {0, 4} );
               poly.outer().push_back( {4, 4} );
               poly.outer().push_back( {4, 0} );
Â
               correct( poly );
Â
               mp.push_back(poly);
       }*/
       {
               polygon <Vector2d> poly;
Â
               poly.outer().push_back( {10, -1} );
               poly.outer().push_back( {14, -1} );
               poly.outer().push_back( {10, -2} );
               poly.outer().push_back( {14, -2} );
Â
               correct( poly );
Â
               mp.push_back(poly);
       }
Â
Â
       boost::geometry::strategy::buffer::join_miter
join_strategy;
       boost::geometry::strategy::buffer::end_flat
end_strategy;
       boost::geometry::strategy::buffer::side_straight
side_strategy;
       boost::geometry::strategy::buffer::point_square
point_strategy;
Â
       boost::geometry::strategy::buffer::distance_symmetric
<double> distance_strategy( 2 );
       boost::geometry::model::multi_polygon result;
Â
       boost::geometry::buffer( mp, result, distance_strategy,
side_strategy, join_strategy, end_strategy, point_strategy );
Â
       cout << dsv( result ) << endl;
Â
       return 0;
Â
}
Â
and the result I get is:
((((13.7169, -3.13232), (13.5149, -3.94029), (12, -3.56155), (10.4851,
-3.94029), (10.2831, -3.13232), (9.51493, -2.94029), (0.0749244,
0.221833), (10, 1), (14, 1), (23.9251, 0.221833), (14.4851, -2.94029),
(13.7169, -3.13232))))
Â
Notice the two points:
(0.0749244, 0.221833) and (23.9251, 0.221833)
Â
I have multiple complex (concave) shapes which behave worse than that
simple rectangle. But it is a starting point here.
Â
Did I do something wrong?
I need to get my job done, any alternative or helping code massaging ?
Â
Thanks
--Â
MKL
Â