Opened 7 years ago

Closed 22 months ago

#12118 closed Bugs (fixed)

Problems performing boolean operations on polygons with shared edges

Reported by: ev.mipt@… Owned by: Barend Gehrels
Milestone: Boost 1.63.0 Component: geometry
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

I have described problems with illustrations in mailing list: http://lists.boost.org/geometry/2016/04/3518.php

But forgot to mention there that despite the fact that I use same data every program restart, boost geometry union_ makes described problems not in same places. So WKT representation below is slightly different from pictures in mailing list post.

WKT representations:

Current Path polygon: MULTIPOLYGON(((13.0894 -70.9842,12.8138 -67.5544,12.6048 -63.5792,13.5644 -54.9161,13.8057 -43.6207,13.0006 -33.8524,9.29665 -33.2341,19.6687 -14.4204,-5.96064 -17.1987,-14.8704 -6.9988,-22.5081 -27.9248,-22.1616 -45.1548,-22.4244 -54.0161,-23.1383 -59.2863,-23.1831 -68.0194,-22.8694 -72.7853,-23.0297 -72.7676,-22.8192 -73.5476,-18.6568 -73.2505,3.16642 -75.6601,12.7528 -76.7187,13.0894 -70.9842)))

Appended polygon: MULTIPOLYGON(((3.16642 -75.6601,12.7528 -76.7187,12.95 -74.6186,3.16642 -75.6601)),((-22.8477 -78.4296,-20.9284 -78.2253,3.16642 -75.6601,-23.0297 -72.7676,-22.8477 -78.4296)))

Union of current path and appended polygon result: MULTIPOLYGON(((12.8756 -74.6265,13.0894 -70.9842,12.8138 -67.5544,12.6048 -63.5792,13.5644 -54.9161,13.8057 -43.6207,13.0006 -33.8524,9.29665 -33.2341,19.6687 -14.4204,-5.96064 -17.1987,-14.8704 -6.9988,-22.5081 -27.9248,-22.1616 -45.1548,-22.4244 -54.0161,-23.1383 -59.2863,-23.1831 -68.0194,-22.8694 -72.7853,-23.0297 -72.7676,-22.8477 -78.4296,-20.9284 -78.2253,3.16642 -75.6601,-18.6568 -73.2505,-18.6568 -73.2505,3.16642 -75.6601,12.7528 -76.7187,12.95 -74.6186,12.8756 -74.6265)))

Change History (5)

comment:1 by ev.mipt@…, 7 years ago

Same WKT representations but with greater precision (std::setprecision(20))

Current Path polygon: MULTIPOLYGON(((13.08940410614013671875 -70.98416137695312500000,12.81384754180908203125 -67.55441284179687500000,12.60483169555664062500 -63.57923889160156250000,13.56438255310058593750 -54.91608428955078125000,13.80568027496337890625 -43.62073516845703125000,13.00057315826416015625 -33.85240554809570312500,9.29664993286132812500 -33.23409271240234375000,19.66869926452636718750 -14.42036247253417968750,-5.96064376831054687500 -17.19871711730957031250,-14.87041568756103515625 -6.99879980087280273438,-22.50806808471679687500 -27.92480468750000000000,-22.16161727905273437500 -45.15484619140625000000,-22.42436790466308593750 -54.01613616943359375000,-23.13828659057617187500 -59.28628540039062500000,-23.18314933776855468750 -68.01937866210937500000,-22.86939430236816406250 -72.78530883789062500000,-23.02970123291015625000 -72.76760864257812500000,-22.81921195983886718750 -73.54760742187500000000,-18.65677833557128906250 -73.25045776367187500000,3.16641521453857421875 -75.66014099121093750000,12.75282478332519531250 -76.71865844726562500000,13.08940410614013671875 -70.98416137695312500000)))

Appended polygon: MULTIPOLYGON(((3.16641521453857421875 -75.66014099121093750000,12.75282478332519531250 -76.71865844726562500000,12.95001888275146484375 -74.61856842041015625000,3.16641521453857421875 -75.66014099121093750000)),((-22.84768676757812500000 -78.42963409423828125000,-20.92837524414062500000 -78.22530364990234375000,3.16641521453857421875 -75.66014099121093750000,-23.02970123291015625000 -72.76760864257812500000,-22.84768676757812500000 -78.42963409423828125000)))

Union of current path and appended polygon result: MULTIPOLYGON(((12.87562274932861328125 -74.62648773193359375000,13.08940410614013671875 -70.98416137695312500000,12.81384754180908203125 -67.55441284179687500000,12.60483169555664062500 -63.57923889160156250000,13.56438255310058593750 -54.91608428955078125000,13.80568027496337890625 -43.62073516845703125000,13.00057315826416015625 -33.85240554809570312500,9.29664993286132812500 -33.23409271240234375000,19.66869926452636718750 -14.42036247253417968750,-5.96064376831054687500 -17.19871711730957031250,-14.87041568756103515625 -6.99879980087280273438,-22.50806808471679687500 -27.92480468750000000000,-22.16161727905273437500 -45.15484619140625000000,-22.42436790466308593750 -54.01613616943359375000,-23.13828659057617187500 -59.28628540039062500000,-23.18314933776855468750 -68.01937866210937500000,-22.86939430236816406250 -72.78530883789062500000,-23.02970123291015625000 -72.76760864257812500000,-22.84768676757812500000 -78.42963409423828125000,-20.92837524414062500000 -78.22530364990234375000,3.16641521453857421875 -75.66014099121093750000,-18.65678787231445312500 -73.25045776367187500000,-18.65677833557128906250 -73.25045776367187500000,3.16641521453857421875 -75.66014099121093750000,12.75282478332519531250 -76.71865844726562500000,12.95001888275146484375 -74.61856842041015625000,12.87562274932861328125 -74.62648773193359375000)))

comment:2 by Barend Gehrels, 7 years ago

The output is indeed invalid, though its area is correct. There is apparently a spike generated which should not be there. You can try using remove_spikes but I don't know if it helps in this case.

For next release, or release after that, we will remove the rescaling and that will hopefully fix also this problem. I added the input to the unit test cases.

comment:3 by Barend Gehrels, 7 years ago

Status: newassigned

comment:4 by Barend Gehrels, 7 years ago

Milestone: To Be DeterminedBoost 1.63.0

comment:5 by barend, 22 months ago

Resolution: fixed
Status: assignedclosed

Fixed for already quite some time.

This is included in the unit test under the name ticket_12118

Note: See TracTickets for help on using tickets.