Subject: [Boost-bugs] [Boost C++ Libraries] #7813: Bug in boost::geometry::centroid with trivially small polygons
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-19 21:23:56
#7813: Bug in boost::geometry::centroid with trivially small polygons
------------------------------+---------------------------------------------
Reporter: anonymous | Owner: barendgehrels
Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
Version: Boost 1.52.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
If you try the following program, the returned centroid is outside the
polygon.
This only happens with trivially small polygons.
{{{
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <iostream>
#include <iomanip>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
polygon_type p;
boost::geometry::read_wkt("POLYGON((139.64436 35.856411,139.64436
35.856391,139.6444 35.856397,139.64439 35.856417,139.64436 35.856411))",
p);
boost::geometry::correct(p);
point_type centroid;
boost::geometry::centroid(p, centroid);
std::cout << std::fixed << std::setprecision(6) <<
boost::geometry::wkt(centroid) << std::endl;
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7813> 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:11 UTC