Opened 10 years ago

Last modified 7 years ago

#8380 new Bugs

sym_difference yields bad result for large numbers

Reported by: Volker Schöch <vschoech@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.52.0 Severity: Problem
Keywords: sym_difference, polygon, large numbers, domain of definition Cc:

Description

Here is an example where using a relatively small number yields the correct result whereas using boost::numeric::bounds<int>::highest()/2 yields a bad result when calling boost::geometry::sym_difference.

My polygon type is oriented counter-clockwise and not closed, my point type is based on int. Based on using int, can you offer any guidance about the largest possible numbers ("domain of definition") that yield correct results in the boost geometry algorithms?

Here is our conversation on the geometry mailing list regarding this issue in 1.48.0:
http://lists.boost.org/geometry/2012/02/1849.php

For readability, I use the ^ operator to denote the call to sym_difference below.

MULTIPOLYGON(((564 2394,1548 2850,2526 2916,2526 32767,564 32767)))
^ MULTIPOLYGON(((564 3252,2526 3252,2526 32767,564 32767)))
correct result: MULTIPOLYGON(((564 3252,564 2394,1548 2850,2526 2916,2526 3252)))

MULTIPOLYGON(((564 2394,1548 2850,2526 2916,2526 1073741823,564 1073741823)))
^ MULTIPOLYGON(((564 3252,2526 3252,2526 1073741823,564 1073741823)))
bad result: MULTIPOLYGON(((564 3252,564 2394,1548 2850,2526 2916,2526 333411)))

Change History (3)

comment:1 by Volker Schöch <vschoech@…>, 9 years ago

I cannot reproduce this problem in neither boost 1.52.0 not boost 1.55.0. The original reproduction was based on boost 1.48.0. Has this issue been fixed?

comment:2 by Volker Schöch <vschoech@…>, 8 years ago

A related issue came up in boost 1.56.0, see Ticket #10658.

comment:3 by vschoech@…, 7 years ago

A related issue came up in boost 1.59.0, see Ticket #11675.

Note: See TracTickets for help on using tickets.