Skip to content

Small integer multipolygon union failure case post traversal rewrite #1420

@tinko92

Description

@tinko92

Here is a very small failure case for union that first fails on commit 805ff65, i.e. the traversal rewrite.

#include <boost/geometry.hpp>

namespace bg = boost::geometry;
using point = bg::model::d2::point_xy<int>;
using polygon = bg::model::polygon<point>;
using multi_polygon = bg::model::multi_polygon<polygon>;

int main() {
  const auto geo1 = bg::from_wkt<multi_polygon>("MULTIPOLYGON(((4 6,2 6,2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 6)),((2 2,2 4,4 4,4 2,2 2)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))");
  const auto geo2 = bg::from_wkt<multi_polygon>("MULTIPOLYGON(((2 2,2 4,4 4,4 2,2 2)))");
  multi_polygon res;
  bg::union_(geo1, geo2, res);
  std::cout << bg::to_wkt(res) << '\n';
  return 0;
}

Prints

MULTIPOLYGON(((2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 2,2 2,2 4)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))

should print

MULTIPOLYGON(((2 4,0 4,0 8,4 8,6 8,6 6,6 4,4 4,4 6,2 6,2 4)),((2 4,4 4,4 2,2 2,2 4)),((2 2,2 0,0 0,0 2,2 2)),((4 2,6 2,6 0,4 0,4 2)))

Should be unrelated to numerical issues due to use of small integer coordinates.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions