Opened 11 years ago

Closed 10 years ago

#6560 closed Bugs (wontfix)

The intersection of these two polygons returns an empty result

Reported by: anders.jel@… Owned by: Lucanus Simonson
Milestone: To Be Determined Component: polygon
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

This may be related to #5103.

The following program prints a zero area for the intersection of the two polygons.

#include <boost/polygon/polygon.hpp>
#include <vector>
#include <iostream>

using namespace boost::polygon;
using namespace boost::polygon::operators;

int main()
{
    typedef point_data<int64_t> point;

    std::vector<point> a;
    a.push_back(point( 50000000000,   50000000000));
    a.push_back(point( 12500000000,   50000000000));
    a.push_back(point(           0,  100000000000));
    a.push_back(point(-12500000000,   50000000000));
    a.push_back(point(-50000000000,   50000000000));
    a.push_back(point(-50000000000,  -50000000000));
    a.push_back(point(-37500000000,  -50000000000));
    a.push_back(point(-50000000000, -100000000000));
    a.push_back(point( 50000000000, -100000000000));
    a.push_back(point( 37500000000,  -50000000000));
    a.push_back(point( 50000000000,  -50000000000));
    a.push_back(point( 50000000000,   50000000000));

    polygon_data<int64_t> polygon_a;
    set_points(polygon_a, a.begin(), a.end());
    
    std::vector<point> b;
    b.push_back(point(-47702617860,   50000000000));
    b.push_back(point( 50000000000,   50000000000));
    b.push_back(point( 50000000000,  -88753775284));
    b.push_back(point(-47702617860,  -88753775284));

    polygon_data<int64_t> polygon_b;
    set_points(polygon_b, b.begin(), b.end());

    polygon_set_data<int64_t> intersection = polygon_a * polygon_b;
    std::cout << area(intersection) << std::endl; // Prints 0

    std::vector<polygon_data<int64_t> > polygons_in_intersection;
    intersection.get(polygons_in_intersection);
    std::cout << polygons_in_intersection.size() << std::endl; // Prints 0

    return 0;
}

Attachments (1)

bug.cpp (1.6 KB ) - added by anders.jel@… 11 years ago.

Download all attachments as: .zip

Change History (2)

by anders.jel@…, 11 years ago

Attachment: bug.cpp added

comment:1 by Lucanus Simonson, 10 years ago

Resolution: wontfix
Status: newclosed

Robust operations with 64 bit integer coordinates are not supported currently. We do not have adding support for this in our short term plans, but replacing some of the coordinate_traits for the 64 bit coordinate type with sufficiently large data types ought to work out of the box. The main problem we have with doing so is lack of such types available to us in the STL or Boost.

Note: See TracTickets for help on using tickets.