I am seeing strange result from boost::polygon::area. I posted this issue on the Boost GitHub page, but looking for suggestions form the wider SO community.
The code below report 0 area for the given polygon. Any suggestions how to work around this?
#include <boost/polygon/polygon.hpp>
#include <boost/polygon/rectangle_data.hpp>
#include <boost/polygon/polygon_set_data.hpp>
#include <boost/polygon/polygon_data.hpp>
#include <boost/version.hpp>
#include <boost/format.hpp>
template<typename T>
auto make_rect(T x1, T y1, T x2, T y2) {
auto r = boost::polygon::rectangle_data(x1, y1, x2, y2);
boost::polygon::polygon_data<T> p;
boost::polygon::assign(p, r);
return p;
}
int main(int argc, char **argv) {
std::cout << BOOST_LIB_VERSION << std::endl;
boost::polygon::polygon_set_data<double> poly, poly1;
poly.insert(make_rect(0.003065, 0.0007, 0.0034, 0.0009525));
std::cout << boost::format("%e") % boost::polygon::area(poly) << std::endl;
}
output is:
1_78
0.000000e+00