some paths make all boolean operations fail (empty result)

Bug #614577 reported by Anonymous Reporter on 2010-08-06
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Alvin Penner

Bug Description

(bug is happening on 0.47 and 0.48+devel r9640)

See the test case.

The union of the two overlapping half-circles yields an empty result, which makes no sense. The star also disappears if it is selected for the union operation!

If you do the union of the 3 paths in two steps, you will still get an empty result if you start by uniting the inner half-circle and the star (and then uniting the result with the outer half-circle), but if you start by uniting the outer half-circle and the star everything works fine. This is probably because the paths are slightly modified by the operation, even if it's a disjoint union.

The bug also occurs with other boolean operations, e.g. intersection.

Anonymous Reporter (isbugz) wrote :
su_v (suv-lp) on 2010-08-06
tags: added: boolops
su_v (suv-lp) wrote :

reproduced with Inkscape 0.47 and 0.48+devel 9691 on OS X 10.5.8

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Anonymous Reporter (isbugz) wrote :

Here is another test case that exhibits non-deterministic behavior: sometimes it yields an empty result like the first test case, but most of the time it only suppresses one of the two paths that make the handle of the wand (which is not a correct behavior either).

su_v (suv-lp) wrote :

Possibly related to scale/precision? Both of your examples are 'miniscule' in size (dimensions in px). Can you reproduce similar examples with closed paths higher or wider than 1 px, or e.g. with drawings in a size where the results of the path operations would be distinguishable if viewed 1:1?

su_v (suv-lp) wrote :

Forget about my last comment - path operations work without error when I tried to reproduce it with even smaller paths (created e.g. by converting a stroked path with round caps (2 nodes) to a filled path). The failure to correctly apply path operations like union seems caused by the geometry of the path nodes.

Yet - when uniformly scaling the two paths in each of your examples (e.g. by 200%), 'Path > Union' works without failure.

Anonymous Reporter (isbugz) wrote :

In fact the problem seems to come from the fact that in both files, two nodes have the same position. If you identify the duplicate nodes, select each pair and "Delete segment between non-endpoint nodes" and "Join selected nodes" the problem doesn't occur. To add to the subtlety, the nodes involved are the very first and the very last one, so depending on round-off error the "duplicate" nodes may or not have identical coordinates.

So you could either apply a pre-processing pass to remove (almost-)duplicate nodes before performing boolean operations, or solve the problem at the root by limiting the impact of NaN or catastrophic loss of precision before it's too late.

(I encountered this bug on the way, it might be related: https://bugs.launchpad.net/inkscape/+bug/614628 )

su_v (suv-lp) wrote :

Possibly duplicate of bug #168907 “no output when unioning large numbers of shapes” (also involves tiny dimensions - «The path is REALLY tiny, it's only about 6 pixels long at 25600% zoom.»), and might be rooted in bug #168158 “Path Boolean operations are imprecise”.

Leoneof (leon3000) wrote :

when i select two objects, and then Path -->Union , it will disappear two objects.

check the attached file.

Rob Antonishen (rob-antonishen) wrote :

This seems to be the larger case where a single shape with co-linear points causes union to return a null set, regardless of scale.

Attached is a sample case. select the two shapes and perform a union. The shapes disappear.

This condition also exists in the example provided for https://bugs.launchpad.net/inkscape/+bug/168907

still exists in windows 4.8 dev build.

Alvin Penner (apenner) wrote :

a partial fix has been committed to rev 12176. The fix was tested as follows:

1. file inkbug-q.svg. A Path->Union operation on the two semi-circles still causes both of them to disappear, this appears to be a separate bug.

2. file unionerror.svg. Previously both the rectangle and the line would disappear. Now the rectangle stays, the line disappears. As far as I can tell, I believe this is done deliberately by design, not a bug. The top four boolops on the Path menu are designed to operate only on objects that have a finite amount of Fill area.

3. file problem_02.svg. Previously both objects would disappear, now the larger one is kept. This appears to be caused by round-off error and the small size of the second object. If both objects are scaled up uniformly by a factor of about 10 or so, then both objects survive the Union, as expected.

Alvin Penner (apenner) wrote :

fix committed to rev 12279.

for the file inkbug-q.svg, a Path->Union operation will now work normally

Changed in inkscape:
status: Confirmed → Fix Committed
su_v (suv-lp) on 2013-12-07
Changed in inkscape:
milestone: none → 0.49
assignee: nobody → Alvin Penner (apenner)
milestone: 0.49 → none
su_v (suv-lp) on 2013-12-07
Changed in inkscape:
milestone: none → 0.49
Bryce Harrington (bryce) on 2015-02-21
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers