Ticket #7462 (closed Bugs: fixed)
geometry::union_ yields degenerated results
Reported by: | Danvil <danvil@…> | Owned by: | barendgehrels |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.48.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following data gives wrong results with geometry::union.
float data1[][2] = {{0,0}, {-0.3681253195,0.9297761917}, {2.421203136,2.034152031}, {2.789328575,1.104375958}, {0,0}}; float data2[][2] = {{2.76143527,1.093332171}, {2.076887131,1.822299719}, {4.263789177,3.875944376}, {4.948337555,3.146976948}, {2.76143527,1.093332171}}; polygon_t p1, p2; boost::geometry::append(p1, data1); boost::geometry::append(p2, data2); std::vector<polygon_t> output; boost::geometry::union_(p1, p2, output);
Please find attached the whole main file and program output.
Attachments
Change History
comment:1 Changed 3 years ago by Danvil <danvil@…>
Actually union(p1,p2) yields a degenerated polygon while union(p2,p1) gives the correct result. In my use case, wrong results occur in ~0.5% of the cases.
comment:2 Changed 2 years ago by barendgehrels
- Status changed from new to closed
- Resolution set to fixed
(In [83481]) [geometry] Fix ticket 7462, degenerate union for float. This was caused by two distances being wrong (by floating point precision). We now use earlier the alternative sort method (sorting on left/right), using relaxed_epsilon. This fixes the cause.
comment:3 follow-up: ↓ 4 Changed 2 years ago by barendgehrels
(In [83482]) [geometry] Fix ticket 7462, (unit tests)
comment:4 in reply to: ↑ 3 Changed 2 years ago by anonymous
Replying to barendgehrels:
(In [83482]) [geometry] Fix ticket 7462, (unit tests)
Thanks for fixing this!