Modify

Opened 3 years ago

Closed 3 years ago

#11236 closed Bugs (fixed)

Result change in geometry::centroid between version 1.53 and 1.58

Reported by: Eric Noirfalise <eric.noirfalise@…> Owned by: Barend Gehrels
Milestone: Boost 1.59.0 Component: geometry
Version: Boost 1.57.0 Severity: Regression
Keywords: centroid Cc: Barend Gehrels

Description

Dear All,

I'm having a result change issue in geometry::centroid between boost version 1.53 and 1.58 when I use input polygon composed of integer points and an output double point.

Here is my code :

#include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp>

int main() {

typedef boost::geometry::model::d2::point_xy<int> PointInt?; typedef boost::geometry::model::d2::point_xy<double> PointDouble?; typedef boost::geometry::model::polygon<PointInt?> polygon_type;

polygon_type poly; boost::geometry::read_wkt(

"POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))", poly);

PointDouble? p; typedef boost::geometry::strategy::centroid::bashein_detmer<PointDouble?,

PointInt?, double> Strategy;

boost::geometry::centroid(poly, p, Strategy());

std::cout << "centroid: " << boost::geometry::dsv(p) << std::endl;

return 0;

}

The result for boost 1.53 (which seems good for me) : centroid: (1.5, 1.5)

And the result for boost 1.58 (which seems wrong for me) : centroid: (1, 1) I can also see new warnings during compilation with version 1.58.

Regards

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by Eric Noirfalise <eric.noirfalise@…>

Sorry for previous formatting. Here is my source code :

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>

int main()
{
    typedef boost::geometry::model::d2::point_xy<int> PointInt;
    typedef boost::geometry::model::d2::point_xy<double> PointDouble;
    typedef boost::geometry::model::polygon<PointInt> polygon_type;

    polygon_type poly;
    boost::geometry::read_wkt("POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))", poly);

    PointDouble p;
    typedef boost::geometry::strategy::centroid::bashein_detmer<PointDouble, PointInt, double> Strategy;
    boost::geometry::centroid(poly, p, Strategy());

    std::cout << "centroid: " << boost::geometry::dsv(p) << std::endl;

    return 0;
}

comment:2 Changed 3 years ago by awulkiew

Keywords: centroid added
Milestone: To Be DeterminedBoost 1.59.0
Resolution: fixed
Status: newclosed
Version: Boost 1.58.0Boost 1.57.0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Barend Gehrels.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.