Opened 10 years ago

Last modified 10 years ago

#8183 assigned Bugs

boost::geometry::intersection on two polygons returns incorrect empty intersection

Reported by: matthewd@… Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

Hi

The code snippet intersects 2 2D polygons resulting in an empty intersection. I'm including an image of the two polygons and they are overlapping. There may be a problem because the polygons share an overlapping edge?

Thanks

Matthew Danielsen

polygon_2d triangle2D;
{
    const double triangle2Dcoor[] = {{0.891747, 2.28756}, {0.490911, -1.52549}, {-1.72945, -1.52549}, {0.891747, 2.28756}};
    assign(triangle2D, triangle2Dcoor);
}

polygon_2d box2D;
{
    const double box2Dcoor[] = {{-1.6744, -1.52549}, {-1.70498, -1.52549}, {-1.70052, -1.49155}, {-1.67049, -1.49579}, {-1.6744, -1.52549}};
    assign(box2D, box2Dcoor);
}

boost::geometry::model::multi_polygon< boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<T> > > intersectionPolygons;
boost::geometry::intersection(triangle2D, box2D, intersectionPolygons);
assert(intersectionPolygons.size() != 0); //  Assert fails

Attachments (1)

OverlappingImage.jpg (18.8 KB ) - added by matthewd@… 10 years ago.
Image of polygons

Download all attachments as: .zip

Change History (2)

by matthewd@…, 10 years ago

Attachment: OverlappingImage.jpg added

Image of polygons

comment:1 by Barend Gehrels, 10 years ago

Status: newassigned

Can you be more specific? What is T for example? I cannot reproduce it. That means, I get a non-empty intersection looking like the expected result.

Please specify:

  • T (double, float, extended, etc)
  • compiler
  • operating system
Note: See TracTickets for help on using tickets.