Hi Alvin,
After updating to the latest Inkscape trunk, I've come across a regression  boolean operations on paths no longer work correctly. It appears that revision 12399 (Shape calculations  do not quantize the coordinates) is the culprit. I believe this commit attempts to fix the issue of path coordinates being rounded (and hence losing precision)  however, it looks like the boolean operation algorithms rely on this rounding to work correctly, and now fail with certain path data.
I've attached an example of an SVG file with two paths. If you "select all" and then perform a "Path/Difference" operation, it produces the expected result in 12398. If you perform these steps in 12399, both paths disappear. (If the attached file gets stripped out for some reason, it's also available at https://dl.dropboxusercontent.com/u/3442233/boolean_regression.svg).
I can understand how this error went unnoticed in simple tests  I tried drawing a couple of rects and doing a "difference" operation and it worked fine. Must be dependent on the exact shape of the path, perhaps my example file contains coordinates that give the difference algorithm some headaches due to floatingpoint precision issues (numbers being squared etc) that the coordinate rounding hides.
I guess the best option for now would be for someone to back out revision 12399. Alvin, hopefully my example SVG will allow you to find the source of the bug!
Best,
Eric
Oops, sorry, got Alvin's email address wrong. Now corrected.
On 4 July 2013 19:07, Eric Greveson <eric@...3003...> wrote:
Hi Alvin,
After updating to the latest Inkscape trunk, I've come across a regression
 boolean operations on paths no longer work correctly. It appears that
revision 12399 (Shape calculations  do not quantize the coordinates) is the culprit. I believe this commit attempts to fix the issue of path coordinates being rounded (and hence losing precision)  however, it looks like the boolean operation algorithms rely on this rounding to work correctly, and now fail with certain path data.
I've attached an example of an SVG file with two paths. If you "select all" and then perform a "Path/Difference" operation, it produces the expected result in 12398. If you perform these steps in 12399, both paths disappear. (If the attached file gets stripped out for some reason, it's also available at https://dl.dropboxusercontent.com/u/3442233/boolean_regression.svg).
I can understand how this error went unnoticed in simple tests  I tried drawing a couple of rects and doing a "difference" operation and it worked fine. Must be dependent on the exact shape of the path, perhaps my example file contains coordinates that give the difference algorithm some headaches due to floatingpoint precision issues (numbers being squared etc) that the coordinate rounding hides.
I guess the best option for now would be for someone to back out revision 12399. Alvin, hopefully my example SVG will allow you to find the source of the bug!
Best,
Eric
Hi, Thanks for testing! I will be out of town for the next week or so, returning on July 12. I will investigate it as soon as I return.
 Alvin
 View this message in context: http://inkscape.13.x6.nabble.com/Regressioninrev12399tp4967267p4967270.h... Sent from the Inkscape  Dev mailing list archive at Nabble.com.
I've given a try and the boolean operation is correctly performed with rev. 12399 under Windows XP SP3. Luca
 View this message in context: http://inkscape.13.x6.nabble.com/Regressioninrev12399tp4967267p4967271.h... Sent from the Inkscape  Dev mailing list archive at Nabble.com.
On 20130705 09:23 +0100, LucaDC wrote:
I've given a try and the boolean operation is correctly performed with rev. 12399 under Windows XP SP3.
Regression reproduced with various builds of r12399 on OS X 10.7.5 (64bit; compiled with Apple llvmgcc4.2, Apple clang 3.1, FSF GCC 4.6.3; fresh default preferences for each test run), based on Eric's sample SVG file and these instructions:
On 20130704 20:07 +0100, Eric Greveson wrote:
If you "select all" and then perform a "Path/Difference" operation, it produces the expected result in 12398. If you perform these steps in 12399, both paths disappear.
With r12399, both paths disappear as described. Not reproduced with older archived builds based on rev. 12395.
Same results also with local trunk builds on Ubuntu 12.10 (64bit, VM):  works as expected with r12398,  both paths disappear with r12399
On 20130704 20:07 +0100, Eric Greveson wrote:
After updating to the latest Inkscape trunk, I've come across a regression  boolean operations on paths no longer work correctly. It appears that revision 12399 (Shape calculations  do not quantize the coordinates) is the culprit. I believe this commit attempts to fix the issue of path coordinates being rounded (and hence losing precision)  however, it looks like the boolean operation algorithms rely on this rounding to work correctly, and now fail with certain path data.
Attaching another sample file which exposes a likely related regression with 'Stroke to path' in r12399 and later revisions:
1) select all four paths on the current layer (Ctrl+A) 2) apply 'Path > Stroke to Path' (Ctrl+Alt+C)
 works as expected in stable and trunk <= r12398,  produces incorrect result with r12399 and later revisions.
Test case was created on OS X 10.7.5 and reproduced on Ubuntu 12.10 (VM, 64bit)  the resulting incorrect paths are not identical on the two platforms though.
boolean_regression_XP.svg http://inkscape.13.x6.nabble.com/file/n4967358/boolean_regression_XP.svg running Windows XP and Inkscape rev 12417, I am not able to reproduce the problem originally reported, using the file boolean_regression.svg. When I load this file and perform Path>Difference, I get the attached result, which appears to be okay. However, I have reproduced the problem reported by ~suv using the file stroketopathregressionr12399, so I will start by looking at that issue. Will report back here as soon as I find something.
 Alvin
 View this message in context: http://inkscape.13.x6.nabble.com/Regressioninrev12399tp4967267p4967358.h... Sent from the Inkscape  Dev mailing list archive at Nabble.com.
fix committed to rev 12420.
While testing the behaviour of the file stroketopathregressionr12399.svg, it was found that there were a large number of redundant paths being generated, typically of a length of 0.0005 px. These were not present in the original code, before the grid was removed, and were clearly the result of numerical roundoff error. Therefore the grid was reintroduced, but at a smaller spacing, just large enough to eliminate the redundant paths. The original grid spacing was 1/32 px. The new grid spacing is 1/512 px. This is large enough that the redundant paths do not appear, but is still sufficiently small that the errors reported in Bug 168158 are not observable.
With this new grid spacing, the file stroketopathregressionr12399.svg behaves correctly on Windows XP.
 Alvin
 View this message in context: http://inkscape.13.x6.nabble.com/Regressioninrev12399tp4967267p4967396.h... Sent from the Inkscape  Dev mailing list archive at Nabble.com.
participants (4)

alvinpenner

Eric Greveson

LucaDC

su_v