Opened 4 years ago

Last modified 4 years ago

#13645 new Bugs

boost::geometry::simplify broken in 1.67

Reported by: Eyal Soha <eyalsoha@…> Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.67.0 Severity: Regression
Keywords: boost geometry simplify Cc:

Description

bg::simplify is broken in version 1.67. In version 1.66, it works fine.

This is the code that I ran:

std::cout << "Ring is: " << bg::wkt(*ring) << std::endl; std::cout << "Tolerance is: " << mill->tolerance; toolpath_optimised.push_back(make_shared<icoords>()); bg::simplify(*ring, *(toolpath_optimised.back()), mill->tolerance); std::cout << "Simplified result is: " << bg::wkt(*(toolpath_optimised.back())) << std::endl;

With boost 1.66, the first coordinate of the input and the first coordinate of the output are the same. With 1.67, the first coordinate of the input and the first coordinate of the output are not the same. This is incorrect behavior. Notice in the output below.

1.66 stdout:

POLYGON((1.20884 3.81395,1.19293 3.84469,1.1663 3.89695,1.13837 3.9535,1.11221 4.01006,1.08784 4.06661,1.06524 4.12317,1.04518 4.17544,1.02628 4.22659,1.00887 4.27775,0.99294 4.3289,0.978492 4.38006,0.964488 4.43232,0.952375 4.47996,0.941568 4.5276,0.932065 4.57524,0.923868 4.62288,0.91559 4.67514,0.908966 4.72079,0.903551 4.76643,0.899345 4.81207,0.896348 4.85771,0.893609 4.90997,0.891839 4.95499,0.89125 5,0.891839 5.04501,0.893609 5.09003,0.896348 5.14229,0.899345 5.18793,0.903551 5.23357,0.908966 5.27921,0.91559 5.32486,0.923868 5.37712,0.932065 5.42476,0.941568 5.4724,0.952375 5.52004,0.964488 5.56768,0.978492 5.61994,0.99294 5.6711,1.00887 5.72225,1.02628 5.77341,1.04518 5.82456,1.06524 5.87683,1.08784 5.93338,1.11221 5.98993,1.13836 6.04648,1.16629 6.10304,1.19292 6.1553,1.22687 6.21973,1.26309 6.28417,1.30155 6.3486,1.34227 6.41304,1.37621 6.4653,1.42695 6.54109,1.48072 6.61688,1.53754 6.69267,1.59739 6.76846,1.63972 6.82073,1.67765 6.86689,1.71667 6.91305,1.75679 6.9592,1.79801 7.00536,1.84033 7.05152,1.88375 7.09768,1.97387 7.19,2.02613 7.24226,2.11566 7.32986,2.20903 7.41746,2.30626 7.50507,2.40733 7.59267,2.52209 7.582,2.57436 7.57651,2.69697 7.56203,2.81959 7.54438,2.94221 7.52354,3.06483 7.49953,3.04552 7.41246,3.0034 7.21862,2.9966 7.18665,2.99153 7.16271,2.76836 6.10662,2.76698 6.10013,2.76489 6.09027,2.74216 5.97705,2.6906 5.70316,2.68837 5.69147,2.67984 5.6473,2.67213 5.60519,2.66543 5.564,2.65315 5.48319,2.65167 5.47366,2.63996 5.39965,2.63532 5.36774,2.63159 5.33635,2.63138 5.33435,2.6307 5.32801,2.62318 5.26016,2.61595 5.2276,2.60164 5.168,2.5906 5.12662,2.57778 5.08701,2.55845 5.03242,2.54629 5.00067,2.53279 4.97027,2.50892 4.92023,2.49607 4.89498,2.48215 4.87082,2.45406 4.82499,2.44052 4.80413,2.42605 4.78419,2.39396 4.74237,2.37944 4.72443,2.36407 4.70735,2.32808 4.66943,2.31204 4.65339,2.29516 4.6382,2.2553 4.60415,2.23694 4.58929,2.21769 4.57531,2.17388 4.54521,2.15204 4.53104,2.1292 4.51786,2.08948 4.4963,2.08131 4.49177,2.02613 4.46059,2 4.44505,1.97387 4.42796,1.89344 4.37298,1.86199 4.3507,1.83015 4.32662,1.67482 4.2054,1.63047 4.17003,1.58508 4.13234,1.20884 3.81395,1.22146 3.7599,1.23538 3.70586,1.2506 3.65182,1.26713 3.59778,1.28496 3.54373,1.30409 3.48969,1.32452 3.43565,1.34625 3.38161,1.36696 3.33161,1.39856 3.25817,1.43253 3.18474,1.46887 3.1113,1.50757 3.03787,1.54864 2.96443,1.59208 2.891,1.63788 2.81756,1.68606 2.74413,1.73659 2.67069,1.7895 2.59726,1.84477 2.52382,1.90241 2.45039,1.96242 2.37695,2.0248 2.30352,2.08954 2.23008,2.15665 2.15665,2.26607 2.15409,2.3755 2.15435,2.48493 2.15744,2.59435 2.16335,2.70378 2.17208,2.8132 2.18363,2.92263 2.19801,3.03206 2.2152,3.14148 2.23522,3.25091 2.25806,3.36033 2.28373,3.46976 2.31221,3.57918 2.34352,3.68861 2.37765,3.79804 2.4146,3.90746 2.45438,3.77286 2.81292,3.72912 2.9318,3.68819 3.04785,3.65009 3.16108,3.61482 3.27149,3.58236 3.37908,3.55273 3.48384,3.52591 3.58578,3.50192 3.6849,3.48076 3.7812,3.46241 3.87467,3.44689 3.96533,3.43419 4.05316,3.42431 4.13817,3.41726 4.22035,3.41302 4.29971,3.41161 4.37626,3.41161 4.44635,3.41166 4.44702,3.42417 4.61343,3.42484 4.62197,3.43487 4.74505,3.43551 4.75253,3.44435 4.85207,3.44499 4.859,3.45368 4.94885,3.45436 4.95561,3.46376 5.04538,3.46451 5.05229,3.47563 5.15095,3.47649 5.15837,3.49103 5.27952,3.49207 5.28796,3.49295 5.29492,3.49686 5.32917,3.5 5.36419,3.5 5.44571,3.5 5.45486,3.5 5.65575,3.49821 5.68007,3.49738 5.6905,3.49516 5.71697,3.46645 6.03898,3.46523 6.05293,3.39658 6.85028,3.39459 6.87361,3.34281 7.48824,3.27331 7.49253,3.20382 7.49584,3.13432 7.49817,3.06483 7.49953))

Tolerance is: 0.0004

Simplified result is: POLYGON((1.20884 3.81395,1.1663 3.89695,1.13837 3.9535,1.11221 4.01006,1.08784 4.06661,1.06524 4.12317,1.02628 4.22659,1.00887 4.27775,0.99294 4.3289,0.978492 4.38006,0.952375 4.47996,0.941568 4.5276,0.932065 4.57524,0.91559 4.67514,0.908966 4.72079,0.903551 4.76643,0.899345 4.81207,0.896348 4.85771,0.891839 4.95499,0.89125 5,0.891839 5.04501,0.893609 5.09003,0.899345 5.18793,0.903551 5.23357,0.908966 5.27921,0.923868 5.37712,0.932065 5.42476,0.941568 5.4724,0.952375 5.52004,0.978492 5.61994,0.99294 5.6711,1.00887 5.72225,1.02628 5.77341,1.06524 5.87683,1.08784 5.93338,1.11221 5.98993,1.13836 6.04648,1.16629 6.10304,1.19292 6.1553,1.22687 6.21973,1.26309 6.28417,1.30155 6.3486,1.34227 6.41304,1.37621 6.4653,1.42695 6.54109,1.48072 6.61688,1.53754 6.69267,1.59739 6.76846,1.67765 6.86689,1.71667 6.91305,1.75679 6.9592,1.79801 7.00536,1.84033 7.05152,1.88375 7.09768,1.97387 7.19,2.02613 7.24226,2.11566 7.32986,2.20903 7.41746,2.30626 7.50507,2.40733 7.59267,2.52209 7.582,2.57436 7.57651,2.69697 7.56203,2.81959 7.54438,2.94221 7.52354,3.06483 7.49953,2.99153 7.16271,2.76489 6.09027,2.74216 5.97705,2.67213 5.60519,2.63532 5.36774,2.62318 5.26016,2.60164 5.168,2.5906 5.12662,2.57778 5.08701,2.55845 5.03242,2.54629 5.00067,2.53279 4.97027,2.50892 4.92023,2.49607 4.89498,2.48215 4.87082,2.45406 4.82499,2.44052 4.80413,2.42605 4.78419,2.39396 4.74237,2.37944 4.72443,2.36407 4.70735,2.32808 4.66943,2.31204 4.65339,2.29516 4.6382,2.2553 4.60415,2.23694 4.58929,2.21769 4.57531,2.17388 4.54521,2.15204 4.53104,2.02613 4.46059,2 4.44505,1.97387 4.42796,1.89344 4.37298,1.86199 4.3507,1.83015 4.32662,1.67482 4.2054,1.63047 4.17003,1.58508 4.13234,1.20884 3.81395,1.22146 3.7599,1.23538 3.70586,1.2506 3.65182,1.26713 3.59778,1.28496 3.54373,1.30409 3.48969,1.32452 3.43565,1.36696 3.33161,1.39856 3.25817,1.43253 3.18474,1.46887 3.1113,1.50757 3.03787,1.54864 2.96443,1.59208 2.891,1.63788 2.81756,1.68606 2.74413,1.73659 2.67069,1.7895 2.59726,1.84477 2.52382,1.90241 2.45039,1.96242 2.37695,2.0248 2.30352,2.08954 2.23008,2.15665 2.15665,2.26607 2.15409,2.3755 2.15435,2.48493 2.15744,2.59435 2.16335,2.70378 2.17208,2.8132 2.18363,2.92263 2.19801,3.03206 2.2152,3.14148 2.23522,3.25091 2.25806,3.36033 2.28373,3.46976 2.31221,3.57918 2.34352,3.68861 2.37765,3.79804 2.4146,3.90746 2.45438,3.77286 2.81292,3.72912 2.9318,3.68819 3.04785,3.65009 3.16108,3.61482 3.27149,3.58236 3.37908,3.55273 3.48384,3.52591 3.58578,3.50192 3.6849,3.48076 3.7812,3.46241 3.87467,3.44689 3.96533,3.43419 4.05316,3.42431 4.13817,3.41726 4.22035,3.41302 4.29971,3.41161 4.37626,3.41161 4.44635,3.42484 4.62197,3.43487 4.74505,3.44499 4.859,3.46451 5.05229,3.47649 5.15837,3.49686 5.32917,3.5 5.36419,3.5 5.65575,3.49516 5.71697,3.46523 6.05293,3.39658 6.85028,3.34281 7.48824,3.27331 7.49253,3.20382 7.49584,3.13432 7.49817,3.06483 7.49953))

1.67 stdout:

Ring is: POLYGON((1.20884 3.81395,1.19293 3.84469,1.1663 3.89695,1.13837 3.9535,1.11221 4.01006,1.08784 4.06661,1.06524 4.12317,1.04518 4.17544,1.02628 4.22659,1.00887 4.27775,0.99294 4.3289,0.978492 4.38006,0.964488 4.43232,0.952375 4.47996,0.941568 4.5276,0.932065 4.57524,0.923868 4.62288,0.91559 4.67514,0.908966 4.72079,0.903551 4.76643,0.899345 4.81207,0.896348 4.85771,0.893609 4.90997,0.891839 4.95499,0.89125 5,0.891839 5.04501,0.893609 5.09003,0.896348 5.14229,0.899345 5.18793,0.903551 5.23357,0.908966 5.27921,0.91559 5.32486,0.923868 5.37712,0.932065 5.42476,0.941568 5.4724,0.952375 5.52004,0.964488 5.56768,0.978492 5.61994,0.99294 5.6711,1.00887 5.72225,1.02628 5.77341,1.04518 5.82456,1.06524 5.87683,1.08784 5.93338,1.11221 5.98993,1.13836 6.04648,1.16629 6.10304,1.19292 6.1553,1.22687 6.21973,1.26309 6.28417,1.30155 6.3486,1.34227 6.41304,1.37621 6.4653,1.42695 6.54109,1.48072 6.61688,1.53754 6.69267,1.59739 6.76846,1.63972 6.82073,1.67765 6.86689,1.71667 6.91305,1.75679 6.9592,1.79801 7.00536,1.84033 7.05152,1.88375 7.09768,1.97387 7.19,2.02613 7.24226,2.11566 7.32986,2.20903 7.41746,2.30626 7.50507,2.40733 7.59267,2.52209 7.582,2.57436 7.57651,2.69697 7.56203,2.81959 7.54438,2.94221 7.52354,3.06483 7.49953,3.04552 7.41246,3.0034 7.21862,2.9966 7.18665,2.99153 7.16271,2.76836 6.10662,2.76698 6.10013,2.76489 6.09027,2.74216 5.97705,2.6906 5.70316,2.68837 5.69147,2.67984 5.6473,2.67213 5.60519,2.66543 5.564,2.65315 5.48319,2.65167 5.47366,2.63996 5.39965,2.63532 5.36774,2.63159 5.33635,2.63138 5.33435,2.6307 5.32801,2.62318 5.26016,2.61595 5.2276,2.60164 5.168,2.5906 5.12662,2.57778 5.08701,2.55845 5.03242,2.54629 5.00067,2.53279 4.97027,2.50892 4.92023,2.49607 4.89498,2.48215 4.87082,2.45406 4.82499,2.44052 4.80413,2.42605 4.78419,2.39396 4.74237,2.37944 4.72443,2.36407 4.70735,2.32808 4.66943,2.31204 4.65339,2.29516 4.6382,2.2553 4.60415,2.23694 4.58929,2.21769 4.57531,2.17388 4.54521,2.15204 4.53104,2.1292 4.51786,2.08948 4.4963,2.08131 4.49177,2.02613 4.46059,2 4.44505,1.97387 4.42796,1.89344 4.37298,1.86199 4.3507,1.83015 4.32662,1.67482 4.2054,1.63047 4.17003,1.58508 4.13234,1.20884 3.81395,1.22146 3.7599,1.23538 3.70586,1.2506 3.65182,1.26713 3.59778,1.28496 3.54373,1.30409 3.48969,1.32452 3.43565,1.34625 3.38161,1.36696 3.33161,1.39856 3.25817,1.43253 3.18474,1.46887 3.1113,1.50757 3.03787,1.54864 2.96443,1.59208 2.891,1.63788 2.81756,1.68606 2.74413,1.73659 2.67069,1.7895 2.59726,1.84477 2.52382,1.90241 2.45039,1.96242 2.37695,2.0248 2.30352,2.08954 2.23008,2.15665 2.15665,2.26607 2.15409,2.3755 2.15435,2.48493 2.15744,2.59435 2.16335,2.70378 2.17208,2.8132 2.18363,2.92263 2.19801,3.03206 2.2152,3.14148 2.23522,3.25091 2.25806,3.36033 2.28373,3.46976 2.31221,3.57918 2.34352,3.68861 2.37765,3.79804 2.4146,3.90746 2.45438,3.77286 2.81292,3.72912 2.9318,3.68819 3.04785,3.65009 3.16108,3.61482 3.27149,3.58236 3.37908,3.55273 3.48384,3.52591 3.58578,3.50192 3.6849,3.48076 3.7812,3.46241 3.87467,3.44689 3.96533,3.43419 4.05316,3.42431 4.13817,3.41726 4.22035,3.41302 4.29971,3.41161 4.37626,3.41161 4.44635,3.41166 4.44702,3.42417 4.61343,3.42484 4.62197,3.43487 4.74505,3.43551 4.75253,3.44435 4.85207,3.44499 4.859,3.45368 4.94885,3.45436 4.95561,3.46376 5.04538,3.46451 5.05229,3.47563 5.15095,3.47649 5.15837,3.49103 5.27952,3.49207 5.28796,3.49295 5.29492,3.49686 5.32917,3.5 5.36419,3.5 5.44571,3.5 5.45486,3.5 5.65575,3.49821 5.68007,3.49738 5.6905,3.49516 5.71697,3.46645 6.03898,3.46523 6.05293,3.39658 6.85028,3.39459 6.87361,3.34281 7.48824,3.27331 7.49253,3.20382 7.49584,3.13432 7.49817,3.06483 7.49953))

Tolerance is: 0.0004

Simplified result is: POLYGON((3.34281 7.48824,3.27331 7.49253,3.20382 7.49584,3.13432 7.49817,3.06483 7.49953,1.20884 3.81395,1.1663 3.89695,1.13837 3.9535,1.11221 4.01006,1.08784 4.06661,1.06524 4.12317,1.02628 4.22659,1.00887 4.27775,0.99294 4.3289,0.964488 4.43232,0.952375 4.47996,0.941568 4.5276,0.932065 4.57524,0.923868 4.62288,0.908966 4.72079,0.903551 4.76643,0.899345 4.81207,0.896348 4.85771,0.891839 4.95499,0.89125 5,0.891839 5.04501,0.896348 5.14229,0.899345 5.18793,0.903551 5.23357,0.908966 5.27921,0.923868 5.37712,0.932065 5.42476,0.941568 5.4724,0.952375 5.52004,0.978492 5.61994,0.99294 5.6711,1.00887 5.72225,1.02628 5.77341,1.04518 5.82456,1.08784 5.93338,1.11221 5.98993,1.13836 6.04648,1.19292 6.1553,1.22687 6.21973,1.26309 6.28417,1.30155 6.3486,1.34227 6.41304,1.37621 6.4653,1.42695 6.54109,1.48072 6.61688,1.53754 6.69267,1.59739 6.76846,1.67765 6.86689,1.71667 6.91305,1.75679 6.9592,1.79801 7.00536,1.84033 7.05152,1.88375 7.09768,1.97387 7.19,2.02613 7.24226,2.11566 7.32986,2.20903 7.41746,2.30626 7.50507,2.40733 7.59267,2.52209 7.582,2.57436 7.57651,2.69697 7.56203,2.81959 7.54438,2.94221 7.52354,3.06483 7.49953,2.99153 7.16271,2.76489 6.09027,2.74216 5.97705,2.67213 5.60519,2.63532 5.36774,2.62318 5.26016,2.60164 5.168,2.5906 5.12662,2.57778 5.08701,2.55845 5.03242,2.54629 5.00067,2.53279 4.97027,2.50892 4.92023,2.49607 4.89498,2.48215 4.87082,2.45406 4.82499,2.44052 4.80413,2.42605 4.78419,2.39396 4.74237,2.37944 4.72443,2.36407 4.70735,2.32808 4.66943,2.31204 4.65339,2.29516 4.6382,2.2553 4.60415,2.23694 4.58929,2.21769 4.57531,2.17388 4.54521,2.15204 4.53104,2.02613 4.46059,2 4.44505,1.97387 4.42796,1.89344 4.37298,1.86199 4.3507,1.83015 4.32662,1.67482 4.2054,1.63047 4.17003,1.58508 4.13234,1.20884 3.81395,1.22146 3.7599,1.23538 3.70586,1.2506 3.65182,1.26713 3.59778,1.28496 3.54373,1.30409 3.48969,1.32452 3.43565,1.36696 3.33161,1.39856 3.25817,1.43253 3.18474,1.46887 3.1113,1.50757 3.03787,1.54864 2.96443,1.59208 2.891,1.63788 2.81756,1.68606 2.74413,1.73659 2.67069,1.7895 2.59726,1.84477 2.52382,1.90241 2.45039,1.96242 2.37695,2.0248 2.30352,2.08954 2.23008,2.15665 2.15665,2.26607 2.15409,2.3755 2.15435,2.48493 2.15744,2.59435 2.16335,2.70378 2.17208,2.8132 2.18363,2.92263 2.19801,3.03206 2.2152,3.14148 2.23522,3.25091 2.25806,3.36033 2.28373,3.46976 2.31221,3.57918 2.34352,3.68861 2.37765,3.79804 2.4146,3.90746 2.45438,3.77286 2.81292,3.72912 2.9318,3.68819 3.04785,3.65009 3.16108,3.61482 3.27149,3.58236 3.37908,3.55273 3.48384,3.52591 3.58578,3.50192 3.6849,3.48076 3.7812,3.46241 3.87467,3.44689 3.96533,3.43419 4.05316,3.42431 4.13817,3.41726 4.22035,3.41302 4.29971,3.41161 4.37626,3.41161 4.44635,3.42484 4.62197,3.43487 4.74505,3.44499 4.859,3.46451 5.05229,3.47649 5.15837,3.49686 5.32917,3.5 5.36419,3.5 5.65575,3.49516 5.71697,3.46523 6.05293,3.39658 6.85028,3.34281 7.48824))

Change History (2)

comment:1 by Eyal Soha <eyalsoha@…>, 4 years ago

Found this regression while working on this: https://github.com/pcb2gcode/pcb2gcode/issues/167

comment:2 by Eyal Soha <eyalsoha@…>, 4 years ago

Just tested 1.68 beta. It is also broken.

Note: See TracTickets for help on using tickets.