Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer() produces illegal results at certain distances #1372

Open
Zeratul-Aiur opened this issue Feb 7, 2025 · 2 comments
Open

buffer() produces illegal results at certain distances #1372

Zeratul-Aiur opened this issue Feb 7, 2025 · 2 comments
Assignees

Comments

@Zeratul-Aiur
Copy link

Hi,

When I use the buffer() I find that at certain distances it produces illegal results, it looks more like contaminated data has been added to the correct result?

example code:

#include "boost/geometry.hpp"
#include "catch2/catch_test_macros.hpp"

namespace bg = boost::geometry;

using Point = bg::model::point<float, 2, bg::cs::cartesian>;
using Ring = bg::model::ring<Point, false, false>;
using Polygon = bg::model::polygon<Point, false, false>;
using MultiPolygon = bg::model::multi_polygon<Polygon>;

MultiPolygon buffer(const Polygon &geometry_in, float distance) {
  MultiPolygon out;
  const boost::geometry::strategy::buffer::join_miter join_strategy;
  const boost::geometry::strategy::buffer::distance_symmetric<float>
      distance_strategy(distance);
  const boost::geometry::strategy::buffer::end_flat end_strategy;
  const boost::geometry::strategy::buffer::side_straight side_strategy;
  const boost::geometry::strategy::buffer::point_square point_strategy;

  boost::geometry::buffer(geometry_in,
                          out,
                          distance_strategy,
                          side_strategy,
                          join_strategy,
                          end_strategy,
                          point_strategy);
  return out;
}

TEST_CASE("Test buffer", "[geometry][boost]") {
  Polygon polygon{{
                      {947.5782470703125, 213.50489807128906},
                      {947.5782470703125, 214.68368530273438},
                      {972.321533203125, 214.68368530273438},
                      {972.321533203125, 215.86245727539062},
                      {973.4461669921875, 215.86245727539062},
                      {973.4461669921875, 217.04124450683594},
                      {974.5709228515625, 217.04124450683594},
                      {974.5709228515625, 218.22003173828125},
                      {975.695556640625, 218.22003173828125},
                      {975.695556640625, 219.3988037109375},
                      {979.0697021484375, 219.3988037109375},
                      {979.0697021484375, 218.22003173828125},
                      {983.5684814453125, 218.22003173828125},
                      {983.5684814453125, 217.04124450683594},
                      {1025.18212890625, 217.04124450683594},
                      {1025.18212890625, 215.86245727539062},
                      {1029.680908203125, 215.86245727539062},
                      {1029.680908203125, 217.04124450683594},
                      {1030.8055419921875, 217.04124450683594},
                      {1030.8055419921875, 215.86245727539062},
                      {1034.1796875, 215.86245727539062},
                      {1034.1796875, 217.04124450683594},
                      {1036.4290771484375, 217.04124450683594},
                      {1036.4290771484375, 220.5775909423828},
                      {1035.3043212890625, 220.5775909423828},
                      {1035.3043212890625, 221.75637817382812},
                      {1034.1796875, 221.75637817382812},
                      {1034.1796875, 222.93515014648438},
                      {1030.8055419921875, 222.93515014648438},
                      {1030.8055419921875, 224.1139373779297},
                      {1028.55615234375, 224.1139373779297},
                      {1028.55615234375, 225.292724609375},
                      {1026.3067626953125, 225.292724609375},
                      {1026.3067626953125, 226.47149658203125},
                      {1022.9327392578125, 226.47149658203125},
                      {1022.9327392578125, 227.65028381347656},
                      {1019.55859375, 227.65028381347656},
                      {1019.55859375, 228.82907104492188},
                      {1018.4339599609375, 228.82907104492188},
                      {1018.4339599609375, 233.544189453125},
                      {1017.3092041015625, 233.544189453125},
                      {1017.3092041015625, 235.90174865722656},
                      {1016.1845703125, 235.90174865722656},
                      {1016.1845703125, 237.08053588867188},
                      {1015.059814453125, 237.08053588867188},
                      {1015.059814453125, 238.2593231201172},
                      {1010.56103515625, 238.2593231201172},
                      {1010.56103515625, 239.43809509277344},
                      {1009.4364013671875, 239.43809509277344},
                      {1009.4364013671875, 241.79566955566406},
                      {1008.3116455078125, 241.79566955566406},
                      {1008.3116455078125, 245.33200073242188},
                      {1007.18701171875, 245.33200073242188},
                      {1007.18701171875, 246.51080322265625},
                      {1006.0623779296875, 246.51080322265625},
                      {1006.0623779296875, 248.86834716796875},
                      {1004.9376220703125, 248.86834716796875},
                      {1004.9376220703125, 251.22592163085938},
                      {1003.81298828125, 251.22592163085938},
                      {1003.81298828125, 254.76226806640625},
                      {1002.688232421875, 254.76226806640625},
                      {1002.688232421875, 259.4773864746094},
                      {1001.5635986328125, 259.4773864746094},
                      {1001.5635986328125, 261.8349609375},
                      {1000.4388427734375, 261.8349609375},
                      {1000.4388427734375, 263.01373291015625},
                      {999.314208984375, 263.01373291015625},
                      {999.314208984375, 264.1925354003906},
                      {997.0648193359375, 264.1925354003906},
                      {997.0648193359375, 265.3713073730469},
                      {995.9400634765625, 265.3713073730469},
                      {995.9400634765625, 267.7288513183594},
                      {994.8154296875, 267.7288513183594},
                      {994.8154296875, 268.90765380859375},
                      {993.690673828125, 268.90765380859375},
                      {993.690673828125, 270.08642578125},
                      {992.5660400390625, 270.08642578125},
                      {992.5660400390625, 271.26519775390625},
                      {991.4412841796875, 271.26519775390625},
                      {991.4412841796875, 273.6227722167969},
                      {990.316650390625, 273.6227722167969},
                      {990.316650390625, 274.8015441894531},
                      {989.19189453125, 274.8015441894531},
                      {989.19189453125, 277.15911865234375},
                      {988.0672607421875, 277.15911865234375},
                      {988.0672607421875, 278.337890625},
                      {985.81787109375, 278.337890625},
                      {985.81787109375, 277.15911865234375},
                      {984.693115234375, 277.15911865234375},
                      {984.693115234375, 275.9803466796875},
                      {982.4437255859375, 275.9803466796875},
                      {982.4437255859375, 277.15911865234375},
                      {980.1943359375, 277.15911865234375},
                      {980.1943359375, 278.337890625},
                      {979.0697021484375, 278.337890625},
                      {979.0697021484375, 280.6954650878906},
                      {977.9449462890625, 280.6954650878906},
                      {977.9449462890625, 281.8742370605469},
                      {976.8203125, 281.8742370605469},
                      {976.8203125, 283.05303955078125},
                      {977.9449462890625, 283.05303955078125},
                      {977.9449462890625, 285.41058349609375},
                      {976.8203125, 285.41058349609375},
                      {976.8203125, 286.5893859863281},
                      {975.695556640625, 286.5893859863281},
                      {975.695556640625, 287.7681579589844},
                      {971.19677734375, 287.7681579589844},
                      {971.19677734375, 288.9469299316406},
                      {961.0745849609375, 288.9469299316406},
                      {961.0745849609375, 290.125732421875},
                      {955.4510498046875, 290.125732421875},
                      {955.4510498046875, 291.30450439453125},
                      {953.20166015625, 291.30450439453125},
                      {953.20166015625, 292.4832763671875},
                      {952.0770263671875, 292.4832763671875},
                      {952.0770263671875, 293.6620788574219},
                      {947.5782470703125, 293.6620788574219},
                      {947.5782470703125, 294.8408508300781},
                      {945.328857421875, 294.8408508300781},
                      {945.328857421875, 296.0196228027344},
                      {943.0794677734375, 296.0196228027344},
                      {943.0794677734375, 297.19842529296875},
                      {941.9547119140625, 297.19842529296875},
                      {941.9547119140625, 298.377197265625},
                      {940.830078125, 298.377197265625},
                      {940.830078125, 299.55596923828125},
                      {939.705322265625, 299.55596923828125},
                      {939.705322265625, 300.7347717285156},
                      {938.5806884765625, 300.7347717285156},
                      {938.5806884765625, 301.9135437011719},
                      {937.4559326171875, 301.9135437011719},
                      {937.4559326171875, 303.0923156738281},
                      {928.4583740234375, 303.0923156738281},
                      {928.4583740234375, 301.9135437011719},
                      {922.8349609375, 301.9135437011719},
                      {922.8349609375, 303.0923156738281},
                      {914.9620361328125, 303.0923156738281},
                      {914.9620361328125, 304.2711181640625},
                      {909.338623046875, 304.2711181640625},
                      {909.338623046875, 305.44989013671875},
                      {904.83984375, 305.44989013671875},
                      {904.83984375, 304.2711181640625},
                      {903.715087890625, 304.2711181640625},
                      {903.715087890625, 303.0923156738281},
                      {901.4656982421875, 303.0923156738281},
                      {901.4656982421875, 304.2711181640625},
                      {898.0916748046875, 304.2711181640625},
                      {898.0916748046875, 305.44989013671875},
                      {887.9693603515625, 305.44989013671875},
                      {887.9693603515625, 306.628662109375},
                      {886.8447265625, 306.628662109375},
                      {886.8447265625, 308.9862365722656},
                      {885.719970703125, 308.9862365722656},
                      {885.719970703125, 310.1650085449219},
                      {884.5953369140625, 310.1650085449219},
                      {884.5953369140625, 311.3437805175781},
                      {883.4705810546875, 311.3437805175781},
                      {883.4705810546875, 312.5225830078125},
                      {882.345947265625, 312.5225830078125},
                      {882.345947265625, 318.4164733886719},
                      {881.22119140625, 318.4164733886719},
                      {881.22119140625, 320.7740478515625},
                      {880.0965576171875, 320.7740478515625},
                      {880.0965576171875, 321.95281982421875},
                      {878.9718627929688, 321.95281982421875},
                      {878.9718627929688, 323.1316223144531},
                      {877.84716796875, 323.1316223144531},
                      {877.84716796875, 324.3103942871094},
                      {876.7224731445312, 324.3103942871094},
                      {876.7224731445312, 325.4891662597656},
                      {875.5977783203125, 325.4891662597656},
                      {875.5977783203125, 326.66796875},
                      {873.348388671875, 326.66796875},
                      {873.348388671875, 327.84674072265625},
                      {871.0989990234375, 327.84674072265625},
                      {871.0989990234375, 329.0255126953125},
                      {868.849609375, 329.0255126953125},
                      {868.849609375, 330.2043151855469},
                      {865.4755249023438, 330.2043151855469},
                      {865.4755249023438, 331.3830871582031},
                      {862.1014404296875, 331.3830871582031},
                      {862.1014404296875, 332.5618591308594},
                      {857.6026611328125, 332.5618591308594},
                      {857.6026611328125, 333.74066162109375},
                      {854.2285766601562, 333.74066162109375},
                      {854.2285766601562, 332.5618591308594},
                      {848.6051025390625, 332.5618591308594},
                      {848.6051025390625, 331.3830871582031},
                      {847.4804077148438, 331.3830871582031},
                      {847.4804077148438, 330.2043151855469},
                      {845.2310180664062, 330.2043151855469},
                      {845.2310180664062, 329.0255126953125},
                      {835.1087646484375, 329.0255126953125},
                      {835.1087646484375, 327.84674072265625},
                      {830.6099853515625, 327.84674072265625},
                      {830.6099853515625, 329.0255126953125},
                      {813.7395629882812, 329.0255126953125},
                      {813.7395629882812, 327.84674072265625},
                      {808.1160888671875, 327.84674072265625},
                      {808.1160888671875, 326.66796875},
                      {805.86669921875, 326.66796875},
                      {805.86669921875, 325.4891662597656},
                      {787.8716430664062, 325.4891662597656},
                      {787.8716430664062, 323.1316223144531},
                      {785.6222534179688, 323.1316223144531},
                      {785.6222534179688, 320.7740478515625},
                      {788.996337890625, 320.7740478515625},
                      {788.996337890625, 319.59527587890625},
                      {791.2457275390625, 319.59527587890625},
                      {791.2457275390625, 316.0589294433594},
                      {792.370361328125, 316.0589294433594},
                      {792.370361328125, 314.880126953125},
                      {793.4950561523438, 314.880126953125},
                      {793.4950561523438, 313.70135498046875},
                      {794.6197509765625, 313.70135498046875},
                      {794.6197509765625, 311.3437805175781},
                      {793.4950561523438, 311.3437805175781},
                      {793.4950561523438, 310.1650085449219},
                      {786.7469482421875, 310.1650085449219},
                      {786.7469482421875, 311.3437805175781},
                      {782.2481689453125, 311.3437805175781},
                      {782.2481689453125, 312.5225830078125},
                      {779.998779296875, 312.5225830078125},
                      {779.998779296875, 313.70135498046875},
                      {777.7493896484375, 313.70135498046875},
                      {777.7493896484375, 314.880126953125},
                      {776.6246948242188, 314.880126953125},
                      {776.6246948242188, 316.0589294433594},
                      {775.5, 316.0589294433594},
                      {775.5, 318.4164733886719},
                      {776.6246948242188, 318.4164733886719},
                      {776.6246948242188, 323.1316223144531},
                      {777.7493896484375, 323.1316223144531},
                      {777.7493896484375, 333.74066162109375},
                      {776.6246948242188, 333.74066162109375},
                      {776.6246948242188, 337.2770080566406},
                      {777.7493896484375, 337.2770080566406},
                      {777.7493896484375, 338.4557800292969},
                      {779.998779296875, 338.4557800292969},
                      {779.998779296875, 339.6345520019531},
                      {781.1234741210938, 339.6345520019531},
                      {781.1234741210938, 340.8133544921875},
                      {783.3728637695312, 340.8133544921875},
                      {783.3728637695312, 339.6345520019531},
                      {787.8716430664062, 339.6345520019531},
                      {787.8716430664062, 340.8133544921875},
                      {788.996337890625, 340.8133544921875},
                      {788.996337890625, 341.99212646484375},
                      {791.2457275390625, 341.99212646484375},
                      {791.2457275390625, 344.3497009277344},
                      {792.370361328125, 344.3497009277344},
                      {792.370361328125, 346.7072448730469},
                      {790.1210327148438, 346.7072448730469},
                      {790.1210327148438, 347.88604736328125},
                      {786.7469482421875, 347.88604736328125},
                      {786.7469482421875, 349.0648193359375},
                      {784.49755859375, 349.0648193359375},
                      {784.49755859375, 350.24359130859375},
                      {783.3728637695312, 350.24359130859375},
                      {783.3728637695312, 352.6011657714844},
                      {782.2481689453125, 352.6011657714844},
                      {782.2481689453125, 354.9587097167969},
                      {781.1234741210938, 354.9587097167969},
                      {781.1234741210938, 356.13751220703125},
                      {778.8740844726562, 356.13751220703125},
                      {778.8740844726562, 357.3162841796875},
                      {777.7493896484375, 357.3162841796875},
                      {777.7493896484375, 356.13751220703125},
                      {773.2506103515625, 356.13751220703125},
                      {773.2506103515625, 352.6011657714844},
                      {769.8765258789062, 352.6011657714844},
                      {769.8765258789062, 351.4223937988281},
                      {768.7518310546875, 351.4223937988281},
                      {768.7518310546875, 349.0648193359375},
                      {769.8765258789062, 349.0648193359375},
                      {769.8765258789062, 346.7072448730469},
                      {771.001220703125, 346.7072448730469},
                      {771.001220703125, 345.5284729003906},
                      {772.1259155273438, 345.5284729003906},
                      {772.1259155273438, 344.3497009277344},
                      {771.001220703125, 344.3497009277344},
                      {771.001220703125, 341.99212646484375},
                      {772.1259155273438, 341.99212646484375},
                      {772.1259155273438, 340.8133544921875},
                      {773.2506103515625, 340.8133544921875},
                      {773.2506103515625, 338.4557800292969},
                      {774.3753051757812, 338.4557800292969},
                      {774.3753051757812, 336.09820556640625},
                      {773.2506103515625, 336.09820556640625},
                      {773.2506103515625, 333.74066162109375},
                      {772.1259155273438, 333.74066162109375},
                      {772.1259155273438, 330.2043151855469},
                      {773.2506103515625, 330.2043151855469},
                      {773.2506103515625, 323.1316223144531},
                      {772.1259155273438, 323.1316223144531},
                      {772.1259155273438, 320.7740478515625},
                      {768.7518310546875, 320.7740478515625},
                      {768.7518310546875, 323.1316223144531},
                      {765.3777465820312, 323.1316223144531},
                      {765.3777465820312, 321.95281982421875},
                      {764.2530517578125, 321.95281982421875},
                      {764.2530517578125, 317.2377014160156},
                      {765.3777465820312, 317.2377014160156},
                      {765.3777465820312, 314.880126953125},
                      {766.50244140625, 314.880126953125},
                      {766.50244140625, 312.5225830078125},
                      {767.6271362304688, 312.5225830078125},
                      {767.6271362304688, 310.1650085449219},
                      {768.7518310546875, 310.1650085449219},
                      {768.7518310546875, 306.628662109375},
                      {773.2506103515625, 306.628662109375},
                      {773.2506103515625, 307.8074645996094},
                      {774.3753051757812, 307.8074645996094},
                      {774.3753051757812, 306.628662109375},
                      {775.5, 306.628662109375},
                      {775.5, 304.2711181640625},
                      {776.6246948242188, 304.2711181640625},
                      {776.6246948242188, 296.0196228027344},
                      {778.8740844726562, 296.0196228027344},
                      {778.8740844726562, 298.377197265625},
                      {779.998779296875, 298.377197265625},
                      {779.998779296875, 300.7347717285156},
                      {781.1234741210938, 300.7347717285156},
                      {781.1234741210938, 301.9135437011719},
                      {782.2481689453125, 301.9135437011719},
                      {782.2481689453125, 303.0923156738281},
                      {783.3728637695312, 303.0923156738281},
                      {783.3728637695312, 304.2711181640625},
                      {784.49755859375, 304.2711181640625},
                      {784.49755859375, 305.44989013671875},
                      {785.6222534179688, 305.44989013671875},
                      {785.6222534179688, 306.628662109375},
                      {791.2457275390625, 306.628662109375},
                      {791.2457275390625, 305.44989013671875},
                      {793.4950561523438, 305.44989013671875},
                      {793.4950561523438, 304.2711181640625},
                      {795.7444458007812, 304.2711181640625},
                      {795.7444458007812, 303.0923156738281},
                      {799.1185302734375, 303.0923156738281},
                      {799.1185302734375, 301.9135437011719},
                      {802.4926147460938, 301.9135437011719},
                      {802.4926147460938, 300.7347717285156},
                      {804.7420043945312, 300.7347717285156},
                      {804.7420043945312, 299.55596923828125},
                      {805.86669921875, 299.55596923828125},
                      {805.86669921875, 298.377197265625},
                      {808.1160888671875, 298.377197265625},
                      {808.1160888671875, 297.19842529296875},
                      {811.4901733398438, 297.19842529296875},
                      {811.4901733398438, 296.0196228027344},
                      {813.7395629882812, 296.0196228027344},
                      {813.7395629882812, 294.8408508300781},
                      {815.9889526367188, 294.8408508300781},
                      {815.9889526367188, 293.6620788574219},
                      {819.363037109375, 293.6620788574219},
                      {819.363037109375, 292.4832763671875},
                      {821.6124267578125, 292.4832763671875},
                      {821.6124267578125, 291.30450439453125},
                      {823.86181640625, 291.30450439453125},
                      {823.86181640625, 290.125732421875},
                      {827.2359008789062, 290.125732421875},
                      {827.2359008789062, 288.9469299316406},
                      {831.7346801757812, 288.9469299316406},
                      {831.7346801757812, 287.7681579589844},
                      {838.4828491210938, 287.7681579589844},
                      {838.4828491210938, 286.5893859863281},
                      {844.1063232421875, 286.5893859863281},
                      {844.1063232421875, 285.41058349609375},
                      {849.7297973632812, 285.41058349609375},
                      {849.7297973632812, 284.2318115234375},
                      {854.2285766601562, 284.2318115234375},
                      {854.2285766601562, 283.05303955078125},
                      {858.7273559570312, 283.05303955078125},
                      {858.7273559570312, 281.8742370605469},
                      {862.1014404296875, 281.8742370605469},
                      {862.1014404296875, 280.6954650878906},
                      {866.6002197265625, 280.6954650878906},
                      {866.6002197265625, 279.5166931152344},
                      {871.0989990234375, 279.5166931152344},
                      {871.0989990234375, 278.337890625},
                      {880.0965576171875, 278.337890625},
                      {880.0965576171875, 277.15911865234375},
                      {882.345947265625, 277.15911865234375},
                      {882.345947265625, 275.9803466796875},
                      {884.5953369140625, 275.9803466796875},
                      {884.5953369140625, 274.8015441894531},
                      {886.8447265625, 274.8015441894531},
                      {886.8447265625, 273.6227722167969},
                      {889.0941162109375, 273.6227722167969},
                      {889.0941162109375, 272.4440002441406},
                      {892.4681396484375, 272.4440002441406},
                      {892.4681396484375, 271.26519775390625},
                      {896.9669189453125, 271.26519775390625},
                      {896.9669189453125, 270.08642578125},
                      {900.341064453125, 270.08642578125},
                      {900.341064453125, 268.90765380859375},
                      {904.83984375, 268.90765380859375},
                      {904.83984375, 267.7288513183594},
                      {908.2138671875, 267.7288513183594},
                      {908.2138671875, 266.5500793457031},
                      {909.338623046875, 266.5500793457031},
                      {909.338623046875, 265.3713073730469},
                      {910.4632568359375, 265.3713073730469},
                      {910.4632568359375, 264.1925354003906},
                      {911.5880126953125, 264.1925354003906},
                      {911.5880126953125, 263.01373291015625},
                      {912.712646484375, 263.01373291015625},
                      {912.712646484375, 261.8349609375},
                      {914.9620361328125, 261.8349609375},
                      {914.9620361328125, 260.65618896484375},
                      {916.0867919921875, 260.65618896484375},
                      {916.0867919921875, 259.4773864746094},
                      {918.336181640625, 259.4773864746094},
                      {918.336181640625, 258.2986145019531},
                      {920.5855712890625, 258.2986145019531},
                      {920.5855712890625, 257.1198425292969},
                      {928.4583740234375, 257.1198425292969},
                      {928.4583740234375, 258.2986145019531},
                      {931.83251953125, 258.2986145019531},
                      {931.83251953125, 257.1198425292969},
                      {934.0819091796875, 257.1198425292969},
                      {934.0819091796875, 255.9410400390625},
                      {935.20654296875, 255.9410400390625},
                      {935.20654296875, 254.76226806640625},
                      {937.4559326171875, 254.76226806640625},
                      {937.4559326171875, 253.58349609375},
                      {938.5806884765625, 253.58349609375},
                      {938.5806884765625, 252.40469360351562},
                      {939.705322265625, 252.40469360351562},
                      {939.705322265625, 251.22592163085938},
                      {941.9547119140625, 251.22592163085938},
                      {941.9547119140625, 250.04714965820312},
                      {943.0794677734375, 250.04714965820312},
                      {943.0794677734375, 248.86834716796875},
                      {945.328857421875, 248.86834716796875},
                      {945.328857421875, 247.6895751953125},
                      {946.4534912109375, 247.6895751953125},
                      {946.4534912109375, 246.51080322265625},
                      {947.5782470703125, 246.51080322265625},
                      {947.5782470703125, 245.33200073242188},
                      {948.702880859375, 245.33200073242188},
                      {948.702880859375, 241.79566955566406},
                      {939.705322265625, 241.79566955566406},
                      {939.705322265625, 240.61688232421875},
                      {931.83251953125, 240.61688232421875},
                      {931.83251953125, 239.43809509277344},
                      {927.333740234375, 239.43809509277344},
                      {927.333740234375, 238.2593231201172},
                      {925.0843505859375, 238.2593231201172},
                      {925.0843505859375, 237.08053588867188},
                      {921.710205078125, 237.08053588867188},
                      {921.710205078125, 235.90174865722656},
                      {911.5880126953125, 235.90174865722656},
                      {911.5880126953125, 234.7229766845703},
                      {904.83984375, 234.7229766845703},
                      {904.83984375, 233.544189453125},
                      {899.21630859375, 233.544189453125},
                      {899.21630859375, 234.7229766845703},
                      {894.717529296875, 234.7229766845703},
                      {894.717529296875, 233.544189453125},
                      {878.9718627929688, 233.544189453125},
                      {878.9718627929688, 232.36541748046875},
                      {876.7224731445312, 232.36541748046875},
                      {876.7224731445312, 231.18663024902344},
                      {867.7249145507812, 231.18663024902344},
                      {867.7249145507812, 230.00784301757812},
                      {859.85205078125, 230.00784301757812},
                      {859.85205078125, 228.82907104492188},
                      {857.6026611328125, 228.82907104492188},
                      {857.6026611328125, 227.65028381347656},
                      {858.7273559570312, 227.65028381347656},
                      {858.7273559570312, 226.47149658203125},
                      {871.0989990234375, 226.47149658203125},
                      {871.0989990234375, 225.292724609375},
                      {875.5977783203125, 225.292724609375},
                      {875.5977783203125, 226.47149658203125},
                      {880.0965576171875, 226.47149658203125},
                      {880.0965576171875, 225.292724609375},
                      {896.9669189453125, 225.292724609375},
                      {896.9669189453125, 224.1139373779297},
                      {899.21630859375, 224.1139373779297},
                      {899.21630859375, 225.292724609375},
                      {910.4632568359375, 225.292724609375},
                      {910.4632568359375, 224.1139373779297},
                      {928.4583740234375, 224.1139373779297},
                      {928.4583740234375, 222.93515014648438},
                      {937.4559326171875, 222.93515014648438},
                      {937.4559326171875, 221.75637817382812},
                      {935.20654296875, 221.75637817382812},
                      {935.20654296875, 220.5775909423828},
                      {923.9595947265625, 220.5775909423828},
                      {923.9595947265625, 221.75637817382812},
                      {918.336181640625, 221.75637817382812},
                      {918.336181640625, 220.5775909423828},
                      {917.21142578125, 220.5775909423828},
                      {917.21142578125, 215.86245727539062},
                      {918.336181640625, 215.86245727539062},
                      {918.336181640625, 214.68368530273438},
                      {925.0843505859375, 214.68368530273438},
                      {925.0843505859375, 213.50489807128906},
                  },
                  {
                      {877.84716796875, 292.4832763671875},
                      {877.84716796875, 293.6620788574219},
                      {873.348388671875, 293.6620788574219},
                      {873.348388671875, 294.8408508300781},
                      {867.7249145507812, 294.8408508300781},
                      {867.7249145507812, 296.0196228027344},
                      {864.350830078125, 296.0196228027344},
                      {864.350830078125, 297.19842529296875},
                      {860.9767456054688, 297.19842529296875},
                      {860.9767456054688, 298.377197265625},
                      {857.6026611328125, 298.377197265625},
                      {857.6026611328125, 299.55596923828125},
                      {855.353271484375, 299.55596923828125},
                      {855.353271484375, 300.7347717285156},
                      {853.1038818359375, 300.7347717285156},
                      {853.1038818359375, 301.9135437011719},
                      {848.6051025390625, 301.9135437011719},
                      {848.6051025390625, 303.0923156738281},
                      {841.85693359375, 303.0923156738281},
                      {841.85693359375, 304.2711181640625},
                      {839.6075439453125, 304.2711181640625},
                      {839.6075439453125, 307.8074645996094},
                      {846.355712890625, 307.8074645996094},
                      {846.355712890625, 306.628662109375},
                      {854.2285766601562, 306.628662109375},
                      {854.2285766601562, 305.44989013671875},
                      {856.4779663085938, 305.44989013671875},
                      {856.4779663085938, 304.2711181640625},
                      {860.9767456054688, 304.2711181640625},
                      {860.9767456054688, 303.0923156738281},
                      {862.1014404296875, 303.0923156738281},
                      {862.1014404296875, 301.9135437011719},
                      {863.2261352539062, 301.9135437011719},
                      {863.2261352539062, 300.7347717285156},
                      {864.350830078125, 300.7347717285156},
                      {864.350830078125, 299.55596923828125},
                      {866.6002197265625, 299.55596923828125},
                      {866.6002197265625, 298.377197265625},
                      {869.9743041992188, 298.377197265625},
                      {869.9743041992188, 297.19842529296875},
                      {877.84716796875, 297.19842529296875},
                      {877.84716796875, 298.377197265625},
                      {880.0965576171875, 298.377197265625},
                      {880.0965576171875, 297.19842529296875},
                      {883.4705810546875, 297.19842529296875},
                      {883.4705810546875, 296.0196228027344},
                      {884.5953369140625, 296.0196228027344},
                      {884.5953369140625, 294.8408508300781},
                      {886.8447265625, 294.8408508300781},
                      {886.8447265625, 293.6620788574219},
                      {887.9693603515625, 293.6620788574219},
                      {887.9693603515625, 292.4832763671875},
                      {886.8447265625, 292.4832763671875},
                      {886.8447265625, 291.30450439453125},
                      {881.22119140625, 291.30450439453125},
                      {881.22119140625, 292.4832763671875},
                  },
                  {
                      {938.5806884765625, 290.125732421875},
                      {940.830078125, 290.125732421875},
                      {940.830078125, 288.9469299316406},
                      {941.9547119140625, 288.9469299316406},
                      {941.9547119140625, 287.7681579589844},
                      {938.5806884765625, 287.7681579589844},
                  },
                  {
                      {909.338623046875, 283.05303955078125},
                      {909.338623046875, 284.2318115234375},
                      {908.2138671875, 284.2318115234375},
                      {908.2138671875, 286.5893859863281},
                      {912.712646484375, 286.5893859863281},
                      {912.712646484375, 285.41058349609375},
                      {914.9620361328125, 285.41058349609375},
                      {914.9620361328125, 283.05303955078125},
                  },
                  {
                      {952.0770263671875, 283.05303955078125},
                      {952.0770263671875, 285.41058349609375},
                      {954.326416015625, 285.41058349609375},
                      {954.326416015625, 284.2318115234375},
                      {955.4510498046875, 284.2318115234375},
                      {955.4510498046875, 283.05303955078125},
                      {957.700439453125, 283.05303955078125},
                      {957.700439453125, 281.8742370605469},
                      {954.326416015625, 281.8742370605469},
                      {954.326416015625, 283.05303955078125},
                  },
                  {
                      {943.0794677734375, 268.90765380859375},
                      {943.0794677734375, 270.08642578125},
                      {941.9547119140625, 270.08642578125},
                      {941.9547119140625, 271.26519775390625},
                      {938.5806884765625, 271.26519775390625},
                      {938.5806884765625, 272.4440002441406},
                      {935.20654296875, 272.4440002441406},
                      {935.20654296875, 273.6227722167969},
                      {931.83251953125, 273.6227722167969},
                      {931.83251953125, 274.8015441894531},
                      {926.208984375, 274.8015441894531},
                      {926.208984375, 275.9803466796875},
                      {922.8349609375, 275.9803466796875},
                      {922.8349609375, 277.15911865234375},
                      {921.710205078125, 277.15911865234375},
                      {921.710205078125, 278.337890625},
                      {920.5855712890625, 278.337890625},
                      {920.5855712890625, 280.6954650878906},
                      {923.9595947265625, 280.6954650878906},
                      {923.9595947265625, 281.8742370605469},
                      {928.4583740234375, 281.8742370605469},
                      {928.4583740234375, 280.6954650878906},
                      {931.83251953125, 280.6954650878906},
                      {931.83251953125, 279.5166931152344},
                      {934.0819091796875, 279.5166931152344},
                      {934.0819091796875, 278.337890625},
                      {936.331298828125, 278.337890625},
                      {936.331298828125, 277.15911865234375},
                      {938.5806884765625, 277.15911865234375},
                      {938.5806884765625, 275.9803466796875},
                      {940.830078125, 275.9803466796875},
                      {940.830078125, 274.8015441894531},
                      {943.0794677734375, 274.8015441894531},
                      {943.0794677734375, 273.6227722167969},
                      {946.4534912109375, 273.6227722167969},
                      {946.4534912109375, 272.4440002441406},
                      {948.702880859375, 272.4440002441406},
                      {948.702880859375, 268.90765380859375},
                  },
                  {
                      {994.8154296875, 261.8349609375},
                      {995.9400634765625, 261.8349609375},
                      {995.9400634765625, 260.65618896484375},
                      {997.0648193359375, 260.65618896484375},
                      {997.0648193359375, 259.4773864746094},
                      {994.8154296875, 259.4773864746094},
                  },
                  {
                      {973.4461669921875, 253.58349609375},
                      {973.4461669921875, 254.76226806640625},
                      {971.19677734375, 254.76226806640625},
                      {971.19677734375, 255.9410400390625},
                      {968.9473876953125, 255.9410400390625},
                      {968.9473876953125, 257.1198425292969},
                      {966.697998046875, 257.1198425292969},
                      {966.697998046875, 258.2986145019531},
                      {965.5733642578125, 258.2986145019531},
                      {965.5733642578125, 263.01373291015625},
                      {970.0721435546875, 263.01373291015625},
                      {970.0721435546875, 261.8349609375},
                      {971.19677734375, 261.8349609375},
                      {971.19677734375, 259.4773864746094},
                      {973.4461669921875, 259.4773864746094},
                      {973.4461669921875, 258.2986145019531},
                      {975.695556640625, 258.2986145019531},
                      {975.695556640625, 257.1198425292969},
                      {976.8203125, 257.1198425292969},
                      {976.8203125, 255.9410400390625},
                      {977.9449462890625, 255.9410400390625},
                      {977.9449462890625, 254.76226806640625},
                      {979.0697021484375, 254.76226806640625},
                      {979.0697021484375, 252.40469360351562},
                      {975.695556640625, 252.40469360351562},
                      {975.695556640625, 253.58349609375},
                  },
                  {
                      {997.0648193359375, 232.36541748046875},
                      {997.0648193359375, 233.544189453125},
                      {995.9400634765625, 233.544189453125},
                      {995.9400634765625, 234.7229766845703},
                      {994.8154296875, 234.7229766845703},
                      {994.8154296875, 235.90174865722656},
                      {993.690673828125, 235.90174865722656},
                      {993.690673828125, 239.43809509277344},
                      {997.0648193359375, 239.43809509277344},
                      {997.0648193359375, 238.2593231201172},
                      {998.189453125, 238.2593231201172},
                      {998.189453125, 237.08053588867188},
                      {999.314208984375, 237.08053588867188},
                      {999.314208984375, 235.90174865722656},
                      {1000.4388427734375, 235.90174865722656},
                      {1000.4388427734375, 232.36541748046875},
                  }};

  CHECK(bg::is_valid(polygon));

  const auto result1 = buffer(polygon, 40);
  const auto result2 = buffer(polygon, 50);
  const auto result3 = buffer(polygon, 60);

  CHECK(result1.size() == 1);
  CHECK(result2.size() == 1);
  CHECK(result3.size() == 1);
}

result1 and result3 seem to be correct. but result2 appears to have contaminated data added to the correct result.

Image

Image

Image

Image

Tried the following versions, all have the same problem: 1.84.0, 1.85.0, 1.87.0

@barendgehrels barendgehrels self-assigned this Feb 7, 2025
@barendgehrels
Copy link
Collaborator

hi @Zeratul-Aiur thanks for the report.
I will have a look soon. There are many recent changes, not all of them merged. I will also inspect it with those.

@barendgehrels
Copy link
Collaborator

hi @Zeratul-Aiur , I could reproduce it.

The "contaminated data" are internally offsetted rings which should have been removed.

With double (our default type):

  • on develop: it occurred (until 1.87) from distances 42 to 53
  • on the new branch*: it is now completely fine

With float (as you reported):

  • on develop: it occurred from distances 42 to 53 (same as for double), and also incidentally, 3 times, from 4 to 17
  • on the new branch*. From 42 to 53 is now completely fine. The incidents, 3 times, still remain (but a bit in a different way).

* The new branch is major_feature/use-graph-for-traversal, not yet merged, PR #1369

So we advice you to use double, and I hope the new branch (it's major work) will be reviewed merged in a few weeks, and shipped with 1.88

I will add this case to the unit test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants